diff --git a/mod.d.ts b/mod.d.ts index db0b29a..25cad1e 100644 --- a/mod.d.ts +++ b/mod.d.ts @@ -170,24 +170,24 @@ export interface LogicalReplicationOptions { } export interface ReplicationStream extends AsyncIterable { - /** Confirms receipt of replication packet by lsn. - * Use {@link ReplicationMessage.lsn} to get packet lsn. */ + /** Confirms receipt of replication message by lsn. + * Use {@link ReplicationMessage.lsn} to get lsn. */ ack(lsn: string): undefined; /** - * Decodes {@link ReplicationMessage.data} and yields upgraded pgoutput packets. + * Decodes {@link ReplicationMessage.data} and yields upgraded pgoutput messages. * Use this method if replication is started with pgoutput slot. */ pgoutputDecode(): AsyncIterable; } export interface ReplicationChunk { - readonly endLsn: string; - readonly time: bigint; readonly messages: ReplicationMessage[]; + readonly lastLsn: string; + readonly lastTime: bigint; } export interface ReplicationMessage { - /** Log Serial Number of packet. - * Use it for {@link ReplicationStream.ack} to confirm receipt of packet. */ + /** Log Serial Number of message. + * Use it for {@link ReplicationStream.ack} to confirm receipt of message. */ readonly lsn: string | null; readonly endLsn: string | null; /** microseconds since unix epoch */ diff --git a/mod.js b/mod.js index 3e87a66..d9e13d6 100644 --- a/mod.js +++ b/mod.js @@ -1605,10 +1605,10 @@ class ReplicationStream extends BinaryReader { break; case 'PrimaryKeepaliveMessage': shouldAck = shouldAck || msg.shouldReply; + // TODO msg.endLsn not exposed break; } if (lastLsn < msg.lsn) lastLsn = msg.lsn; - if (lastLsn < msg.endLsn) lastLsn = msg.endLsn; if (lastTime < msg.time) lastTime = msg.time; } if (shouldAck) { diff --git a/readme.md b/readme.md index 3c0361b..2a65460 100644 --- a/readme.md +++ b/readme.md @@ -458,8 +458,7 @@ for (const notice of out.notices) { ```js for await (const chunk of replstream.pgoutputDecode()) { - - // (string) Lsn of last received message. + // (string) Last valid received lsn. // Use it for replstream.ack() to confirm receipt of whole chunk. chunk.lastLsn; // (bigint) Time of last received message. Microseconds since unix epoch. diff --git a/test/deno.dockerfile b/test/deno.dockerfile index e94fadf..069dbb1 100644 --- a/test/deno.dockerfile +++ b/test/deno.dockerfile @@ -1,4 +1,4 @@ -FROM denoland/deno:alpine-1.23.4 +FROM denoland/deno:alpine-1.25.4 COPY test_deno.js /tmp/test/ RUN set -x \ && touch /tmp/mod.js \