@skillstew/common 1.0.21 → 1.0.22
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
|
@@ -8,14 +8,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
exports.Consumer = void 0;
|
|
16
13
|
const EventMap_1 = require("./EventMap");
|
|
17
14
|
const MessageQueueErrors_1 = require("../errors/MessageQueueErrors");
|
|
18
|
-
const zod_1 = __importDefault(require("zod"));
|
|
19
15
|
class Consumer {
|
|
20
16
|
constructor() {
|
|
21
17
|
this._initialized = false;
|
|
@@ -46,9 +42,8 @@ class Consumer {
|
|
|
46
42
|
}
|
|
47
43
|
const parseResult = schema.safeParse(event.data);
|
|
48
44
|
if (!parseResult.success) {
|
|
49
|
-
this._channel.
|
|
50
|
-
|
|
51
|
-
throw new MessageQueueErrors_1.InvalidEventPayloadError(eventName, error);
|
|
45
|
+
this._channel.nack(msg, false, false);
|
|
46
|
+
return;
|
|
52
47
|
}
|
|
53
48
|
// create typed app event
|
|
54
49
|
const appEvent = Object.assign(Object.assign({}, event), { data: parseResult.data });
|
package/package.json
CHANGED
package/src/events/Consumer.ts
CHANGED
|
@@ -3,10 +3,8 @@ import { EventName, EventSchemas } from "./EventMap";
|
|
|
3
3
|
import { AnyAppEvent, AppEvent } from "./AppEvent";
|
|
4
4
|
import {
|
|
5
5
|
ConsumerUsedBeforeInitializationError,
|
|
6
|
-
InvalidEventPayloadError,
|
|
7
6
|
UnknownEventError,
|
|
8
7
|
} from "../errors/MessageQueueErrors";
|
|
9
|
-
import z from "zod";
|
|
10
8
|
|
|
11
9
|
type EventHandler<T extends EventName> = (
|
|
12
10
|
event: AppEvent<T>,
|
|
@@ -60,9 +58,8 @@ export class Consumer {
|
|
|
60
58
|
}
|
|
61
59
|
const parseResult = schema.safeParse(event.data);
|
|
62
60
|
if (!parseResult.success) {
|
|
63
|
-
this._channel.
|
|
64
|
-
|
|
65
|
-
throw new InvalidEventPayloadError(eventName, error);
|
|
61
|
+
this._channel.nack(msg, false, false);
|
|
62
|
+
return;
|
|
66
63
|
}
|
|
67
64
|
|
|
68
65
|
// create typed app event
|