@amqp-contract/client 0.23.1 → 0.25.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 +16 -14
- package/dist/index.cjs +66 -81
- package/dist/index.d.cts +12 -28
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +12 -28
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +67 -82
- package/dist/index.mjs.map +1 -1
- package/docs/index.md +60 -60
- package/package.json +5 -5
package/docs/index.md
CHANGED
|
@@ -170,11 +170,11 @@ Error.prepareStackTrace
|
|
|
170
170
|
|
|
171
171
|
### RpcCancelledError
|
|
172
172
|
|
|
173
|
-
Defined in: [packages/client/src/errors.ts:39](https://github.com/btravers/amqp-contract/blob/
|
|
173
|
+
Defined in: [packages/client/src/errors.ts:39](https://github.com/btravers/amqp-contract/blob/a478140dbe88d884a96d8fcfb20743271fd43c3f/packages/client/src/errors.ts#L39)
|
|
174
174
|
|
|
175
175
|
Returned from any in-flight RPC call when the client is closed before the
|
|
176
176
|
reply is received. The correlation map is cleared on close and every pending
|
|
177
|
-
caller's promise resolves with `
|
|
177
|
+
caller's promise resolves with `err(RpcCancelledError)`.
|
|
178
178
|
|
|
179
179
|
#### Extends
|
|
180
180
|
|
|
@@ -188,7 +188,7 @@ caller's promise resolves with `Result.Error(RpcCancelledError)`.
|
|
|
188
188
|
new RpcCancelledError(rpcName): RpcCancelledError;
|
|
189
189
|
```
|
|
190
190
|
|
|
191
|
-
Defined in: [packages/client/src/errors.ts:40](https://github.com/btravers/amqp-contract/blob/
|
|
191
|
+
Defined in: [packages/client/src/errors.ts:40](https://github.com/btravers/amqp-contract/blob/a478140dbe88d884a96d8fcfb20743271fd43c3f/packages/client/src/errors.ts#L40)
|
|
192
192
|
|
|
193
193
|
###### Parameters
|
|
194
194
|
|
|
@@ -213,7 +213,7 @@ Error.constructor
|
|
|
213
213
|
| <a id="cause-1"></a> `cause?` | `public` | `unknown` | - | `Error.cause` | node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:24 |
|
|
214
214
|
| <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 |
|
|
215
215
|
| <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 |
|
|
216
|
-
| <a id="rpcname"></a> `rpcName` | `readonly` | `string` | - | - | [packages/client/src/errors.ts:40](https://github.com/btravers/amqp-contract/blob/
|
|
216
|
+
| <a id="rpcname"></a> `rpcName` | `readonly` | `string` | - | - | [packages/client/src/errors.ts:40](https://github.com/btravers/amqp-contract/blob/a478140dbe88d884a96d8fcfb20743271fd43c3f/packages/client/src/errors.ts#L40) |
|
|
217
217
|
| <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 |
|
|
218
218
|
| <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@24.12.2/node\_modules/@types/node/globals.d.ts:68 |
|
|
219
219
|
|
|
@@ -321,7 +321,7 @@ Error.prepareStackTrace
|
|
|
321
321
|
|
|
322
322
|
### RpcTimeoutError
|
|
323
323
|
|
|
324
|
-
Defined in: [packages/client/src/errors.ts:23](https://github.com/btravers/amqp-contract/blob/
|
|
324
|
+
Defined in: [packages/client/src/errors.ts:23](https://github.com/btravers/amqp-contract/blob/a478140dbe88d884a96d8fcfb20743271fd43c3f/packages/client/src/errors.ts#L23)
|
|
325
325
|
|
|
326
326
|
Returned from `TypedAmqpClient.call()` when the configured `timeoutMs` elapses
|
|
327
327
|
before the RPC server publishes a reply with the matching `correlationId`.
|
|
@@ -342,7 +342,7 @@ client if a logger is configured).
|
|
|
342
342
|
new RpcTimeoutError(rpcName, timeoutMs): RpcTimeoutError;
|
|
343
343
|
```
|
|
344
344
|
|
|
345
|
-
Defined in: [packages/client/src/errors.ts:24](https://github.com/btravers/amqp-contract/blob/
|
|
345
|
+
Defined in: [packages/client/src/errors.ts:24](https://github.com/btravers/amqp-contract/blob/a478140dbe88d884a96d8fcfb20743271fd43c3f/packages/client/src/errors.ts#L24)
|
|
346
346
|
|
|
347
347
|
###### Parameters
|
|
348
348
|
|
|
@@ -368,9 +368,9 @@ Error.constructor
|
|
|
368
368
|
| <a id="cause-2"></a> `cause?` | `public` | `unknown` | - | `Error.cause` | node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:24 |
|
|
369
369
|
| <a id="message-2"></a> `message` | `public` | `string` | - | `Error.message` | node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es5.d.ts:1075 |
|
|
370
370
|
| <a id="name-2"></a> `name` | `public` | `string` | - | `Error.name` | node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es5.d.ts:1074 |
|
|
371
|
-
| <a id="rpcname-1"></a> `rpcName` | `readonly` | `string` | - | - | [packages/client/src/errors.ts:25](https://github.com/btravers/amqp-contract/blob/
|
|
371
|
+
| <a id="rpcname-1"></a> `rpcName` | `readonly` | `string` | - | - | [packages/client/src/errors.ts:25](https://github.com/btravers/amqp-contract/blob/a478140dbe88d884a96d8fcfb20743271fd43c3f/packages/client/src/errors.ts#L25) |
|
|
372
372
|
| <a id="stack-2"></a> `stack?` | `public` | `string` | - | `Error.stack` | node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 |
|
|
373
|
-
| <a id="timeoutms"></a> `timeoutMs` | `readonly` | `number` | - | - | [packages/client/src/errors.ts:26](https://github.com/btravers/amqp-contract/blob/
|
|
373
|
+
| <a id="timeoutms"></a> `timeoutMs` | `readonly` | `number` | - | - | [packages/client/src/errors.ts:26](https://github.com/btravers/amqp-contract/blob/a478140dbe88d884a96d8fcfb20743271fd43c3f/packages/client/src/errors.ts#L26) |
|
|
374
374
|
| <a id="stacktracelimit-2"></a> `stackTraceLimit` | `static` | `number` | The `Error.stackTraceLimit` property specifies the number of stack frames collected by a stack trace (whether generated by `new Error().stack` or `Error.captureStackTrace(obj)`). The default value is `10` but may be set to any valid JavaScript number. Changes will affect any stack trace captured _after_ the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. | `Error.stackTraceLimit` | node\_modules/.pnpm/@types+node@24.12.2/node\_modules/@types/node/globals.d.ts:68 |
|
|
375
375
|
|
|
376
376
|
#### Methods
|
|
@@ -477,7 +477,7 @@ Error.prepareStackTrace
|
|
|
477
477
|
|
|
478
478
|
### TypedAmqpClient
|
|
479
479
|
|
|
480
|
-
Defined in: [packages/client/src/client.ts:
|
|
480
|
+
Defined in: [packages/client/src/client.ts:125](https://github.com/btravers/amqp-contract/blob/a478140dbe88d884a96d8fcfb20743271fd43c3f/packages/client/src/client.ts#L125)
|
|
481
481
|
|
|
482
482
|
Type-safe AMQP client for publishing messages
|
|
483
483
|
|
|
@@ -495,72 +495,67 @@ Type-safe AMQP client for publishing messages
|
|
|
495
495
|
call<TName>(
|
|
496
496
|
rpcName,
|
|
497
497
|
request,
|
|
498
|
-
options):
|
|
498
|
+
options): ResultAsync<ClientInferRpcResponseOutput<TContract, TName>,
|
|
499
499
|
| TechnicalError
|
|
500
500
|
| MessageValidationError
|
|
501
501
|
| RpcTimeoutError
|
|
502
|
-
| RpcCancelledError
|
|
502
|
+
| RpcCancelledError>;
|
|
503
503
|
```
|
|
504
504
|
|
|
505
|
-
Defined in: [packages/client/src/client.ts:
|
|
505
|
+
Defined in: [packages/client/src/client.ts:406](https://github.com/btravers/amqp-contract/blob/a478140dbe88d884a96d8fcfb20743271fd43c3f/packages/client/src/client.ts#L406)
|
|
506
506
|
|
|
507
507
|
Invoke an RPC defined via `defineRpc` and await the typed response.
|
|
508
508
|
|
|
509
509
|
The request payload is validated against the RPC's request schema, then
|
|
510
510
|
published to the AMQP default exchange with the server's queue name as
|
|
511
511
|
routing key, `replyTo` set to `amq.rabbitmq.reply-to`, and a fresh UUID
|
|
512
|
-
`correlationId`. The returned
|
|
512
|
+
`correlationId`. The returned ResultAsync resolves once a matching reply
|
|
513
513
|
arrives and validates against the response schema, or once `timeoutMs`
|
|
514
514
|
elapses (whichever comes first).
|
|
515
515
|
|
|
516
516
|
###### Type Parameters
|
|
517
517
|
|
|
518
|
-
| Type Parameter |
|
|
519
|
-
| ------ |
|
|
520
|
-
| `TName` *extends* `string` \| `number` \| `symbol` |
|
|
518
|
+
| Type Parameter |
|
|
519
|
+
| ------ |
|
|
520
|
+
| `TName` *extends* `string` \| `number` \| `symbol` |
|
|
521
521
|
|
|
522
522
|
###### Parameters
|
|
523
523
|
|
|
524
|
-
| Parameter | Type |
|
|
525
|
-
| ------ | ------ |
|
|
526
|
-
| `rpcName` | `TName` |
|
|
527
|
-
| `request` | [`ClientInferRpcRequestInput`](#clientinferrpcrequestinput)<`TContract`, `TName`> |
|
|
528
|
-
| `options` | [`CallOptions`](#calloptions) |
|
|
524
|
+
| Parameter | Type |
|
|
525
|
+
| ------ | ------ |
|
|
526
|
+
| `rpcName` | `TName` |
|
|
527
|
+
| `request` | [`ClientInferRpcRequestInput`](#clientinferrpcrequestinput)<`TContract`, `TName`> |
|
|
528
|
+
| `options` | [`CallOptions`](#calloptions) |
|
|
529
529
|
|
|
530
530
|
###### Returns
|
|
531
531
|
|
|
532
|
-
`
|
|
532
|
+
`ResultAsync`<[`ClientInferRpcResponseOutput`](#clientinferrpcresponseoutput)<`TContract`, `TName`>,
|
|
533
533
|
\| `TechnicalError`
|
|
534
534
|
\| [`MessageValidationError`](#messagevalidationerror)
|
|
535
535
|
\| [`RpcTimeoutError`](#rpctimeouterror)
|
|
536
|
-
\| [`RpcCancelledError`](#rpccancellederror)>
|
|
537
|
-
|
|
538
|
-
`Result.Ok(response)` on a successful round-trip; `Result.Error`
|
|
539
|
-
on validation, transport, timeout, or cancel.
|
|
536
|
+
\| [`RpcCancelledError`](#rpccancellederror)>
|
|
540
537
|
|
|
541
538
|
###### Example
|
|
542
539
|
|
|
543
540
|
```typescript
|
|
544
|
-
const result = await client
|
|
545
|
-
.call('calculate', { a: 1, b: 2 }, { timeoutMs: 5_000 })
|
|
546
|
-
.toPromise();
|
|
541
|
+
const result = await client.call('calculate', { a: 1, b: 2 }, { timeoutMs: 5_000 });
|
|
547
542
|
if (result.isOk()) console.log(result.value.sum); // 3
|
|
548
543
|
```
|
|
549
544
|
|
|
550
545
|
##### close()
|
|
551
546
|
|
|
552
547
|
```ts
|
|
553
|
-
close():
|
|
548
|
+
close(): ResultAsync<void, TechnicalError>;
|
|
554
549
|
```
|
|
555
550
|
|
|
556
|
-
Defined in: [packages/client/src/client.ts:
|
|
551
|
+
Defined in: [packages/client/src/client.ts:556](https://github.com/btravers/amqp-contract/blob/a478140dbe88d884a96d8fcfb20743271fd43c3f/packages/client/src/client.ts#L556)
|
|
557
552
|
|
|
558
553
|
Close the channel and connection. Cancels the reply consumer (if any) and
|
|
559
554
|
rejects every in-flight RPC call with `RpcCancelledError`.
|
|
560
555
|
|
|
561
556
|
###### Returns
|
|
562
557
|
|
|
563
|
-
`
|
|
558
|
+
`ResultAsync`<`void`, `TechnicalError`>
|
|
564
559
|
|
|
565
560
|
##### publish()
|
|
566
561
|
|
|
@@ -568,13 +563,12 @@ rejects every in-flight RPC call with `RpcCancelledError`.
|
|
|
568
563
|
publish<TName>(
|
|
569
564
|
publisherName,
|
|
570
565
|
message,
|
|
571
|
-
options?):
|
|
566
|
+
options?): ResultAsync<void, TechnicalError | MessageValidationError>;
|
|
572
567
|
```
|
|
573
568
|
|
|
574
|
-
Defined in: [packages/client/src/client.ts:
|
|
569
|
+
Defined in: [packages/client/src/client.ts:298](https://github.com/btravers/amqp-contract/blob/a478140dbe88d884a96d8fcfb20743271fd43c3f/packages/client/src/client.ts#L298)
|
|
575
570
|
|
|
576
571
|
Publish a message using a defined publisher.
|
|
577
|
-
TypeScript guarantees publisher exists for valid publisher names.
|
|
578
572
|
|
|
579
573
|
###### Type Parameters
|
|
580
574
|
|
|
@@ -584,23 +578,29 @@ TypeScript guarantees publisher exists for valid publisher names.
|
|
|
584
578
|
|
|
585
579
|
###### Parameters
|
|
586
580
|
|
|
587
|
-
| Parameter | Type |
|
|
588
|
-
| ------ | ------ |
|
|
589
|
-
| `publisherName` | `TName` |
|
|
590
|
-
| `message` | [`ClientInferPublisherInput`](#clientinferpublisherinput)<`TContract`, `TName`> |
|
|
591
|
-
| `options?` | [`PublishOptions`](#publishoptions-1) |
|
|
581
|
+
| Parameter | Type | Description |
|
|
582
|
+
| ------ | ------ | ------ |
|
|
583
|
+
| `publisherName` | `TName` | The name of the publisher to use |
|
|
584
|
+
| `message` | [`ClientInferPublisherInput`](#clientinferpublisherinput)<`TContract`, `TName`> | The message to publish |
|
|
585
|
+
| `options?` | [`PublishOptions`](#publishoptions-1) | Optional publish options including compression, headers, priority, etc. |
|
|
592
586
|
|
|
593
587
|
###### Returns
|
|
594
588
|
|
|
595
|
-
`
|
|
589
|
+
`ResultAsync`<`void`, `TechnicalError` \| [`MessageValidationError`](#messagevalidationerror)>
|
|
590
|
+
|
|
591
|
+
###### Remarks
|
|
592
|
+
|
|
593
|
+
If `options.compression` is specified, the message will be compressed before publishing
|
|
594
|
+
and the `contentEncoding` property will be set automatically. Any `contentEncoding`
|
|
595
|
+
value already in options will be overwritten by the compression algorithm.
|
|
596
596
|
|
|
597
597
|
##### create()
|
|
598
598
|
|
|
599
599
|
```ts
|
|
600
|
-
static create<TContract>(__namedParameters):
|
|
600
|
+
static create<TContract>(__namedParameters): ResultAsync<TypedAmqpClient<TContract>, TechnicalError>;
|
|
601
601
|
```
|
|
602
602
|
|
|
603
|
-
Defined in: [packages/client/src/client.ts:
|
|
603
|
+
Defined in: [packages/client/src/client.ts:156](https://github.com/btravers/amqp-contract/blob/a478140dbe88d884a96d8fcfb20743271fd43c3f/packages/client/src/client.ts#L156)
|
|
604
604
|
|
|
605
605
|
Create a type-safe AMQP client from a contract.
|
|
606
606
|
|
|
@@ -625,7 +625,7 @@ connection options, following RabbitMQ best practices.
|
|
|
625
625
|
|
|
626
626
|
###### Returns
|
|
627
627
|
|
|
628
|
-
`
|
|
628
|
+
`ResultAsync`<[`TypedAmqpClient`](#typedamqpclient)<`TContract`>, `TechnicalError`>
|
|
629
629
|
|
|
630
630
|
## Type Aliases
|
|
631
631
|
|
|
@@ -635,7 +635,7 @@ connection options, following RabbitMQ best practices.
|
|
|
635
635
|
type CallOptions = object;
|
|
636
636
|
```
|
|
637
637
|
|
|
638
|
-
Defined in: [packages/client/src/client.ts:
|
|
638
|
+
Defined in: [packages/client/src/client.ts:105](https://github.com/btravers/amqp-contract/blob/a478140dbe88d884a96d8fcfb20743271fd43c3f/packages/client/src/client.ts#L105)
|
|
639
639
|
|
|
640
640
|
Per-call options for `client.call()`.
|
|
641
641
|
|
|
@@ -643,8 +643,8 @@ Per-call options for `client.call()`.
|
|
|
643
643
|
|
|
644
644
|
| Property | Type | Description | Defined in |
|
|
645
645
|
| ------ | ------ | ------ | ------ |
|
|
646
|
-
| <a id="publishoptions"></a> `publishOptions?` | `Omit`<`AmqpClientPublishOptions`, `"replyTo"` \| `"correlationId"`> | Optional AMQP message properties to merge into the request. `replyTo` and `correlationId` are managed by the client and cannot be overridden. | [packages/client/src/client.ts:
|
|
647
|
-
| <a id="timeoutms-1"></a> `timeoutMs` | `number` | Maximum time in ms to wait for an RPC reply. If exceeded, the call resolves to `
|
|
646
|
+
| <a id="publishoptions"></a> `publishOptions?` | `Omit`<`AmqpClientPublishOptions`, `"replyTo"` \| `"correlationId"`> | Optional AMQP message properties to merge into the request. `replyTo` and `correlationId` are managed by the client and cannot be overridden. | [packages/client/src/client.ts:119](https://github.com/btravers/amqp-contract/blob/a478140dbe88d884a96d8fcfb20743271fd43c3f/packages/client/src/client.ts#L119) |
|
|
647
|
+
| <a id="timeoutms-1"></a> `timeoutMs` | `number` | Maximum time in ms to wait for an RPC reply. If exceeded, the call resolves to `err(RpcTimeoutError)` and the in-memory correlation entry is cleared. A late reply arriving after the timeout is silently dropped. Required: RPC without a timeout is a footgun. | [packages/client/src/client.ts:113](https://github.com/btravers/amqp-contract/blob/a478140dbe88d884a96d8fcfb20743271fd43c3f/packages/client/src/client.ts#L113) |
|
|
648
648
|
|
|
649
649
|
***
|
|
650
650
|
|
|
@@ -654,7 +654,7 @@ Per-call options for `client.call()`.
|
|
|
654
654
|
type ClientInferPublisherInput<TContract, TName> = PublisherInferInput<InferPublisher<TContract, TName>>;
|
|
655
655
|
```
|
|
656
656
|
|
|
657
|
-
Defined in: [packages/client/src/types.ts:43](https://github.com/btravers/amqp-contract/blob/
|
|
657
|
+
Defined in: [packages/client/src/types.ts:43](https://github.com/btravers/amqp-contract/blob/a478140dbe88d884a96d8fcfb20743271fd43c3f/packages/client/src/types.ts#L43)
|
|
658
658
|
|
|
659
659
|
Input type accepted by `client.publish(name, ...)` for a specific publisher.
|
|
660
660
|
|
|
@@ -673,7 +673,7 @@ Input type accepted by `client.publish(name, ...)` for a specific publisher.
|
|
|
673
673
|
type ClientInferRpcRequestInput<TContract, TName> = InferRpc<TContract, TName> extends RpcDefinition<infer TRequest, MessageDefinition> ? TRequest extends MessageDefinition ? InferSchemaInput<TRequest["payload"]> : never : never;
|
|
674
674
|
```
|
|
675
675
|
|
|
676
|
-
Defined in: [packages/client/src/types.ts:61](https://github.com/btravers/amqp-contract/blob/
|
|
676
|
+
Defined in: [packages/client/src/types.ts:61](https://github.com/btravers/amqp-contract/blob/a478140dbe88d884a96d8fcfb20743271fd43c3f/packages/client/src/types.ts#L61)
|
|
677
677
|
|
|
678
678
|
Input type accepted by `client.call(name, request, ...)`.
|
|
679
679
|
|
|
@@ -692,7 +692,7 @@ Input type accepted by `client.call(name, request, ...)`.
|
|
|
692
692
|
type ClientInferRpcResponseOutput<TContract, TName> = InferRpc<TContract, TName> extends RpcDefinition<MessageDefinition, infer TResponse> ? TResponse extends MessageDefinition ? InferSchemaOutput<TResponse["payload"]> : never : never;
|
|
693
693
|
```
|
|
694
694
|
|
|
695
|
-
Defined in: [packages/client/src/types.ts:74](https://github.com/btravers/amqp-contract/blob/
|
|
695
|
+
Defined in: [packages/client/src/types.ts:74](https://github.com/btravers/amqp-contract/blob/a478140dbe88d884a96d8fcfb20743271fd43c3f/packages/client/src/types.ts#L74)
|
|
696
696
|
|
|
697
697
|
Output (validated) response type returned by `client.call(name, ...)`.
|
|
698
698
|
|
|
@@ -711,7 +711,7 @@ Output (validated) response type returned by `client.call(name, ...)`.
|
|
|
711
711
|
type CreateClientOptions<TContract> = object;
|
|
712
712
|
```
|
|
713
713
|
|
|
714
|
-
Defined in: [packages/client/src/client.ts:
|
|
714
|
+
Defined in: [packages/client/src/client.ts:76](https://github.com/btravers/amqp-contract/blob/a478140dbe88d884a96d8fcfb20743271fd43c3f/packages/client/src/client.ts#L76)
|
|
715
715
|
|
|
716
716
|
Options for creating a client
|
|
717
717
|
|
|
@@ -725,13 +725,13 @@ Options for creating a client
|
|
|
725
725
|
|
|
726
726
|
| Property | Type | Description | Defined in |
|
|
727
727
|
| ------ | ------ | ------ | ------ |
|
|
728
|
-
| <a id="connectionoptions"></a> `connectionOptions?` | `AmqpConnectionManagerOptions` | - | [packages/client/src/client.ts:
|
|
729
|
-
| <a id="connecttimeoutms"></a> `connectTimeoutMs?` | `number` \| `null` | Maximum time in ms to wait for the AMQP connection to become ready before `create()` resolves to `
|
|
730
|
-
| <a id="contract"></a> `contract` | `TContract` | - | [packages/client/src/client.ts:
|
|
731
|
-
| <a id="defaultpublishoptions"></a> `defaultPublishOptions?` | [`PublishOptions`](#publishoptions-1) | Default publish options that will be applied to all publish operations. These can be overridden by options passed to the publish method. By default, persistent is set to true for message durability. | [packages/client/src/client.ts:
|
|
732
|
-
| <a id="logger"></a> `logger?` | `Logger` | - | [packages/client/src/client.ts:
|
|
733
|
-
| <a id="telemetry"></a> `telemetry?` | `TelemetryProvider` | Optional telemetry provider for tracing and metrics. If not provided, uses the default provider which attempts to load OpenTelemetry. OpenTelemetry instrumentation is automatically enabled if @opentelemetry/api is installed. | [packages/client/src/client.ts:
|
|
734
|
-
| <a id="urls"></a> `urls` | `ConnectionUrl`[] | - | [packages/client/src/client.ts:
|
|
728
|
+
| <a id="connectionoptions"></a> `connectionOptions?` | `AmqpConnectionManagerOptions` | - | [packages/client/src/client.ts:79](https://github.com/btravers/amqp-contract/blob/a478140dbe88d884a96d8fcfb20743271fd43c3f/packages/client/src/client.ts#L79) |
|
|
729
|
+
| <a id="connecttimeoutms"></a> `connectTimeoutMs?` | `number` \| `null` | Maximum time in ms to wait for the AMQP connection to become ready before `create()` resolves to an `err(TechnicalError)`. Defaults to 30s (the [AmqpClient](https://btravers.github.io/amqp-contract/api/core#amqpclient)'s `DEFAULT_CONNECT_TIMEOUT_MS`). Pass `null` to disable the timeout and let amqp-connection-manager retry indefinitely. | [packages/client/src/client.ts:99](https://github.com/btravers/amqp-contract/blob/a478140dbe88d884a96d8fcfb20743271fd43c3f/packages/client/src/client.ts#L99) |
|
|
730
|
+
| <a id="contract"></a> `contract` | `TContract` | - | [packages/client/src/client.ts:77](https://github.com/btravers/amqp-contract/blob/a478140dbe88d884a96d8fcfb20743271fd43c3f/packages/client/src/client.ts#L77) |
|
|
731
|
+
| <a id="defaultpublishoptions"></a> `defaultPublishOptions?` | [`PublishOptions`](#publishoptions-1) | Default publish options that will be applied to all publish operations. These can be overridden by options passed to the publish method. By default, persistent is set to true for message durability. | [packages/client/src/client.ts:92](https://github.com/btravers/amqp-contract/blob/a478140dbe88d884a96d8fcfb20743271fd43c3f/packages/client/src/client.ts#L92) |
|
|
732
|
+
| <a id="logger"></a> `logger?` | `Logger` | - | [packages/client/src/client.ts:80](https://github.com/btravers/amqp-contract/blob/a478140dbe88d884a96d8fcfb20743271fd43c3f/packages/client/src/client.ts#L80) |
|
|
733
|
+
| <a id="telemetry"></a> `telemetry?` | `TelemetryProvider` | Optional telemetry provider for tracing and metrics. If not provided, uses the default provider which attempts to load OpenTelemetry. OpenTelemetry instrumentation is automatically enabled if @opentelemetry/api is installed. | [packages/client/src/client.ts:86](https://github.com/btravers/amqp-contract/blob/a478140dbe88d884a96d8fcfb20743271fd43c3f/packages/client/src/client.ts#L86) |
|
|
734
|
+
| <a id="urls"></a> `urls` | `ConnectionUrl`[] | - | [packages/client/src/client.ts:78](https://github.com/btravers/amqp-contract/blob/a478140dbe88d884a96d8fcfb20743271fd43c3f/packages/client/src/client.ts#L78) |
|
|
735
735
|
|
|
736
736
|
***
|
|
737
737
|
|
|
@@ -741,7 +741,7 @@ Options for creating a client
|
|
|
741
741
|
type PublishOptions = AmqpClientPublishOptions & object;
|
|
742
742
|
```
|
|
743
743
|
|
|
744
|
-
Defined in: [packages/client/src/client.ts:
|
|
744
|
+
Defined in: [packages/client/src/client.ts:64](https://github.com/btravers/amqp-contract/blob/a478140dbe88d884a96d8fcfb20743271fd43c3f/packages/client/src/client.ts#L64)
|
|
745
745
|
|
|
746
746
|
Publish options that extend amqp-client's PublishOptions with optional compression support.
|
|
747
747
|
|
|
@@ -749,4 +749,4 @@ Publish options that extend amqp-client's PublishOptions with optional compressi
|
|
|
749
749
|
|
|
750
750
|
| Name | Type | Description | Defined in |
|
|
751
751
|
| ------ | ------ | ------ | ------ |
|
|
752
|
-
| `compression?` | `CompressionAlgorithm` | Optional compression algorithm to use for the message payload. When specified, the message will be compressed using the chosen algorithm and the contentEncoding header will be set automatically. | [packages/client/src/client.ts:
|
|
752
|
+
| `compression?` | `CompressionAlgorithm` | Optional compression algorithm to use for the message payload. When specified, the message will be compressed using the chosen algorithm and the contentEncoding header will be set automatically. | [packages/client/src/client.ts:70](https://github.com/btravers/amqp-contract/blob/a478140dbe88d884a96d8fcfb20743271fd43c3f/packages/client/src/client.ts#L70) |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amqp-contract/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"description": "Client utilities for publishing messages using amqp-contract",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"amqp",
|
|
@@ -51,10 +51,10 @@
|
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@standard-schema/spec": "1.1.0",
|
|
54
|
-
"
|
|
54
|
+
"neverthrow": "8.2.0",
|
|
55
55
|
"ts-pattern": "5.9.0",
|
|
56
|
-
"@amqp-contract/contract": "0.
|
|
57
|
-
"@amqp-contract/core": "0.
|
|
56
|
+
"@amqp-contract/contract": "0.25.0",
|
|
57
|
+
"@amqp-contract/core": "0.25.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/amqplib": "0.10.8",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"typescript": "6.0.3",
|
|
69
69
|
"vitest": "4.1.5",
|
|
70
70
|
"zod": "4.4.3",
|
|
71
|
-
"@amqp-contract/testing": "0.23.1",
|
|
72
71
|
"@amqp-contract/tsconfig": "0.1.0",
|
|
72
|
+
"@amqp-contract/testing": "0.25.0",
|
|
73
73
|
"@amqp-contract/typedoc": "0.1.0"
|
|
74
74
|
},
|
|
75
75
|
"scripts": {
|