UNPKG

@energyweb/node-red-contrib-green-proof-worker

Version:

## Peer dependencies

43 lines (42 loc) 1.92 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.InputMessages = exports.MessageType = void 0; const tslib_1 = require("tslib"); const zod_1 = tslib_1.__importDefault(require("zod")); const types_1 = require("./types"); var MessageType; (function (MessageType) { MessageType["UnitsChanged"] = "unitsChanged"; })(MessageType || (exports.MessageType = MessageType = {})); var InputMessages; (function (InputMessages) { InputMessages.UnitsChanged = (additionalFields = {}, topic = zod_1.default.literal(undefined)) => { /** Changing anything here require changes in {@link UnitsChangedCompatibility} as well */ return zod_1.default.object({ topic, payload: zod_1.default.object({ type: zod_1.default.literal(MessageType.UnitsChanged), txLog: types_1.TxLog, ...additionalFields }).passthrough() }); }; /** * @deprecated * * This is exactly the same type as Voting, but lacks `type: UnitsChanged`. * It is used by source-validator, and should not be used by anything else. SourceValidator adds `type` for rest of nodes. * It is used for backwards compatibility for changes in protocol that add "type" to a message. * It could be in kafka-proxy instead, but kafka-proxy should not unpack messages. * Additionally, having it in worker allows us to smoothly remove it in future, after GGP is upgraded everywhere. */ InputMessages.UnitsChangedCompatibility = (additionalFields = {}, topic = zod_1.default.literal(undefined)) => { return zod_1.default.object({ topic, payload: zod_1.default.object({ txLog: types_1.TxLog, ...additionalFields }).passthrough() }); }; })(InputMessages || (exports.InputMessages = InputMessages = {}));