UNPKG

@arturwojnar/hermes-postgresql

Version:

Production-Ready TypeScript Outbox Pattern for PostgreSQL

19 lines 712 B
import { toTimestamp } from '../common/helpers.js'; import { constructLsn } from '../common/lsn.js'; import { offset } from '../common/offset.js'; import { Bytes, MessageType, TopLevelType } from './types.js'; const processBeginMessage = (data) => { const pos = offset(Bytes.Int8); const lsn = constructLsn(data.subarray(1, 9)); const timestamp = toTimestamp(data.readBigInt64BE(pos.addInt64())); const transactionId = data.readUInt32BE(pos.addInt64()); return { topLevelType: TopLevelType.XLogData, messageType: MessageType.Begin, transactionId, lsn, timestamp, }; }; export { processBeginMessage }; //# sourceMappingURL=processBeginMessage.js.map