@arbitro/client 0.5.0 → 0.5.2

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/dist/index.mjs CHANGED
@@ -5,13 +5,13 @@ import {
5
5
  packPublish,
6
6
  packPublishBatch,
7
7
  packPublishWithReply
8
- } from "./chunk-GW36GP2C.mjs";
8
+ } from "./chunk-BSPQZJHF.mjs";
9
9
  import {
10
10
  HEADER_SIZE,
11
11
  OFF_ACTION,
12
12
  OFF_MSG_LEN,
13
13
  OFF_SEQ
14
- } from "./chunk-C2QLJBAC.mjs";
14
+ } from "./chunk-3EHQPPLU.mjs";
15
15
 
16
16
  // src/types/config.ts
17
17
  var DeliverPolicy = /* @__PURE__ */ ((DeliverPolicy2) => {
@@ -270,6 +270,7 @@ var packDrainSubject = (seq, name, subject) => packCold2(1030 /* DrainSubject */
270
270
  name: bytesArr(name),
271
271
  subject: bytesArr(subject)
272
272
  });
273
+ var packDeleteMessage = (seq, name, msgSeq) => packCold2(1031 /* DeleteMessage */, seq, { name: bytesArr(name), seq: Number(msgSeq) });
273
274
  var packListStreams = (seq, offset = 0, limit = 1e3) => packCold2(1028 /* ListStreams */, seq, { offset: offset >>> 0, limit: limit >>> 0 });
274
275
  function packCreateConsumer(seq, opts) {
275
276
  const limits = (opts.subjectLimits ?? []).map((l) => ({
@@ -927,6 +928,10 @@ var Consumer = class {
927
928
  }
928
929
  return this.client.getPending(this.streamName, this.name);
929
930
  }
931
+ /** Tombstone a single message by seq. Returns true if found. */
932
+ deleteMessage(seq) {
933
+ return this.client.deleteMessage(this.streamName, seq);
934
+ }
930
935
  subscribe(codecOrCb, cbOrOpts, opts) {
931
936
  if (!codecOrCb || typeof codecOrCb === "function") {
932
937
  return this.client.subscribe(
@@ -1016,6 +1021,10 @@ var Stream = class {
1016
1021
  request(subject, data, timeoutMs) {
1017
1022
  return this.client.request(this.name, subject, data, timeoutMs);
1018
1023
  }
1024
+ /** Tombstone a single message by seq. Returns true if found. */
1025
+ deleteMessage(seq) {
1026
+ return this.client.deleteMessage(this.name, seq);
1027
+ }
1019
1028
  // ── Context factories ───────────────────────────────────────────────────
1020
1029
  consumer(overrides) {
1021
1030
  const config = {
@@ -1291,8 +1300,8 @@ var ArbitroClient = class {
1291
1300
  */
1292
1301
  async publishDelayed(streamName, subject, data, delayMs) {
1293
1302
  const sid = await this.resolveStreamId(streamName);
1294
- const { packPublishDelayed: packPublishDelayed2 } = await import("./publish-BSVUMN7T.mjs");
1295
- const { Flag: Flag3 } = await import("./constants-57DO6N3H.mjs");
1303
+ const { packPublishDelayed: packPublishDelayed2 } = await import("./publish-NKAK5BOA.mjs");
1304
+ const { Flag: Flag3 } = await import("./constants-LWTWKOBZ.mjs");
1296
1305
  const subj = Buffer.from(this.prefixed(subject));
1297
1306
  await this.conn.sendExpectReply(
1298
1307
  packPublishDelayed2(this.conn.nextSeq(), sid, subj, data, BigInt(delayMs), Flag3.AckReq)
@@ -1399,6 +1408,19 @@ var ArbitroClient = class {
1399
1408
  );
1400
1409
  return Number(refSeq);
1401
1410
  }
1411
+ /**
1412
+ * Tombstone a single message by sequence number.
1413
+ *
1414
+ * The broker marks the entry as deleted — it will never be delivered
1415
+ * to any consumer. Returns `true` if the message was found and
1416
+ * tombstoned, `false` if not found or already tombstoned.
1417
+ */
1418
+ async deleteMessage(streamName, seq) {
1419
+ const refSeq = await this.conn.sendExpectReply(
1420
+ packDeleteMessage(this.conn.nextSeq(), Buffer.from(streamName), seq)
1421
+ );
1422
+ return refSeq > 0n;
1423
+ }
1402
1424
  // ── Consumer management ───────────────────────────────────────────────────
1403
1425
  async createConsumer(streamName, config) {
1404
1426
  const consumerId = await this.createConsumerRaw(streamName, config);