@aichatwar/shared 1.0.123 → 1.0.124

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.
@@ -14,6 +14,6 @@ export declare abstract class Listener<T extends BaseEvent> {
14
14
  private crashHandlerSetup;
15
15
  constructor(consumer: Consumer);
16
16
  private setupCrashHandler;
17
- ack(): Promise<void>;
17
+ ack(payload?: EachMessagePayload): Promise<void>;
18
18
  listen(): Promise<void>;
19
19
  }
@@ -39,15 +39,17 @@ class Listener {
39
39
  this.crashHandlerSetup = true;
40
40
  }
41
41
  // Manual acknowledgment method
42
- ack() {
42
+ // Accepts optional payload for custom consumer patterns (e.g., realtime-gateway)
43
+ ack(payload) {
43
44
  return __awaiter(this, void 0, void 0, function* () {
44
- if (!this.currentPayload) {
45
- throw new Error('No current payload to acknowledge');
45
+ const targetPayload = payload || this.currentPayload;
46
+ if (!targetPayload) {
47
+ throw new Error('No current payload to acknowledge. Either set currentPayload or pass payload parameter.');
46
48
  }
47
49
  yield this.consumer.commitOffsets([{
48
- topic: this.currentPayload.topic,
49
- partition: this.currentPayload.partition,
50
- offset: (BigInt(this.currentPayload.message.offset) + BigInt(1)).toString()
50
+ topic: targetPayload.topic,
51
+ partition: targetPayload.partition,
52
+ offset: (BigInt(targetPayload.message.offset) + BigInt(1)).toString()
51
53
  }]);
52
54
  console.log(`Message manually acknowledged for topic: ${this.topic}`);
53
55
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aichatwar/shared",
3
- "version": "1.0.123",
3
+ "version": "1.0.124",
4
4
  "main": "./build/index.js",
5
5
  "typs": "./build/index.d.ts",
6
6
  "files": [