UNPKG

@arturwojnar/hermes-postgresql

Version:

Production-Ready TypeScript Outbox Pattern for PostgreSQL

19 lines 804 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 processCommitMessage = (data) => { const pos = offset(Bytes.Int8 + Bytes.Int8); const commitLsn = constructLsn(data.subarray(pos.value(), pos.addInt64())); const transactionEndLsn = constructLsn(data.subarray(pos.value(), pos.addInt64())); const commitTimestamp = toTimestamp(data.readBigInt64BE(pos.value())); return { topLevelType: TopLevelType.XLogData, messageType: MessageType.Commit, commitLsn, transactionEndLsn, commitTimestamp, }; }; export { processCommitMessage }; //# sourceMappingURL=processCommitMessage.js.map