@skillstew/common 1.0.20 → 1.0.21
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/build/events/Consumer.js
CHANGED
|
@@ -46,7 +46,7 @@ class Consumer {
|
|
|
46
46
|
}
|
|
47
47
|
const parseResult = schema.safeParse(event.data);
|
|
48
48
|
if (!parseResult.success) {
|
|
49
|
-
this._channel.
|
|
49
|
+
this._channel.ack(msg);
|
|
50
50
|
const error = zod_1.default.prettifyError(parseResult.error);
|
|
51
51
|
throw new MessageQueueErrors_1.InvalidEventPayloadError(eventName, error);
|
|
52
52
|
}
|
package/package.json
CHANGED
package/src/events/Consumer.ts
CHANGED
|
@@ -8,16 +8,15 @@ import {
|
|
|
8
8
|
} from "../errors/MessageQueueErrors";
|
|
9
9
|
import z from "zod";
|
|
10
10
|
|
|
11
|
-
type EventHandler<T extends EventName> = (
|
|
11
|
+
type EventHandler<T extends EventName> = (
|
|
12
|
+
event: AppEvent<T>,
|
|
13
|
+
) => Promise<HandlerResult>;
|
|
12
14
|
|
|
13
15
|
export class Consumer {
|
|
14
16
|
private _channel!: Channel;
|
|
15
17
|
private _exchange!: string;
|
|
16
18
|
private _initialized: boolean = false;
|
|
17
|
-
private _handlers = new Map<
|
|
18
|
-
EventName,
|
|
19
|
-
EventHandler<EventName>
|
|
20
|
-
>();
|
|
19
|
+
private _handlers = new Map<EventName, EventHandler<EventName>>();
|
|
21
20
|
constructor() {}
|
|
22
21
|
|
|
23
22
|
init = async (
|
|
@@ -61,7 +60,7 @@ export class Consumer {
|
|
|
61
60
|
}
|
|
62
61
|
const parseResult = schema.safeParse(event.data);
|
|
63
62
|
if (!parseResult.success) {
|
|
64
|
-
this._channel.
|
|
63
|
+
this._channel.ack(msg);
|
|
65
64
|
const error = z.prettifyError(parseResult.error);
|
|
66
65
|
throw new InvalidEventPayloadError(eventName, error);
|
|
67
66
|
}
|