@palmetto/nestjs-pubsub 1.0.7 → 1.0.8
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 +22 -7
- package/dist/subscriber.d.ts +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -27,12 +27,27 @@ yarn add bullmq
|
|
|
27
27
|
### Add to your `AppModule` imports
|
|
28
28
|
|
|
29
29
|
```ts
|
|
30
|
+
import {
|
|
31
|
+
RABBITMQ_TRANSPORT,
|
|
32
|
+
RabbitQueueExchangeConfiguration,
|
|
33
|
+
BULLMQ_TRANSPORT,
|
|
34
|
+
BullMqQueueConfiguration,
|
|
35
|
+
IdMetaSchema,
|
|
36
|
+
Publisher,
|
|
37
|
+
} from "@palmetto/pubsub";
|
|
38
|
+
|
|
39
|
+
import { EventSubscriber } from "@palmetto/nestjs-pubsub";
|
|
40
|
+
|
|
41
|
+
import { Injectable, Module } from "@nestjs/common";
|
|
42
|
+
|
|
43
|
+
import { z } from "zod";
|
|
44
|
+
|
|
30
45
|
// MyModel* objects define the model you are publishing or subscribing using RabbitMq
|
|
31
46
|
const MyModelSchema = IdMetaSchema.extend({
|
|
32
|
-
message:
|
|
33
|
-
value:
|
|
47
|
+
message: z.string(),
|
|
48
|
+
value: z.int(),
|
|
34
49
|
});
|
|
35
|
-
type MyModel =
|
|
50
|
+
type MyModel = z.infer<typeof MyModelSchema>;
|
|
36
51
|
const MyModelConfig: RabbitQueueExchangeConfiguration = {
|
|
37
52
|
name: "my-model",
|
|
38
53
|
schema: MyModelSchema,
|
|
@@ -42,11 +57,11 @@ const MyModelConfig: RabbitQueueExchangeConfiguration = {
|
|
|
42
57
|
|
|
43
58
|
// MyOtherModel* objects define another model you are publishing or subscribing, this time using BullMq
|
|
44
59
|
const MyOtherModelSchema = IdMetaSchema.extend({
|
|
45
|
-
message:
|
|
46
|
-
values:
|
|
60
|
+
message: z.string(),
|
|
61
|
+
values: z.int().array(),
|
|
47
62
|
});
|
|
48
|
-
type MyOtherModel =
|
|
49
|
-
const MyOtherModelConfig:
|
|
63
|
+
type MyOtherModel = z.infer<typeof MyOtherModelSchema>;
|
|
64
|
+
const MyOtherModelConfig: BullMqQueueConfiguration = {
|
|
50
65
|
name: "my-other-model",
|
|
51
66
|
schema: MyOtherModelSchema,
|
|
52
67
|
transport: BULLMQ_TRANSPORT,
|
package/dist/subscriber.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { PubSubConfiguration } from "@palmetto/pubsub";
|
|
1
|
+
import { BullMqQueueConfiguration, PubSubConfiguration, RabbitQueueExchangeConfiguration } from "@palmetto/pubsub";
|
|
2
2
|
export declare const EVENT_HANDLER: unique symbol;
|
|
3
|
-
export declare const EventSubscriber: (config: PubSubConfiguration) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
3
|
+
export declare const EventSubscriber: (config: PubSubConfiguration | RabbitQueueExchangeConfiguration | BullMqQueueConfiguration) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@palmetto/nestjs-pubsub",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"main": "./dist/main.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"lint": "yarn run -T eslint --fix ./src",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@golevelup/nestjs-discovery": "^5.0.0",
|
|
46
46
|
"@palmetto/nestjs-errors": "^2.2.1",
|
|
47
|
-
"@palmetto/pubsub": "^1.0.
|
|
47
|
+
"@palmetto/pubsub": "^1.0.7",
|
|
48
48
|
"reflect-metadata": "^0.2.2",
|
|
49
49
|
"rxjs": "^7.8.2"
|
|
50
50
|
},
|