@amqp-contract/core 0.24.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/index.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  ### AmqpClient
10
10
 
11
- Defined in: [packages/core/src/amqp-client.ts:129](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/amqp-client.ts#L129)
11
+ Defined in: [packages/core/src/amqp-client.ts:141](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/amqp-client.ts#L141)
12
12
 
13
13
  AMQP client that manages connections and channels with automatic topology setup.
14
14
 
@@ -18,7 +18,7 @@ This class handles:
18
18
  - Automatic AMQP topology setup (exchanges, queues, bindings) from contract
19
19
  - Channel creation with JSON serialization enabled by default
20
20
 
21
- All operations return `ResultAsync<T, TechnicalError>` for consistent error handling.
21
+ All operations return `AsyncResult<T, TechnicalError>` for consistent error handling.
22
22
 
23
23
  #### Example
24
24
 
@@ -28,7 +28,7 @@ const client = new AmqpClient(contract, {
28
28
  connectionOptions: { heartbeatIntervalInSeconds: 30 }
29
29
  });
30
30
 
31
- // Wait for connection (ResultAsync is thenable)
31
+ // Wait for connection (AsyncResult is thenable)
32
32
  await client.waitForConnect();
33
33
 
34
34
  // Publish a message
@@ -46,7 +46,7 @@ await client.close();
46
46
  new AmqpClient(contract, options): AmqpClient;
47
47
  ```
48
48
 
49
- Defined in: [packages/core/src/amqp-client.ts:148](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/amqp-client.ts#L148)
49
+ Defined in: [packages/core/src/amqp-client.ts:169](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/amqp-client.ts#L169)
50
50
 
51
51
  Create a new AMQP client instance.
52
52
 
@@ -74,7 +74,7 @@ The client will automatically:
74
74
  ack(msg, allUpTo?): void;
75
75
  ```
76
76
 
77
- Defined in: [packages/core/src/amqp-client.ts:315](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/amqp-client.ts#L315)
77
+ Defined in: [packages/core/src/amqp-client.ts:426](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/amqp-client.ts#L426)
78
78
 
79
79
  Acknowledge a message.
80
80
 
@@ -95,7 +95,7 @@ Acknowledge a message.
95
95
  addSetup(setup): void;
96
96
  ```
97
97
 
98
- Defined in: [packages/core/src/amqp-client.ts:337](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/amqp-client.ts#L337)
98
+ Defined in: [packages/core/src/amqp-client.ts:448](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/amqp-client.ts#L448)
99
99
 
100
100
  Add a setup function to be called when the channel is created or reconnected.
101
101
 
@@ -114,10 +114,10 @@ This is useful for setting up channel-level configuration like prefetch.
114
114
  ##### cancel()
115
115
 
116
116
  ```ts
117
- cancel(consumerTag): ResultAsync<void, TechnicalError>;
117
+ cancel(consumerTag): AsyncResult<void, TechnicalError>;
118
118
  ```
119
119
 
120
- Defined in: [packages/core/src/amqp-client.ts:302](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/amqp-client.ts#L302)
120
+ Defined in: [packages/core/src/amqp-client.ts:395](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/amqp-client.ts#L395)
121
121
 
122
122
  Cancel a consumer by its consumer tag.
123
123
 
@@ -129,15 +129,15 @@ Cancel a consumer by its consumer tag.
129
129
 
130
130
  ###### Returns
131
131
 
132
- `ResultAsync`&lt;`void`, [`TechnicalError`](#technicalerror)&gt;
132
+ `AsyncResult`&lt;`void`, [`TechnicalError`](#technicalerror)&gt;
133
133
 
134
134
  ##### close()
135
135
 
136
136
  ```ts
137
- close(): ResultAsync<void, TechnicalError>;
137
+ close(): AsyncResult<void, TechnicalError>;
138
138
  ```
139
139
 
140
- Defined in: [packages/core/src/amqp-client.ts:367](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/amqp-client.ts#L367)
140
+ Defined in: [packages/core/src/amqp-client.ts:478](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/amqp-client.ts#L478)
141
141
 
142
142
  Close the channel and release the connection reference.
143
143
 
@@ -151,7 +151,7 @@ errors are wrapped in an AggregateError.
151
151
 
152
152
  ###### Returns
153
153
 
154
- `ResultAsync`&lt;`void`, [`TechnicalError`](#technicalerror)&gt;
154
+ `AsyncResult`&lt;`void`, [`TechnicalError`](#technicalerror)&gt;
155
155
 
156
156
  ##### consume()
157
157
 
@@ -159,13 +159,25 @@ errors are wrapped in an AggregateError.
159
159
  consume(
160
160
  queue,
161
161
  callback,
162
- options?): ResultAsync<string, TechnicalError>;
162
+ options?): AsyncResult<string, TechnicalError>;
163
163
  ```
164
164
 
165
- Defined in: [packages/core/src/amqp-client.ts:288](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/amqp-client.ts#L288)
165
+ Defined in: [packages/core/src/amqp-client.ts:321](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/amqp-client.ts#L321)
166
166
 
167
167
  Start consuming messages from a queue.
168
168
 
169
+ If `options.prefetch` is set, a per-consumer prefetch count is applied via
170
+ `channel.prefetch(count, false)` registered as a setup function on the
171
+ channel wrapper *before* the underlying `consume` call. Registering it via
172
+ `addSetup` ensures the prefetch is reapplied automatically on channel
173
+ reconnect; using `global=false` scopes it to subsequent consumers on the
174
+ channel (RabbitMQ semantics — opposite of intuition: `false` is per-
175
+ consumer, `true` is channel-wide).
176
+
177
+ `prefetch` is stripped from the options handed to `channelWrapper.consume`
178
+ because it is not a valid `amqplib` `Options.Consume` field — leaving it
179
+ in would just travel as a no-op key-value pair on the consume frame.
180
+
169
181
  ###### Parameters
170
182
 
171
183
  | Parameter | Type |
@@ -176,9 +188,9 @@ Start consuming messages from a queue.
176
188
 
177
189
  ###### Returns
178
190
 
179
- `ResultAsync`&lt;`string`, [`TechnicalError`](#technicalerror)&gt;
191
+ `AsyncResult`&lt;`string`, [`TechnicalError`](#technicalerror)&gt;
180
192
 
181
- ResultAsync resolving to the consumer tag.
193
+ AsyncResult resolving to the consumer tag.
182
194
 
183
195
  ##### getConnection()
184
196
 
@@ -186,7 +198,7 @@ ResultAsync resolving to the consumer tag.
186
198
  getConnection(): IAmqpConnectionManager;
187
199
  ```
188
200
 
189
- Defined in: [packages/core/src/amqp-client.ts:203](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/amqp-client.ts#L203)
201
+ Defined in: [packages/core/src/amqp-client.ts:224](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/amqp-client.ts#L224)
190
202
 
191
203
  Get the underlying connection manager
192
204
 
@@ -209,7 +221,7 @@ nack(
209
221
  requeue?): void;
210
222
  ```
211
223
 
212
- Defined in: [packages/core/src/amqp-client.ts:326](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/amqp-client.ts#L326)
224
+ Defined in: [packages/core/src/amqp-client.ts:437](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/amqp-client.ts#L437)
213
225
 
214
226
  Negative acknowledge a message.
215
227
 
@@ -231,7 +243,7 @@ Negative acknowledge a message.
231
243
  on(event, listener): void;
232
244
  ```
233
245
 
234
- Defined in: [packages/core/src/amqp-client.ts:352](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/amqp-client.ts#L352)
246
+ Defined in: [packages/core/src/amqp-client.ts:463](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/amqp-client.ts#L463)
235
247
 
236
248
  Register an event listener on the channel wrapper.
237
249
 
@@ -258,10 +270,10 @@ publish(
258
270
  exchange,
259
271
  routingKey,
260
272
  content,
261
- options?): ResultAsync<boolean, TechnicalError>;
273
+ options?): AsyncResult<boolean, TechnicalError>;
262
274
  ```
263
275
 
264
- Defined in: [packages/core/src/amqp-client.ts:255](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/amqp-client.ts#L255)
276
+ Defined in: [packages/core/src/amqp-client.ts:276](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/amqp-client.ts#L276)
265
277
 
266
278
  Publish a message to an exchange.
267
279
 
@@ -272,13 +284,13 @@ Publish a message to an exchange.
272
284
  | `exchange` | `string` |
273
285
  | `routingKey` | `string` |
274
286
  | `content` | `unknown` |
275
- | `options?` | [`PublishOptions`](#publishoptions) |
287
+ | `options?` | `Publish` |
276
288
 
277
289
  ###### Returns
278
290
 
279
- `ResultAsync`&lt;`boolean`, [`TechnicalError`](#technicalerror)&gt;
291
+ `AsyncResult`&lt;`boolean`, [`TechnicalError`](#technicalerror)&gt;
280
292
 
281
- ResultAsync resolving to `true` if the message was sent, `false` if the channel buffer is full.
293
+ AsyncResult resolving to `true` if the message was sent, `false` if the channel buffer is full.
282
294
 
283
295
  ##### sendToQueue()
284
296
 
@@ -286,10 +298,10 @@ ResultAsync resolving to `true` if the message was sent, `false` if the channel
286
298
  sendToQueue(
287
299
  queue,
288
300
  content,
289
- options?): ResultAsync<boolean, TechnicalError>;
301
+ options?): AsyncResult<boolean, TechnicalError>;
290
302
  ```
291
303
 
292
- Defined in: [packages/core/src/amqp-client.ts:272](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/amqp-client.ts#L272)
304
+ Defined in: [packages/core/src/amqp-client.ts:293](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/amqp-client.ts#L293)
293
305
 
294
306
  Publish a message directly to a queue.
295
307
 
@@ -299,26 +311,26 @@ Publish a message directly to a queue.
299
311
  | ------ | ------ |
300
312
  | `queue` | `string` |
301
313
  | `content` | `unknown` |
302
- | `options?` | [`PublishOptions`](#publishoptions) |
314
+ | `options?` | `Publish` |
303
315
 
304
316
  ###### Returns
305
317
 
306
- `ResultAsync`&lt;`boolean`, [`TechnicalError`](#technicalerror)&gt;
318
+ `AsyncResult`&lt;`boolean`, [`TechnicalError`](#technicalerror)&gt;
307
319
 
308
- ResultAsync resolving to `true` if the message was sent, `false` if the channel buffer is full.
320
+ AsyncResult resolving to `true` if the message was sent, `false` if the channel buffer is full.
309
321
 
310
322
  ##### waitForConnect()
311
323
 
312
324
  ```ts
313
- waitForConnect(): ResultAsync<void, TechnicalError>;
325
+ waitForConnect(): AsyncResult<void, TechnicalError>;
314
326
  ```
315
327
 
316
- Defined in: [packages/core/src/amqp-client.ts:221](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/amqp-client.ts#L221)
328
+ Defined in: [packages/core/src/amqp-client.ts:242](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/amqp-client.ts#L242)
317
329
 
318
330
  Wait for the channel to be connected and ready.
319
331
 
320
332
  If `connectTimeoutMs` was provided in the constructor options, the returned
321
- ResultAsync resolves to `err(TechnicalError)` once the timeout elapses.
333
+ AsyncResult resolves to `err(TechnicalError)` once the timeout elapses.
322
334
  Without a timeout, this waits forever — amqp-connection-manager retries
323
335
  connections indefinitely and never errors on its own.
324
336
 
@@ -330,30 +342,40 @@ automatically. The typed factories handle this cleanup for you.
330
342
 
331
343
  ###### Returns
332
344
 
333
- `ResultAsync`&lt;`void`, [`TechnicalError`](#technicalerror)&gt;
345
+ `AsyncResult`&lt;`void`, [`TechnicalError`](#technicalerror)&gt;
334
346
 
335
347
  ***
336
348
 
337
349
  ### MessageValidationError
338
350
 
339
- Defined in: [packages/core/src/errors.ts:33](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/errors.ts#L33)
351
+ Defined in: [packages/core/src/errors.ts:38](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/errors.ts#L38)
340
352
 
341
353
  Error thrown when message validation fails (payload or headers).
342
354
 
343
355
  Used by both the client (publish-time payload validation) and the worker
344
- (consume-time payload and headers validation).
356
+ (consume-time payload and headers validation). Carries a `_tag` of
357
+ `"@amqp-contract/MessageValidationError"` (namespaced to avoid collisions);
358
+ the `Error.name` is kept bare (`"MessageValidationError"`).
345
359
 
346
360
  #### Param
347
361
 
362
+ **source**
363
+
348
364
  The name of the publisher or consumer that triggered the validation
349
365
 
350
366
  #### Param
351
367
 
368
+ **issues**
369
+
352
370
  The validation issues from the Standard Schema validation
353
371
 
354
372
  #### Extends
355
373
 
356
- - `Error`
374
+ - `TaggedErrorInstance`&lt;`"@amqp-contract/MessageValidationError"`, \{
375
+ `issues`: `unknown`;
376
+ `message`: `string`;
377
+ `source`: `string`;
378
+ \}&gt;
357
379
 
358
380
  #### Constructors
359
381
 
@@ -363,7 +385,7 @@ The validation issues from the Standard Schema validation
363
385
  new MessageValidationError(source, issues): MessageValidationError;
364
386
  ```
365
387
 
366
- Defined in: [packages/core/src/errors.ts:34](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/errors.ts#L34)
388
+ Defined in: [packages/core/src/errors.ts:45](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/errors.ts#L45)
367
389
 
368
390
  ###### Parameters
369
391
 
@@ -379,237 +401,51 @@ Defined in: [packages/core/src/errors.ts:34](https://github.com/btravers/amqp-co
379
401
  ###### Overrides
380
402
 
381
403
  ```ts
382
- Error.constructor
404
+ TaggedError("@amqp-contract/MessageValidationError", {
405
+ name: "MessageValidationError",
406
+ })<{
407
+ message: string;
408
+ source: string;
409
+ issues: unknown;
410
+ }>.constructor
383
411
  ```
384
412
 
385
413
  #### Properties
386
414
 
387
- | Property | Modifier | Type | Description | Inherited from | Defined in |
388
- | ------ | ------ | ------ | ------ | ------ | ------ |
389
- | <a id="cause"></a> `cause?` | `public` | `unknown` | - | `Error.cause` | node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:24 |
390
- | <a id="issues"></a> `issues` | `readonly` | `unknown` | - | - | [packages/core/src/errors.ts:36](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/errors.ts#L36) |
391
- | <a id="message"></a> `message` | `public` | `string` | - | `Error.message` | node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es5.d.ts:1075 |
392
- | <a id="name"></a> `name` | `public` | `string` | - | `Error.name` | node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es5.d.ts:1074 |
393
- | <a id="source"></a> `source` | `readonly` | `string` | - | - | [packages/core/src/errors.ts:35](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/errors.ts#L35) |
394
- | <a id="stack"></a> `stack?` | `public` | `string` | - | `Error.stack` | node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 |
395
- | <a id="stacktracelimit"></a> `stackTraceLimit` | `static` | `number` | The `Error.stackTraceLimit` property specifies the number of stack frames collected by a stack trace (whether generated by `new Error().stack` or `Error.captureStackTrace(obj)`). The default value is `10` but may be set to any valid JavaScript number. Changes will affect any stack trace captured _after_ the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. | `Error.stackTraceLimit` | node\_modules/.pnpm/@types+node@25.6.0/node\_modules/@types/node/globals.d.ts:67 |
396
-
397
- #### Methods
398
-
399
- ##### captureStackTrace()
400
-
401
- ###### Call Signature
402
-
403
- ```ts
404
- static captureStackTrace(targetObject, constructorOpt?): void;
405
- ```
406
-
407
- Defined in: node\_modules/.pnpm/@types+node@25.6.0/node\_modules/@types/node/globals.d.ts:51
408
-
409
- Creates a `.stack` property on `targetObject`, which when accessed returns
410
- a string representing the location in the code at which
411
- `Error.captureStackTrace()` was called.
412
-
413
- ```js
414
- const myObject = {};
415
- Error.captureStackTrace(myObject);
416
- myObject.stack; // Similar to `new Error().stack`
417
- ```
418
-
419
- The first line of the trace will be prefixed with
420
- `${myObject.name}: ${myObject.message}`.
421
-
422
- The optional `constructorOpt` argument accepts a function. If given, all frames
423
- above `constructorOpt`, including `constructorOpt`, will be omitted from the
424
- generated stack trace.
425
-
426
- The `constructorOpt` argument is useful for hiding implementation
427
- details of error generation from the user. For instance:
428
-
429
- ```js
430
- function a() {
431
- b();
432
- }
433
-
434
- function b() {
435
- c();
436
- }
437
-
438
- function c() {
439
- // Create an error without stack trace to avoid calculating the stack trace twice.
440
- const { stackTraceLimit } = Error;
441
- Error.stackTraceLimit = 0;
442
- const error = new Error();
443
- Error.stackTraceLimit = stackTraceLimit;
444
-
445
- // Capture the stack trace above function b
446
- Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
447
- throw error;
448
- }
449
-
450
- a();
451
- ```
452
-
453
- ###### Parameters
454
-
455
- | Parameter | Type |
456
- | ------ | ------ |
457
- | `targetObject` | `object` |
458
- | `constructorOpt?` | `Function` |
459
-
460
- ###### Returns
461
-
462
- `void`
463
-
464
- ###### Inherited from
465
-
466
- ```ts
467
- Error.captureStackTrace
468
- ```
469
-
470
- ###### Call Signature
471
-
472
- ```ts
473
- static captureStackTrace(targetObject, constructorOpt?): void;
474
- ```
475
-
476
- Defined in: node\_modules/.pnpm/@types+node@24.12.2/node\_modules/@types/node/globals.d.ts:52
477
-
478
- Creates a `.stack` property on `targetObject`, which when accessed returns
479
- a string representing the location in the code at which
480
- `Error.captureStackTrace()` was called.
481
-
482
- ```js
483
- const myObject = {};
484
- Error.captureStackTrace(myObject);
485
- myObject.stack; // Similar to `new Error().stack`
486
- ```
487
-
488
- The first line of the trace will be prefixed with
489
- `${myObject.name}: ${myObject.message}`.
490
-
491
- The optional `constructorOpt` argument accepts a function. If given, all frames
492
- above `constructorOpt`, including `constructorOpt`, will be omitted from the
493
- generated stack trace.
494
-
495
- The `constructorOpt` argument is useful for hiding implementation
496
- details of error generation from the user. For instance:
497
-
498
- ```js
499
- function a() {
500
- b();
501
- }
502
-
503
- function b() {
504
- c();
505
- }
506
-
507
- function c() {
508
- // Create an error without stack trace to avoid calculating the stack trace twice.
509
- const { stackTraceLimit } = Error;
510
- Error.stackTraceLimit = 0;
511
- const error = new Error();
512
- Error.stackTraceLimit = stackTraceLimit;
513
-
514
- // Capture the stack trace above function b
515
- Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
516
- throw error;
517
- }
518
-
519
- a();
520
- ```
521
-
522
- ###### Parameters
523
-
524
- | Parameter | Type |
525
- | ------ | ------ |
526
- | `targetObject` | `object` |
527
- | `constructorOpt?` | `Function` |
528
-
529
- ###### Returns
530
-
531
- `void`
532
-
533
- ###### Inherited from
534
-
535
- ```ts
536
- Error.captureStackTrace
537
- ```
538
-
539
- ##### prepareStackTrace()
540
-
541
- ###### Call Signature
542
-
543
- ```ts
544
- static prepareStackTrace(err, stackTraces): any;
545
- ```
546
-
547
- Defined in: node\_modules/.pnpm/@types+node@25.6.0/node\_modules/@types/node/globals.d.ts:55
548
-
549
- ###### Parameters
550
-
551
- | Parameter | Type |
552
- | ------ | ------ |
553
- | `err` | `Error` |
554
- | `stackTraces` | `CallSite`[] |
555
-
556
- ###### Returns
557
-
558
- `any`
559
-
560
- ###### See
561
-
562
- https://v8.dev/docs/stack-trace-api#customizing-stack-traces
563
-
564
- ###### Inherited from
565
-
566
- ```ts
567
- Error.prepareStackTrace
568
- ```
569
-
570
- ###### Call Signature
571
-
572
- ```ts
573
- static prepareStackTrace(err, stackTraces): any;
574
- ```
575
-
576
- Defined in: node\_modules/.pnpm/@types+node@24.12.2/node\_modules/@types/node/globals.d.ts:56
577
-
578
- ###### Parameters
579
-
580
- | Parameter | Type |
581
- | ------ | ------ |
582
- | `err` | `Error` |
583
- | `stackTraces` | `CallSite`[] |
584
-
585
- ###### Returns
586
-
587
- `any`
588
-
589
- ###### See
590
-
591
- https://v8.dev/docs/stack-trace-api#customizing-stack-traces
592
-
593
- ###### Inherited from
594
-
595
- ```ts
596
- Error.prepareStackTrace
597
- ```
415
+ | Property | Modifier | Type | Inherited from | Defined in |
416
+ | ------ | ------ | ------ | ------ | ------ |
417
+ | <a id="_tag"></a> `_tag` | `readonly` | `"@amqp-contract/MessageValidationError"` | `TaggedError("@amqp-contract/MessageValidationError", { name: "MessageValidationError", })._tag` | node\_modules/.pnpm/unthrown@0.2.0/node\_modules/unthrown/dist/index.d.mts:638 |
418
+ | <a id="cause"></a> `cause?` | `public` | `unknown` | `TaggedError("@amqp-contract/MessageValidationError", { name: "MessageValidationError", }).cause` | node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:24 |
419
+ | <a id="issues"></a> `issues` | `readonly` | `unknown` | `TaggedError("@amqp-contract/MessageValidationError", { name: "MessageValidationError", }).issues` | [packages/core/src/errors.ts:43](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/errors.ts#L43) |
420
+ | <a id="message"></a> `message` | `public` | `string` | `TaggedError("@amqp-contract/MessageValidationError", { name: "MessageValidationError", }).message` | node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es5.d.ts:1075 |
421
+ | <a id="name"></a> `name` | `public` | `string` | `TaggedError("@amqp-contract/MessageValidationError", { name: "MessageValidationError", }).name` | node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es5.d.ts:1074 |
422
+ | <a id="source"></a> `source` | `readonly` | `string` | `TaggedError("@amqp-contract/MessageValidationError", { name: "MessageValidationError", }).source` | [packages/core/src/errors.ts:42](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/errors.ts#L42) |
423
+ | <a id="stack"></a> `stack?` | `public` | `string` | `TaggedError("@amqp-contract/MessageValidationError", { name: "MessageValidationError", }).stack` | node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 |
598
424
 
599
425
  ***
600
426
 
601
427
  ### TechnicalError
602
428
 
603
- Defined in: [packages/core/src/errors.ts:7](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/errors.ts#L7)
429
+ Defined in: [packages/core/src/errors.ts:16](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/errors.ts#L16)
604
430
 
605
431
  Error for technical/runtime failures that cannot be prevented by TypeScript.
606
432
 
607
433
  This includes AMQP connection failures, channel issues, validation failures,
608
434
  and other runtime errors. This error is shared across core, worker, and client packages.
609
435
 
436
+ Built on unthrown's [TaggedError](https://github.com/btravstack/unthrown), so it carries a `_tag` of
437
+ `"@amqp-contract/TechnicalError"` for exhaustive dispatch via `matchTags`. The
438
+ tag is namespaced to avoid colliding with other libraries' tags in a shared
439
+ `matchTags`; the human-facing `Error.name` is kept bare (`"TechnicalError"`).
440
+ Remains a real `Error` (and a *modeled* error — it lives in the `E` channel of
441
+ a `Result`, never the `Defect` channel).
442
+
610
443
  #### Extends
611
444
 
612
- - `Error`
445
+ - `TaggedErrorInstance`&lt;`"@amqp-contract/TechnicalError"`, \{
446
+ `cause?`: `unknown`;
447
+ `message`: `string`;
448
+ \}&gt;
613
449
 
614
450
  #### Constructors
615
451
 
@@ -619,7 +455,7 @@ and other runtime errors. This error is shared across core, worker, and client p
619
455
  new TechnicalError(message, cause?): TechnicalError;
620
456
  ```
621
457
 
622
- Defined in: [packages/core/src/errors.ts:8](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/errors.ts#L8)
458
+ Defined in: [packages/core/src/errors.ts:22](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/errors.ts#L22)
623
459
 
624
460
  ###### Parameters
625
461
 
@@ -635,220 +471,23 @@ Defined in: [packages/core/src/errors.ts:8](https://github.com/btravers/amqp-con
635
471
  ###### Overrides
636
472
 
637
473
  ```ts
638
- Error.constructor
474
+ TaggedError("@amqp-contract/TechnicalError", {
475
+ name: "TechnicalError",
476
+ })<{
477
+ message: string;
478
+ cause?: unknown;
479
+ }>.constructor
639
480
  ```
640
481
 
641
482
  #### Properties
642
483
 
643
- | Property | Modifier | Type | Description | Inherited from | Defined in |
644
- | ------ | ------ | ------ | ------ | ------ | ------ |
645
- | <a id="cause-1"></a> `cause?` | `readonly` | `unknown` | - | `Error.cause` | [packages/core/src/errors.ts:10](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/errors.ts#L10) |
646
- | <a id="message-1"></a> `message` | `public` | `string` | - | `Error.message` | node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es5.d.ts:1075 |
647
- | <a id="name-1"></a> `name` | `public` | `string` | - | `Error.name` | node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es5.d.ts:1074 |
648
- | <a id="stack-1"></a> `stack?` | `public` | `string` | - | `Error.stack` | node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 |
649
- | <a id="stacktracelimit-1"></a> `stackTraceLimit` | `static` | `number` | The `Error.stackTraceLimit` property specifies the number of stack frames collected by a stack trace (whether generated by `new Error().stack` or `Error.captureStackTrace(obj)`). The default value is `10` but may be set to any valid JavaScript number. Changes will affect any stack trace captured _after_ the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. | `Error.stackTraceLimit` | node\_modules/.pnpm/@types+node@25.6.0/node\_modules/@types/node/globals.d.ts:67 |
650
-
651
- #### Methods
652
-
653
- ##### captureStackTrace()
654
-
655
- ###### Call Signature
656
-
657
- ```ts
658
- static captureStackTrace(targetObject, constructorOpt?): void;
659
- ```
660
-
661
- Defined in: node\_modules/.pnpm/@types+node@25.6.0/node\_modules/@types/node/globals.d.ts:51
662
-
663
- Creates a `.stack` property on `targetObject`, which when accessed returns
664
- a string representing the location in the code at which
665
- `Error.captureStackTrace()` was called.
666
-
667
- ```js
668
- const myObject = {};
669
- Error.captureStackTrace(myObject);
670
- myObject.stack; // Similar to `new Error().stack`
671
- ```
672
-
673
- The first line of the trace will be prefixed with
674
- `${myObject.name}: ${myObject.message}`.
675
-
676
- The optional `constructorOpt` argument accepts a function. If given, all frames
677
- above `constructorOpt`, including `constructorOpt`, will be omitted from the
678
- generated stack trace.
679
-
680
- The `constructorOpt` argument is useful for hiding implementation
681
- details of error generation from the user. For instance:
682
-
683
- ```js
684
- function a() {
685
- b();
686
- }
687
-
688
- function b() {
689
- c();
690
- }
691
-
692
- function c() {
693
- // Create an error without stack trace to avoid calculating the stack trace twice.
694
- const { stackTraceLimit } = Error;
695
- Error.stackTraceLimit = 0;
696
- const error = new Error();
697
- Error.stackTraceLimit = stackTraceLimit;
698
-
699
- // Capture the stack trace above function b
700
- Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
701
- throw error;
702
- }
703
-
704
- a();
705
- ```
706
-
707
- ###### Parameters
708
-
709
- | Parameter | Type |
710
- | ------ | ------ |
711
- | `targetObject` | `object` |
712
- | `constructorOpt?` | `Function` |
713
-
714
- ###### Returns
715
-
716
- `void`
717
-
718
- ###### Inherited from
719
-
720
- ```ts
721
- Error.captureStackTrace
722
- ```
723
-
724
- ###### Call Signature
725
-
726
- ```ts
727
- static captureStackTrace(targetObject, constructorOpt?): void;
728
- ```
729
-
730
- Defined in: node\_modules/.pnpm/@types+node@24.12.2/node\_modules/@types/node/globals.d.ts:52
731
-
732
- Creates a `.stack` property on `targetObject`, which when accessed returns
733
- a string representing the location in the code at which
734
- `Error.captureStackTrace()` was called.
735
-
736
- ```js
737
- const myObject = {};
738
- Error.captureStackTrace(myObject);
739
- myObject.stack; // Similar to `new Error().stack`
740
- ```
741
-
742
- The first line of the trace will be prefixed with
743
- `${myObject.name}: ${myObject.message}`.
744
-
745
- The optional `constructorOpt` argument accepts a function. If given, all frames
746
- above `constructorOpt`, including `constructorOpt`, will be omitted from the
747
- generated stack trace.
748
-
749
- The `constructorOpt` argument is useful for hiding implementation
750
- details of error generation from the user. For instance:
751
-
752
- ```js
753
- function a() {
754
- b();
755
- }
756
-
757
- function b() {
758
- c();
759
- }
760
-
761
- function c() {
762
- // Create an error without stack trace to avoid calculating the stack trace twice.
763
- const { stackTraceLimit } = Error;
764
- Error.stackTraceLimit = 0;
765
- const error = new Error();
766
- Error.stackTraceLimit = stackTraceLimit;
767
-
768
- // Capture the stack trace above function b
769
- Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
770
- throw error;
771
- }
772
-
773
- a();
774
- ```
775
-
776
- ###### Parameters
777
-
778
- | Parameter | Type |
779
- | ------ | ------ |
780
- | `targetObject` | `object` |
781
- | `constructorOpt?` | `Function` |
782
-
783
- ###### Returns
784
-
785
- `void`
786
-
787
- ###### Inherited from
788
-
789
- ```ts
790
- Error.captureStackTrace
791
- ```
792
-
793
- ##### prepareStackTrace()
794
-
795
- ###### Call Signature
796
-
797
- ```ts
798
- static prepareStackTrace(err, stackTraces): any;
799
- ```
800
-
801
- Defined in: node\_modules/.pnpm/@types+node@25.6.0/node\_modules/@types/node/globals.d.ts:55
802
-
803
- ###### Parameters
804
-
805
- | Parameter | Type |
806
- | ------ | ------ |
807
- | `err` | `Error` |
808
- | `stackTraces` | `CallSite`[] |
809
-
810
- ###### Returns
811
-
812
- `any`
813
-
814
- ###### See
815
-
816
- https://v8.dev/docs/stack-trace-api#customizing-stack-traces
817
-
818
- ###### Inherited from
819
-
820
- ```ts
821
- Error.prepareStackTrace
822
- ```
823
-
824
- ###### Call Signature
825
-
826
- ```ts
827
- static prepareStackTrace(err, stackTraces): any;
828
- ```
829
-
830
- Defined in: node\_modules/.pnpm/@types+node@24.12.2/node\_modules/@types/node/globals.d.ts:56
831
-
832
- ###### Parameters
833
-
834
- | Parameter | Type |
835
- | ------ | ------ |
836
- | `err` | `Error` |
837
- | `stackTraces` | `CallSite`[] |
838
-
839
- ###### Returns
840
-
841
- `any`
842
-
843
- ###### See
844
-
845
- https://v8.dev/docs/stack-trace-api#customizing-stack-traces
846
-
847
- ###### Inherited from
848
-
849
- ```ts
850
- Error.prepareStackTrace
851
- ```
484
+ | Property | Modifier | Type | Inherited from | Defined in |
485
+ | ------ | ------ | ------ | ------ | ------ |
486
+ | <a id="_tag-1"></a> `_tag` | `readonly` | `"@amqp-contract/TechnicalError"` | `TaggedError("@amqp-contract/TechnicalError", { name: "TechnicalError", })._tag` | node\_modules/.pnpm/unthrown@0.2.0/node\_modules/unthrown/dist/index.d.mts:638 |
487
+ | <a id="cause-1"></a> `cause?` | `public` | `unknown` | [`MessageValidationError`](#messagevalidationerror).[`cause`](#cause) | node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:24 |
488
+ | <a id="message-1"></a> `message` | `public` | `string` | `TaggedError("@amqp-contract/TechnicalError", { name: "TechnicalError", }).message` | node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es5.d.ts:1075 |
489
+ | <a id="name-1"></a> `name` | `public` | `string` | `TaggedError("@amqp-contract/TechnicalError", { name: "TechnicalError", }).name` | node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es5.d.ts:1074 |
490
+ | <a id="stack-1"></a> `stack?` | `public` | `string` | `TaggedError("@amqp-contract/TechnicalError", { name: "TechnicalError", }).stack` | node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 |
852
491
 
853
492
  ## Type Aliases
854
493
 
@@ -858,7 +497,7 @@ Error.prepareStackTrace
858
497
  type AmqpClientOptions = object;
859
498
  ```
860
499
 
861
- Defined in: [packages/core/src/amqp-client.ts:73](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/amqp-client.ts#L73)
500
+ Defined in: [packages/core/src/amqp-client.ts:73](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/amqp-client.ts#L73)
862
501
 
863
502
  Options for creating an AMQP client.
864
503
 
@@ -866,10 +505,10 @@ Options for creating an AMQP client.
866
505
 
867
506
  | Property | Type | Description | Defined in |
868
507
  | ------ | ------ | ------ | ------ |
869
- | <a id="channeloptions"></a> `channelOptions?` | `Partial`&lt;`CreateChannelOpts`&gt; | Optional channel configuration options. | [packages/core/src/amqp-client.ts:76](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/amqp-client.ts#L76) |
870
- | <a id="connectionoptions"></a> `connectionOptions?` | `AmqpConnectionManagerOptions` | Optional connection configuration (heartbeat, reconnect settings, etc.). | [packages/core/src/amqp-client.ts:75](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/amqp-client.ts#L75) |
871
- | <a id="connecttimeoutms"></a> `connectTimeoutMs?` | `number` \| `null` | Maximum time in ms to wait for the channel to become ready in `waitForConnect`. Defaults to [DEFAULT\_CONNECT\_TIMEOUT\_MS](#default_connect_timeout_ms). Pass `null` to disable the timeout entirely (amqp-connection-manager will retry indefinitely). | [packages/core/src/amqp-client.ts:77](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/amqp-client.ts#L77) |
872
- | <a id="urls"></a> `urls` | `ConnectionUrl`[] | AMQP broker URL(s). Multiple URLs provide failover support. | [packages/core/src/amqp-client.ts:74](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/amqp-client.ts#L74) |
508
+ | <a id="channeloptions"></a> `channelOptions?` | `Partial`&lt;`CreateChannelOpts`&gt; | Optional channel configuration options. | [packages/core/src/amqp-client.ts:76](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/amqp-client.ts#L76) |
509
+ | <a id="connectionoptions"></a> `connectionOptions?` | `AmqpConnectionManagerOptions` | Optional connection configuration (heartbeat, reconnect settings, etc.). | [packages/core/src/amqp-client.ts:75](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/amqp-client.ts#L75) |
510
+ | <a id="connecttimeoutms"></a> `connectTimeoutMs?` | `number` \| `null` | Maximum time in ms to wait for the channel to become ready in `waitForConnect`. Defaults to [DEFAULT\_CONNECT\_TIMEOUT\_MS](#default_connect_timeout_ms). Pass `null` to disable the timeout entirely (amqp-connection-manager will retry indefinitely). | [packages/core/src/amqp-client.ts:77](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/amqp-client.ts#L77) |
511
+ | <a id="urls"></a> `urls` | `ConnectionUrl`[] | AMQP broker URL(s). Multiple URLs provide failover support. | [packages/core/src/amqp-client.ts:74](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/amqp-client.ts#L74) |
873
512
 
874
513
  ***
875
514
 
@@ -879,7 +518,7 @@ Options for creating an AMQP client.
879
518
  type ConsumeCallback = (msg) => void | Promise<void>;
880
519
  ```
881
520
 
882
- Defined in: [packages/core/src/amqp-client.ts:83](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/amqp-client.ts#L83)
521
+ Defined in: [packages/core/src/amqp-client.ts:83](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/amqp-client.ts#L83)
883
522
 
884
523
  Callback type for consuming messages.
885
524
 
@@ -901,15 +540,23 @@ Callback type for consuming messages.
901
540
  type ConsumerOptions = Options.Consume & object;
902
541
  ```
903
542
 
904
- Defined in: [packages/core/src/amqp-client.ts:96](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/amqp-client.ts#L96)
543
+ Defined in: [packages/core/src/amqp-client.ts:108](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/amqp-client.ts#L108)
544
+
545
+ Consume options that extend amqplib's `Options.Consume` with an optional
546
+ per-consumer prefetch count.
905
547
 
906
- Consume options that extend amqplib's Options.Consume with optional prefetch support.
548
+ `prefetch` is intercepted by [AmqpClient.consume](#consume): it is stripped from
549
+ the options handed to the underlying `channelWrapper.consume(...)` call
550
+ (since amqplib's `Options.Consume` does not include it) and applied via
551
+ `channel.prefetch(count, false)` registered through `addSetup` *before* the
552
+ consume so the value is in effect when the consumer starts and is reapplied
553
+ automatically on channel reconnect.
907
554
 
908
555
  #### Type Declaration
909
556
 
910
557
  | Name | Type | Description | Defined in |
911
558
  | ------ | ------ | ------ | ------ |
912
- | `prefetch?` | `number` | Number of messages to prefetch | [packages/core/src/amqp-client.ts:98](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/amqp-client.ts#L98) |
559
+ | `prefetch?` | `number` | Per-consumer prefetch count. Applied before `channel.consume(...)`. | [packages/core/src/amqp-client.ts:110](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/amqp-client.ts#L110) |
913
560
 
914
561
  ***
915
562
 
@@ -919,7 +566,7 @@ Consume options that extend amqplib's Options.Consume with optional prefetch sup
919
566
  type Logger = object;
920
567
  ```
921
568
 
922
- Defined in: [packages/core/src/logger.ts:30](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/logger.ts#L30)
569
+ Defined in: [packages/core/src/logger.ts:30](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/logger.ts#L30)
923
570
 
924
571
  Logger interface for amqp-contract packages.
925
572
 
@@ -946,7 +593,7 @@ const logger: Logger = {
946
593
  debug(message, context?): void;
947
594
  ```
948
595
 
949
- Defined in: [packages/core/src/logger.ts:36](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/logger.ts#L36)
596
+ Defined in: [packages/core/src/logger.ts:36](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/logger.ts#L36)
950
597
 
951
598
  Log debug level messages
952
599
 
@@ -967,7 +614,7 @@ Log debug level messages
967
614
  error(message, context?): void;
968
615
  ```
969
616
 
970
- Defined in: [packages/core/src/logger.ts:57](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/logger.ts#L57)
617
+ Defined in: [packages/core/src/logger.ts:57](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/logger.ts#L57)
971
618
 
972
619
  Log error level messages
973
620
 
@@ -988,7 +635,7 @@ Log error level messages
988
635
  info(message, context?): void;
989
636
  ```
990
637
 
991
- Defined in: [packages/core/src/logger.ts:43](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/logger.ts#L43)
638
+ Defined in: [packages/core/src/logger.ts:43](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/logger.ts#L43)
992
639
 
993
640
  Log info level messages
994
641
 
@@ -1009,7 +656,7 @@ Log info level messages
1009
656
  warn(message, context?): void;
1010
657
  ```
1011
658
 
1012
- Defined in: [packages/core/src/logger.ts:50](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/logger.ts#L50)
659
+ Defined in: [packages/core/src/logger.ts:50](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/logger.ts#L50)
1013
660
 
1014
661
  Log warning level messages
1015
662
 
@@ -1032,7 +679,7 @@ Log warning level messages
1032
679
  type LoggerContext = Record<string, unknown> & object;
1033
680
  ```
1034
681
 
1035
- Defined in: [packages/core/src/logger.ts:9](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/logger.ts#L9)
682
+ Defined in: [packages/core/src/logger.ts:9](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/logger.ts#L9)
1036
683
 
1037
684
  Context object for logger methods.
1038
685
 
@@ -1043,25 +690,26 @@ for common logging context properties.
1043
690
 
1044
691
  | Name | Type | Defined in |
1045
692
  | ------ | ------ | ------ |
1046
- | `error?` | `unknown` | [packages/core/src/logger.ts:10](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/logger.ts#L10) |
693
+ | `error?` | `unknown` | [packages/core/src/logger.ts:10](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/logger.ts#L10) |
1047
694
 
1048
695
  ***
1049
696
 
1050
697
  ### PublishOptions
1051
698
 
1052
699
  ```ts
1053
- type PublishOptions = Options.Publish & object;
700
+ type PublishOptions = Options.Publish;
1054
701
  ```
1055
702
 
1056
- Defined in: [packages/core/src/amqp-client.ts:88](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/amqp-client.ts#L88)
703
+ Defined in: [packages/core/src/amqp-client.ts:95](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/amqp-client.ts#L95)
1057
704
 
1058
- Publish options that extend amqplib's Options.Publish with optional timeout support.
705
+ Publish options for `AmqpClient.publish` / `AmqpClient.sendToQueue`.
1059
706
 
1060
- #### Type Declaration
1061
-
1062
- | Name | Type | Description | Defined in |
1063
- | ------ | ------ | ------ | ------ |
1064
- | `timeout?` | `number` | Message will be rejected after timeout ms | [packages/core/src/amqp-client.ts:90](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/amqp-client.ts#L90) |
707
+ Currently a re-export of amqplib's `Options.Publish`. A previous version of
708
+ this type also exposed a `timeout` field, but that field never had a
709
+ meaningful AMQP-level effect in this codebase and has been removed to avoid
710
+ suggesting behaviour we do not provide. (`amqp-connection-manager`'s own
711
+ `publishTimeout` channel option is unrelated and is configured at channel
712
+ creation, not per-publish.)
1065
713
 
1066
714
  ***
1067
715
 
@@ -1071,7 +719,7 @@ Publish options that extend amqplib's Options.Publish with optional timeout supp
1071
719
  type TelemetryProvider = object;
1072
720
  ```
1073
721
 
1074
- Defined in: [packages/core/src/telemetry.ts:54](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L54)
722
+ Defined in: [packages/core/src/telemetry.ts:54](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L54)
1075
723
 
1076
724
  Telemetry provider for AMQP operations.
1077
725
  Uses lazy loading to gracefully handle cases where OpenTelemetry is not installed.
@@ -1080,12 +728,12 @@ Uses lazy loading to gracefully handle cases where OpenTelemetry is not installe
1080
728
 
1081
729
  | Property | Type | Description | Defined in |
1082
730
  | ------ | ------ | ------ | ------ |
1083
- | <a id="getconsumecounter"></a> `getConsumeCounter` | () => `Counter` \| `undefined` | Get a counter for messages consumed. Returns undefined if OpenTelemetry is not available. | [packages/core/src/telemetry.ts:71](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L71) |
1084
- | <a id="getconsumelatencyhistogram"></a> `getConsumeLatencyHistogram` | () => `Histogram` \| `undefined` | Get a histogram for consume/process latency. Returns undefined if OpenTelemetry is not available. | [packages/core/src/telemetry.ts:83](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L83) |
1085
- | <a id="getlaterpcreplycounter"></a> `getLateRpcReplyCounter` | () => `Counter` \| `undefined` | Get a counter for RPC replies that arrive after the caller has gone away (timeout, cancellation, or unknown correlationId). Returns undefined if OpenTelemetry is not available. | [packages/core/src/telemetry.ts:90](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L90) |
1086
- | <a id="getpublishcounter"></a> `getPublishCounter` | () => `Counter` \| `undefined` | Get a counter for messages published. Returns undefined if OpenTelemetry is not available. | [packages/core/src/telemetry.ts:65](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L65) |
1087
- | <a id="getpublishlatencyhistogram"></a> `getPublishLatencyHistogram` | () => `Histogram` \| `undefined` | Get a histogram for publish latency. Returns undefined if OpenTelemetry is not available. | [packages/core/src/telemetry.ts:77](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L77) |
1088
- | <a id="gettracer"></a> `getTracer` | () => `Tracer` \| `undefined` | Get a tracer instance for creating spans. Returns undefined if OpenTelemetry is not available. | [packages/core/src/telemetry.ts:59](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L59) |
731
+ | <a id="getconsumecounter"></a> `getConsumeCounter` | () => `Counter` \| `undefined` | Get a counter for messages consumed. Returns undefined if OpenTelemetry is not available. | [packages/core/src/telemetry.ts:71](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L71) |
732
+ | <a id="getconsumelatencyhistogram"></a> `getConsumeLatencyHistogram` | () => `Histogram` \| `undefined` | Get a histogram for consume/process latency. Returns undefined if OpenTelemetry is not available. | [packages/core/src/telemetry.ts:83](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L83) |
733
+ | <a id="getlaterpcreplycounter"></a> `getLateRpcReplyCounter` | () => `Counter` \| `undefined` | Get a counter for RPC replies that arrive after the caller has gone away (timeout, cancellation, or unknown correlationId). Returns undefined if OpenTelemetry is not available. | [packages/core/src/telemetry.ts:90](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L90) |
734
+ | <a id="getpublishcounter"></a> `getPublishCounter` | () => `Counter` \| `undefined` | Get a counter for messages published. Returns undefined if OpenTelemetry is not available. | [packages/core/src/telemetry.ts:65](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L65) |
735
+ | <a id="getpublishlatencyhistogram"></a> `getPublishLatencyHistogram` | () => `Histogram` \| `undefined` | Get a histogram for publish latency. Returns undefined if OpenTelemetry is not available. | [packages/core/src/telemetry.ts:77](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L77) |
736
+ | <a id="gettracer"></a> `getTracer` | () => `Tracer` \| `undefined` | Get a tracer instance for creating spans. Returns undefined if OpenTelemetry is not available. | [packages/core/src/telemetry.ts:59](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L59) |
1089
737
 
1090
738
  ## Variables
1091
739
 
@@ -1095,7 +743,7 @@ Uses lazy loading to gracefully handle cases where OpenTelemetry is not installe
1095
743
  const DEFAULT_CONNECT_TIMEOUT_MS: 30000 = 30_000;
1096
744
  ```
1097
745
 
1098
- Defined in: [packages/core/src/amqp-client.ts:47](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/amqp-client.ts#L47)
746
+ Defined in: [packages/core/src/amqp-client.ts:47](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/amqp-client.ts#L47)
1099
747
 
1100
748
  Default time `waitForConnect` will wait for the broker before erroring out.
1101
749
  Defaulting to a finite value (rather than waiting forever) means a fail-fast
@@ -1113,7 +761,7 @@ delays to ~24.8 days and silently fires near-immediately on `Infinity`.
1113
761
  const defaultTelemetryProvider: TelemetryProvider;
1114
762
  ```
1115
763
 
1116
- Defined in: [packages/core/src/telemetry.ts:229](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L229)
764
+ Defined in: [packages/core/src/telemetry.ts:229](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L229)
1117
765
 
1118
766
  Default telemetry provider that uses OpenTelemetry API if available.
1119
767
 
@@ -1125,7 +773,7 @@ Default telemetry provider that uses OpenTelemetry API if available.
1125
773
  const MessagingSemanticConventions: object;
1126
774
  ```
1127
775
 
1128
- Defined in: [packages/core/src/telemetry.ts:26](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L26)
776
+ Defined in: [packages/core/src/telemetry.ts:26](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L26)
1129
777
 
1130
778
  Semantic conventions for AMQP messaging following OpenTelemetry standards.
1131
779
 
@@ -1133,20 +781,20 @@ Semantic conventions for AMQP messaging following OpenTelemetry standards.
1133
781
 
1134
782
  | Name | Type | Default value | Defined in |
1135
783
  | ------ | ------ | ------ | ------ |
1136
- | <a id="property-amqp_consumer_name"></a> `AMQP_CONSUMER_NAME` | `"amqp.consumer.name"` | `"amqp.consumer.name"` | [packages/core/src/telemetry.ts:37](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L37) |
1137
- | <a id="property-amqp_publisher_name"></a> `AMQP_PUBLISHER_NAME` | `"amqp.publisher.name"` | `"amqp.publisher.name"` | [packages/core/src/telemetry.ts:36](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L36) |
1138
- | <a id="property-error_type"></a> `ERROR_TYPE` | `"error.type"` | `"error.type"` | [packages/core/src/telemetry.ts:40](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L40) |
1139
- | <a id="property-messaging_destination"></a> `MESSAGING_DESTINATION` | `"messaging.destination.name"` | `"messaging.destination.name"` | [packages/core/src/telemetry.ts:29](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L29) |
1140
- | <a id="property-messaging_destination_kind"></a> `MESSAGING_DESTINATION_KIND` | `"messaging.destination.kind"` | `"messaging.destination.kind"` | [packages/core/src/telemetry.ts:30](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L30) |
1141
- | <a id="property-messaging_destination_kind_exchange"></a> `MESSAGING_DESTINATION_KIND_EXCHANGE` | `"exchange"` | `"exchange"` | [packages/core/src/telemetry.ts:44](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L44) |
1142
- | <a id="property-messaging_destination_kind_queue"></a> `MESSAGING_DESTINATION_KIND_QUEUE` | `"queue"` | `"queue"` | [packages/core/src/telemetry.ts:45](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L45) |
1143
- | <a id="property-messaging_operation"></a> `MESSAGING_OPERATION` | `"messaging.operation"` | `"messaging.operation"` | [packages/core/src/telemetry.ts:31](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L31) |
1144
- | <a id="property-messaging_operation_process"></a> `MESSAGING_OPERATION_PROCESS` | `"process"` | `"process"` | [packages/core/src/telemetry.ts:47](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L47) |
1145
- | <a id="property-messaging_operation_publish"></a> `MESSAGING_OPERATION_PUBLISH` | `"publish"` | `"publish"` | [packages/core/src/telemetry.ts:46](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L46) |
1146
- | <a id="property-messaging_rabbitmq_message_delivery_tag"></a> `MESSAGING_RABBITMQ_MESSAGE_DELIVERY_TAG` | `"messaging.rabbitmq.message.delivery_tag"` | `"messaging.rabbitmq.message.delivery_tag"` | [packages/core/src/telemetry.ts:35](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L35) |
1147
- | <a id="property-messaging_rabbitmq_routing_key"></a> `MESSAGING_RABBITMQ_ROUTING_KEY` | `"messaging.rabbitmq.destination.routing_key"` | `"messaging.rabbitmq.destination.routing_key"` | [packages/core/src/telemetry.ts:34](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L34) |
1148
- | <a id="property-messaging_system"></a> `MESSAGING_SYSTEM` | `"messaging.system"` | `"messaging.system"` | [packages/core/src/telemetry.ts:28](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L28) |
1149
- | <a id="property-messaging_system_rabbitmq"></a> `MESSAGING_SYSTEM_RABBITMQ` | `"rabbitmq"` | `"rabbitmq"` | [packages/core/src/telemetry.ts:43](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L43) |
784
+ | <a id="property-amqp_consumer_name"></a> `AMQP_CONSUMER_NAME` | `"amqp.consumer.name"` | `"amqp.consumer.name"` | [packages/core/src/telemetry.ts:37](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L37) |
785
+ | <a id="property-amqp_publisher_name"></a> `AMQP_PUBLISHER_NAME` | `"amqp.publisher.name"` | `"amqp.publisher.name"` | [packages/core/src/telemetry.ts:36](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L36) |
786
+ | <a id="property-error_type"></a> `ERROR_TYPE` | `"error.type"` | `"error.type"` | [packages/core/src/telemetry.ts:40](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L40) |
787
+ | <a id="property-messaging_destination"></a> `MESSAGING_DESTINATION` | `"messaging.destination.name"` | `"messaging.destination.name"` | [packages/core/src/telemetry.ts:29](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L29) |
788
+ | <a id="property-messaging_destination_kind"></a> `MESSAGING_DESTINATION_KIND` | `"messaging.destination.kind"` | `"messaging.destination.kind"` | [packages/core/src/telemetry.ts:30](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L30) |
789
+ | <a id="property-messaging_destination_kind_exchange"></a> `MESSAGING_DESTINATION_KIND_EXCHANGE` | `"exchange"` | `"exchange"` | [packages/core/src/telemetry.ts:44](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L44) |
790
+ | <a id="property-messaging_destination_kind_queue"></a> `MESSAGING_DESTINATION_KIND_QUEUE` | `"queue"` | `"queue"` | [packages/core/src/telemetry.ts:45](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L45) |
791
+ | <a id="property-messaging_operation"></a> `MESSAGING_OPERATION` | `"messaging.operation"` | `"messaging.operation"` | [packages/core/src/telemetry.ts:31](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L31) |
792
+ | <a id="property-messaging_operation_process"></a> `MESSAGING_OPERATION_PROCESS` | `"process"` | `"process"` | [packages/core/src/telemetry.ts:47](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L47) |
793
+ | <a id="property-messaging_operation_publish"></a> `MESSAGING_OPERATION_PUBLISH` | `"publish"` | `"publish"` | [packages/core/src/telemetry.ts:46](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L46) |
794
+ | <a id="property-messaging_rabbitmq_message_delivery_tag"></a> `MESSAGING_RABBITMQ_MESSAGE_DELIVERY_TAG` | `"messaging.rabbitmq.message.delivery_tag"` | `"messaging.rabbitmq.message.delivery_tag"` | [packages/core/src/telemetry.ts:35](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L35) |
795
+ | <a id="property-messaging_rabbitmq_routing_key"></a> `MESSAGING_RABBITMQ_ROUTING_KEY` | `"messaging.rabbitmq.destination.routing_key"` | `"messaging.rabbitmq.destination.routing_key"` | [packages/core/src/telemetry.ts:34](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L34) |
796
+ | <a id="property-messaging_system"></a> `MESSAGING_SYSTEM` | `"messaging.system"` | `"messaging.system"` | [packages/core/src/telemetry.ts:28](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L28) |
797
+ | <a id="property-messaging_system_rabbitmq"></a> `MESSAGING_SYSTEM_RABBITMQ` | `"rabbitmq"` | `"rabbitmq"` | [packages/core/src/telemetry.ts:43](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L43) |
1150
798
 
1151
799
  #### See
1152
800
 
@@ -1160,7 +808,7 @@ https://opentelemetry.io/docs/specs/semconv/messaging/messaging-spans/
1160
808
  function endSpanError(span, error): void;
1161
809
  ```
1162
810
 
1163
- Defined in: [packages/core/src/telemetry.ts:324](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L324)
811
+ Defined in: [packages/core/src/telemetry.ts:324](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L324)
1164
812
 
1165
813
  End a span with error status.
1166
814
 
@@ -1183,7 +831,7 @@ End a span with error status.
1183
831
  function endSpanSuccess(span): void;
1184
832
  ```
1185
833
 
1186
- Defined in: [packages/core/src/telemetry.ts:309](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L309)
834
+ Defined in: [packages/core/src/telemetry.ts:309](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L309)
1187
835
 
1188
836
  End a span with success status.
1189
837
 
@@ -1210,7 +858,7 @@ function recordConsumeMetric(
1210
858
  durationMs): void;
1211
859
  ```
1212
860
 
1213
- Defined in: [packages/core/src/telemetry.ts:368](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L368)
861
+ Defined in: [packages/core/src/telemetry.ts:368](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L368)
1214
862
 
1215
863
  Record a consume metric.
1216
864
 
@@ -1236,7 +884,7 @@ Record a consume metric.
1236
884
  function recordLateRpcReply(provider, reason): void;
1237
885
  ```
1238
886
 
1239
- Defined in: [packages/core/src/telemetry.ts:398](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L398)
887
+ Defined in: [packages/core/src/telemetry.ts:398](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L398)
1240
888
 
1241
889
  Record an RPC reply that arrived after the caller stopped waiting.
1242
890
 
@@ -1264,7 +912,7 @@ function recordPublishMetric(
1264
912
  durationMs): void;
1265
913
  ```
1266
914
 
1267
- Defined in: [packages/core/src/telemetry.ts:341](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L341)
915
+ Defined in: [packages/core/src/telemetry.ts:341](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L341)
1268
916
 
1269
917
  Record a publish metric.
1270
918
 
@@ -1284,13 +932,58 @@ Record a publish metric.
1284
932
 
1285
933
  ***
1286
934
 
935
+ ### safeJsonParse()
936
+
937
+ ```ts
938
+ function safeJsonParse<E>(buffer, errorFn): Result<unknown, E>;
939
+ ```
940
+
941
+ Defined in: [packages/core/src/parsing.ts:24](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/parsing.ts#L24)
942
+
943
+ Parse a `Buffer` as JSON, mapping any `JSON.parse` exception to the
944
+ caller-supplied error type.
945
+
946
+ Use this in consume / reply paths where a parse failure is a typed value,
947
+ not a thrown exception — the caller decides how to translate the raw error
948
+ into a domain-level error (e.g. [TechnicalError](#technicalerror)).
949
+
950
+ #### Type Parameters
951
+
952
+ | Type Parameter | Description |
953
+ | ------ | ------ |
954
+ | `E` | The error type produced by `errorFn`. |
955
+
956
+ #### Parameters
957
+
958
+ | Parameter | Type | Description |
959
+ | ------ | ------ | ------ |
960
+ | `buffer` | `Buffer` | The raw message body to parse. |
961
+ | `errorFn` | (`raw`) => `E` | Callback invoked with the underlying `JSON.parse` error. |
962
+
963
+ #### Returns
964
+
965
+ `Result`&lt;`unknown`, `E`&gt;
966
+
967
+ A `Result` containing the parsed `unknown` value or the mapped error.
968
+
969
+ #### Example
970
+
971
+ ```typescript
972
+ const parsed = safeJsonParse(
973
+ msg.content,
974
+ (error) => new TechnicalError("Failed to parse JSON", error),
975
+ );
976
+ ```
977
+
978
+ ***
979
+
1287
980
  ### setupAmqpTopology()
1288
981
 
1289
982
  ```ts
1290
983
  function setupAmqpTopology(channel, contract): Promise<void>;
1291
984
  ```
1292
985
 
1293
- Defined in: [packages/core/src/setup.ts:26](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/setup.ts#L26)
986
+ Defined in: [packages/core/src/setup.ts:26](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/setup.ts#L26)
1294
987
 
1295
988
  Setup AMQP topology (exchanges, queues, and bindings) from a contract definition.
1296
989
 
@@ -1338,7 +1031,7 @@ function startConsumeSpan(
1338
1031
  attributes?): Span | undefined;
1339
1032
  ```
1340
1033
 
1341
- Defined in: [packages/core/src/telemetry.ts:277](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L277)
1034
+ Defined in: [packages/core/src/telemetry.ts:277](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L277)
1342
1035
 
1343
1036
  Create a span for a consume/process operation.
1344
1037
  Returns undefined if OpenTelemetry is not available.
@@ -1368,7 +1061,7 @@ function startPublishSpan(
1368
1061
  attributes?): Span | undefined;
1369
1062
  ```
1370
1063
 
1371
- Defined in: [packages/core/src/telemetry.ts:242](https://github.com/btravers/amqp-contract/blob/1ba3d51bb1d4a09c356afad101dc9e6e6d605185/packages/core/src/telemetry.ts#L242)
1064
+ Defined in: [packages/core/src/telemetry.ts:242](https://github.com/btravstack/amqp-contract/blob/5bdec81d9ab13131c5b7f699c426616cfbed2b5f/packages/core/src/telemetry.ts#L242)
1372
1065
 
1373
1066
  Create a span for a publish operation.
1374
1067
  Returns undefined if OpenTelemetry is not available.