@amqp-contract/worker-nestjs 0.6.0 → 0.7.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 +5 -5
- package/docs/index.md +21 -21
- package/package.json +19 -11
package/README.md
CHANGED
|
@@ -19,9 +19,9 @@ pnpm add @amqp-contract/worker-nestjs @amqp-contract/worker @amqp-contract/contr
|
|
|
19
19
|
## Usage
|
|
20
20
|
|
|
21
21
|
```typescript
|
|
22
|
-
import { Module } from
|
|
23
|
-
import { AmqpWorkerModule } from
|
|
24
|
-
import { contract } from
|
|
22
|
+
import { Module } from "@nestjs/common";
|
|
23
|
+
import { AmqpWorkerModule } from "@amqp-contract/worker-nestjs";
|
|
24
|
+
import { contract } from "./contract";
|
|
25
25
|
|
|
26
26
|
@Module({
|
|
27
27
|
imports: [
|
|
@@ -29,10 +29,10 @@ import { contract } from './contract';
|
|
|
29
29
|
contract,
|
|
30
30
|
handlers: {
|
|
31
31
|
processOrder: async (message) => {
|
|
32
|
-
console.log(
|
|
32
|
+
console.log("Processing order:", message.orderId);
|
|
33
33
|
},
|
|
34
34
|
},
|
|
35
|
-
connection:
|
|
35
|
+
connection: "amqp://localhost",
|
|
36
36
|
}),
|
|
37
37
|
],
|
|
38
38
|
})
|
package/docs/index.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
### AmqpWorkerModule
|
|
10
10
|
|
|
11
|
-
Defined in: [worker-nestjs/src/worker.module.ts:88](https://github.com/btravers/amqp-contract/blob/
|
|
11
|
+
Defined in: [worker-nestjs/src/worker.module.ts:88](https://github.com/btravers/amqp-contract/blob/382c6d2fbfc563c9f6f16cb71cb33fd4a3d41d77/packages/worker-nestjs/src/worker.module.ts#L88)
|
|
12
12
|
|
|
13
13
|
NestJS module for AMQP worker integration
|
|
14
14
|
This module provides type-safe AMQP worker functionality using @amqp-contract/worker
|
|
@@ -79,7 +79,7 @@ new AmqpWorkerModule(): AmqpWorkerModule;
|
|
|
79
79
|
static forRoot<TContract>(options): DynamicModule;
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
-
Defined in: [worker-nestjs/src/worker.module.ts:95](https://github.com/btravers/amqp-contract/blob/
|
|
82
|
+
Defined in: [worker-nestjs/src/worker.module.ts:95](https://github.com/btravers/amqp-contract/blob/382c6d2fbfc563c9f6f16cb71cb33fd4a3d41d77/packages/worker-nestjs/src/worker.module.ts#L95)
|
|
83
83
|
|
|
84
84
|
Register the AMQP worker module with synchronous configuration
|
|
85
85
|
|
|
@@ -107,7 +107,7 @@ A dynamic module for NestJS
|
|
|
107
107
|
static forRootAsync<TContract>(options): DynamicModule;
|
|
108
108
|
```
|
|
109
109
|
|
|
110
|
-
Defined in: [worker-nestjs/src/worker.module.ts:117](https://github.com/btravers/amqp-contract/blob/
|
|
110
|
+
Defined in: [worker-nestjs/src/worker.module.ts:117](https://github.com/btravers/amqp-contract/blob/382c6d2fbfc563c9f6f16cb71cb33fd4a3d41d77/packages/worker-nestjs/src/worker.module.ts#L117)
|
|
111
111
|
|
|
112
112
|
Register the AMQP worker module with asynchronous configuration
|
|
113
113
|
|
|
@@ -133,7 +133,7 @@ A dynamic module for NestJS
|
|
|
133
133
|
|
|
134
134
|
### AmqpWorkerService
|
|
135
135
|
|
|
136
|
-
Defined in: [worker-nestjs/src/worker.service.ts:74](https://github.com/btravers/amqp-contract/blob/
|
|
136
|
+
Defined in: [worker-nestjs/src/worker.service.ts:74](https://github.com/btravers/amqp-contract/blob/382c6d2fbfc563c9f6f16cb71cb33fd4a3d41d77/packages/worker-nestjs/src/worker.service.ts#L74)
|
|
137
137
|
|
|
138
138
|
Type-safe AMQP worker service for NestJS applications.
|
|
139
139
|
|
|
@@ -186,7 +186,7 @@ export class AppModule {}
|
|
|
186
186
|
new AmqpWorkerService<TContract>(options): AmqpWorkerService<TContract>;
|
|
187
187
|
```
|
|
188
188
|
|
|
189
|
-
Defined in: [worker-nestjs/src/worker.service.ts:79](https://github.com/btravers/amqp-contract/blob/
|
|
189
|
+
Defined in: [worker-nestjs/src/worker.service.ts:79](https://github.com/btravers/amqp-contract/blob/382c6d2fbfc563c9f6f16cb71cb33fd4a3d41d77/packages/worker-nestjs/src/worker.service.ts#L79)
|
|
190
190
|
|
|
191
191
|
###### Parameters
|
|
192
192
|
|
|
@@ -206,7 +206,7 @@ Defined in: [worker-nestjs/src/worker.service.ts:79](https://github.com/btravers
|
|
|
206
206
|
onModuleDestroy(): Promise<void>;
|
|
207
207
|
```
|
|
208
208
|
|
|
209
|
-
Defined in: [worker-nestjs/src/worker.service.ts:105](https://github.com/btravers/amqp-contract/blob/
|
|
209
|
+
Defined in: [worker-nestjs/src/worker.service.ts:105](https://github.com/btravers/amqp-contract/blob/382c6d2fbfc563c9f6f16cb71cb33fd4a3d41d77/packages/worker-nestjs/src/worker.service.ts#L105)
|
|
210
210
|
|
|
211
211
|
Close the AMQP worker when the NestJS module is destroyed.
|
|
212
212
|
|
|
@@ -230,7 +230,7 @@ OnModuleDestroy.onModuleDestroy
|
|
|
230
230
|
onModuleInit(): Promise<void>;
|
|
231
231
|
```
|
|
232
232
|
|
|
233
|
-
Defined in: [worker-nestjs/src/worker.service.ts:94](https://github.com/btravers/amqp-contract/blob/
|
|
233
|
+
Defined in: [worker-nestjs/src/worker.service.ts:94](https://github.com/btravers/amqp-contract/blob/382c6d2fbfc563c9f6f16cb71cb33fd4a3d41d77/packages/worker-nestjs/src/worker.service.ts#L94)
|
|
234
234
|
|
|
235
235
|
Initialize the AMQP worker when the NestJS module starts.
|
|
236
236
|
|
|
@@ -261,7 +261,7 @@ OnModuleInit.onModuleInit
|
|
|
261
261
|
type AmqpWorkerModuleAsyncOptions<TContract> = object;
|
|
262
262
|
```
|
|
263
263
|
|
|
264
|
-
Defined in: [worker-nestjs/src/worker.module.ts:22](https://github.com/btravers/amqp-contract/blob/
|
|
264
|
+
Defined in: [worker-nestjs/src/worker.module.ts:22](https://github.com/btravers/amqp-contract/blob/382c6d2fbfc563c9f6f16cb71cb33fd4a3d41d77/packages/worker-nestjs/src/worker.module.ts#L22)
|
|
265
265
|
|
|
266
266
|
Options for async module configuration using factory pattern
|
|
267
267
|
|
|
@@ -275,9 +275,9 @@ Options for async module configuration using factory pattern
|
|
|
275
275
|
|
|
276
276
|
| Property | Type | Description | Defined in |
|
|
277
277
|
| ------ | ------ | ------ | ------ |
|
|
278
|
-
| <a id="imports"></a> `imports?` | `ModuleMetadata`\[`"imports"`\] | Optional list of imported modules that export providers needed by the factory | [worker-nestjs/src/worker.module.ts:37](https://github.com/btravers/amqp-contract/blob/
|
|
279
|
-
| <a id="inject"></a> `inject?` | (`string` \| `symbol` \| `Type`\<`unknown`\>)[] | Optional dependencies to inject into the factory function. Can be a token (string/symbol) a class or a reference to a provider. | [worker-nestjs/src/worker.module.ts:33](https://github.com/btravers/amqp-contract/blob/
|
|
280
|
-
| <a id="usefactory"></a> `useFactory` | (...`args`) => `AmqpWorkerModuleOptionsFactory`\<`TContract`\> | Factory function that returns the module options. Can use injected dependencies to create configuration. | [worker-nestjs/src/worker.module.ts:28](https://github.com/btravers/amqp-contract/blob/
|
|
278
|
+
| <a id="imports"></a> `imports?` | `ModuleMetadata`\[`"imports"`\] | Optional list of imported modules that export providers needed by the factory | [worker-nestjs/src/worker.module.ts:37](https://github.com/btravers/amqp-contract/blob/382c6d2fbfc563c9f6f16cb71cb33fd4a3d41d77/packages/worker-nestjs/src/worker.module.ts#L37) |
|
|
279
|
+
| <a id="inject"></a> `inject?` | (`string` \| `symbol` \| `Type`\<`unknown`\>)[] | Optional dependencies to inject into the factory function. Can be a token (string/symbol) a class or a reference to a provider. | [worker-nestjs/src/worker.module.ts:33](https://github.com/btravers/amqp-contract/blob/382c6d2fbfc563c9f6f16cb71cb33fd4a3d41d77/packages/worker-nestjs/src/worker.module.ts#L33) |
|
|
280
|
+
| <a id="usefactory"></a> `useFactory` | (...`args`) => `AmqpWorkerModuleOptionsFactory`\<`TContract`\> | Factory function that returns the module options. Can use injected dependencies to create configuration. | [worker-nestjs/src/worker.module.ts:28](https://github.com/btravers/amqp-contract/blob/382c6d2fbfc563c9f6f16cb71cb33fd4a3d41d77/packages/worker-nestjs/src/worker.module.ts#L28) |
|
|
281
281
|
|
|
282
282
|
***
|
|
283
283
|
|
|
@@ -287,7 +287,7 @@ Options for async module configuration using factory pattern
|
|
|
287
287
|
type AmqpWorkerModuleOptions<TContract> = object;
|
|
288
288
|
```
|
|
289
289
|
|
|
290
|
-
Defined in: [worker-nestjs/src/worker.service.ts:28](https://github.com/btravers/amqp-contract/blob/
|
|
290
|
+
Defined in: [worker-nestjs/src/worker.service.ts:28](https://github.com/btravers/amqp-contract/blob/382c6d2fbfc563c9f6f16cb71cb33fd4a3d41d77/packages/worker-nestjs/src/worker.service.ts#L28)
|
|
291
291
|
|
|
292
292
|
Configuration options for the AMQP worker NestJS module.
|
|
293
293
|
|
|
@@ -318,10 +318,10 @@ const options: AmqpWorkerModuleOptions<typeof contract> = {
|
|
|
318
318
|
|
|
319
319
|
| Property | Type | Description | Defined in |
|
|
320
320
|
| ------ | ------ | ------ | ------ |
|
|
321
|
-
| <a id="connectionoptions"></a> `connectionOptions?` | `AmqpConnectionManagerOptions` | Optional connection configuration (heartbeat, reconnect settings, etc.) | [worker-nestjs/src/worker.service.ts:36](https://github.com/btravers/amqp-contract/blob/
|
|
322
|
-
| <a id="contract"></a> `contract` | `TContract` | The AMQP contract definition specifying consumers and their message schemas | [worker-nestjs/src/worker.service.ts:30](https://github.com/btravers/amqp-contract/blob/
|
|
323
|
-
| <a id="handlers"></a> `handlers` | [`WorkerInferConsumerHandlers`](#workerinferconsumerhandlers)\<`TContract`\> | Message handlers for each consumer defined in the contract | [worker-nestjs/src/worker.service.ts:32](https://github.com/btravers/amqp-contract/blob/
|
|
324
|
-
| <a id="urls"></a> `urls` | `ConnectionUrl`[] | AMQP broker URL(s). Multiple URLs provide failover support | [worker-nestjs/src/worker.service.ts:34](https://github.com/btravers/amqp-contract/blob/
|
|
321
|
+
| <a id="connectionoptions"></a> `connectionOptions?` | `AmqpConnectionManagerOptions` | Optional connection configuration (heartbeat, reconnect settings, etc.) | [worker-nestjs/src/worker.service.ts:36](https://github.com/btravers/amqp-contract/blob/382c6d2fbfc563c9f6f16cb71cb33fd4a3d41d77/packages/worker-nestjs/src/worker.service.ts#L36) |
|
|
322
|
+
| <a id="contract"></a> `contract` | `TContract` | The AMQP contract definition specifying consumers and their message schemas | [worker-nestjs/src/worker.service.ts:30](https://github.com/btravers/amqp-contract/blob/382c6d2fbfc563c9f6f16cb71cb33fd4a3d41d77/packages/worker-nestjs/src/worker.service.ts#L30) |
|
|
323
|
+
| <a id="handlers"></a> `handlers` | [`WorkerInferConsumerHandlers`](#workerinferconsumerhandlers)\<`TContract`\> | Message handlers for each consumer defined in the contract | [worker-nestjs/src/worker.service.ts:32](https://github.com/btravers/amqp-contract/blob/382c6d2fbfc563c9f6f16cb71cb33fd4a3d41d77/packages/worker-nestjs/src/worker.service.ts#L32) |
|
|
324
|
+
| <a id="urls"></a> `urls` | `ConnectionUrl`[] | AMQP broker URL(s). Multiple URLs provide failover support | [worker-nestjs/src/worker.service.ts:34](https://github.com/btravers/amqp-contract/blob/382c6d2fbfc563c9f6f16cb71cb33fd4a3d41d77/packages/worker-nestjs/src/worker.service.ts#L34) |
|
|
325
325
|
|
|
326
326
|
***
|
|
327
327
|
|
|
@@ -350,7 +350,7 @@ Handlers can be either single-message handlers, batch handlers, or a tuple of [h
|
|
|
350
350
|
const MODULE_OPTIONS_TOKEN: typeof MODULE_OPTIONS_TOKEN;
|
|
351
351
|
```
|
|
352
352
|
|
|
353
|
-
Defined in: [worker-nestjs/src/worker.module-definition.ts:5](https://github.com/btravers/amqp-contract/blob/
|
|
353
|
+
Defined in: [worker-nestjs/src/worker.module-definition.ts:5](https://github.com/btravers/amqp-contract/blob/382c6d2fbfc563c9f6f16cb71cb33fd4a3d41d77/packages/worker-nestjs/src/worker.module-definition.ts#L5)
|
|
354
354
|
|
|
355
355
|
Injection token for AMQP worker module options
|
|
356
356
|
Used by NestJS DI system to inject configuration into AmqpWorkerService
|
|
@@ -368,7 +368,7 @@ function defineHandler<TContract, TName>(
|
|
|
368
368
|
handler): WorkerInferConsumerHandlerEntry<TContract, TName>;
|
|
369
369
|
```
|
|
370
370
|
|
|
371
|
-
Defined in: worker/dist/index.d.mts:
|
|
371
|
+
Defined in: worker/dist/index.d.mts:324
|
|
372
372
|
|
|
373
373
|
Define a type-safe handler for a specific consumer in a contract.
|
|
374
374
|
|
|
@@ -452,7 +452,7 @@ function defineHandler<TContract, TName>(
|
|
|
452
452
|
options): WorkerInferConsumerHandlerEntry<TContract, TName>;
|
|
453
453
|
```
|
|
454
454
|
|
|
455
|
-
Defined in: worker/dist/index.d.mts:
|
|
455
|
+
Defined in: worker/dist/index.d.mts:325
|
|
456
456
|
|
|
457
457
|
Define a type-safe handler for a specific consumer in a contract.
|
|
458
458
|
|
|
@@ -540,7 +540,7 @@ function defineHandler<TContract, TName>(
|
|
|
540
540
|
options): WorkerInferConsumerHandlerEntry<TContract, TName>;
|
|
541
541
|
```
|
|
542
542
|
|
|
543
|
-
Defined in: worker/dist/index.d.mts:
|
|
543
|
+
Defined in: worker/dist/index.d.mts:330
|
|
544
544
|
|
|
545
545
|
Define a type-safe handler for a specific consumer in a contract.
|
|
546
546
|
|
|
@@ -626,7 +626,7 @@ const processBatchOrders = defineHandler(
|
|
|
626
626
|
function defineHandlers<TContract>(contract, handlers): WorkerInferConsumerHandlers<TContract>;
|
|
627
627
|
```
|
|
628
628
|
|
|
629
|
-
Defined in: worker/dist/index.d.mts:
|
|
629
|
+
Defined in: worker/dist/index.d.mts:391
|
|
630
630
|
|
|
631
631
|
Define multiple type-safe handlers for consumers in a contract.
|
|
632
632
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amqp-contract/worker-nestjs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "NestJS integration for @amqp-contract/worker",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"amqp",
|
|
@@ -8,7 +8,16 @@
|
|
|
8
8
|
"nestjs",
|
|
9
9
|
"rabbitmq",
|
|
10
10
|
"typescript",
|
|
11
|
-
"worker"
|
|
11
|
+
"worker",
|
|
12
|
+
"nodejs",
|
|
13
|
+
"messaging",
|
|
14
|
+
"type-safe",
|
|
15
|
+
"schema",
|
|
16
|
+
"validation",
|
|
17
|
+
"message-broker",
|
|
18
|
+
"message-queue",
|
|
19
|
+
"consumer",
|
|
20
|
+
"nest"
|
|
12
21
|
],
|
|
13
22
|
"homepage": "https://github.com/btravers/amqp-contract#readme",
|
|
14
23
|
"bugs": {
|
|
@@ -43,13 +52,13 @@
|
|
|
43
52
|
"docs"
|
|
44
53
|
],
|
|
45
54
|
"dependencies": {
|
|
46
|
-
"@amqp-contract/contract": "0.
|
|
47
|
-
"@amqp-contract/worker": "0.
|
|
55
|
+
"@amqp-contract/contract": "0.7.0",
|
|
56
|
+
"@amqp-contract/worker": "0.7.0"
|
|
48
57
|
},
|
|
49
58
|
"devDependencies": {
|
|
50
|
-
"@nestjs/common": "11.1.
|
|
51
|
-
"@nestjs/core": "11.1.
|
|
52
|
-
"@nestjs/testing": "11.1.
|
|
59
|
+
"@nestjs/common": "11.1.11",
|
|
60
|
+
"@nestjs/core": "11.1.11",
|
|
61
|
+
"@nestjs/testing": "11.1.11",
|
|
53
62
|
"@swan-io/boxed": "3.2.1",
|
|
54
63
|
"@types/node": "25.0.3",
|
|
55
64
|
"@vitest/coverage-v8": "4.0.16",
|
|
@@ -57,13 +66,13 @@
|
|
|
57
66
|
"amqplib": "0.10.9",
|
|
58
67
|
"reflect-metadata": "0.2.2",
|
|
59
68
|
"rxjs": "7.8.2",
|
|
60
|
-
"tsdown": "0.18.
|
|
69
|
+
"tsdown": "0.18.4",
|
|
61
70
|
"typedoc": "0.28.15",
|
|
62
71
|
"typedoc-plugin-markdown": "4.9.0",
|
|
63
72
|
"typescript": "5.9.3",
|
|
64
73
|
"vitest": "4.0.16",
|
|
65
|
-
"zod": "4.
|
|
66
|
-
"@amqp-contract/testing": "0.
|
|
74
|
+
"zod": "4.3.5",
|
|
75
|
+
"@amqp-contract/testing": "0.7.0",
|
|
67
76
|
"@amqp-contract/tsconfig": "0.0.0",
|
|
68
77
|
"@amqp-contract/typedoc": "0.0.1"
|
|
69
78
|
},
|
|
@@ -79,7 +88,6 @@
|
|
|
79
88
|
"dev": "tsdown src/index.ts --format cjs,esm --dts --watch",
|
|
80
89
|
"test": "vitest run --project unit",
|
|
81
90
|
"test:integration": "vitest run --project integration",
|
|
82
|
-
"test:watch": "vitest --project unit",
|
|
83
91
|
"typecheck": "tsc --noEmit"
|
|
84
92
|
}
|
|
85
93
|
}
|