From fb6ed2752576e548be39761a7c0b8d1422263f29 Mon Sep 17 00:00:00 2001 From: Reversean Date: Mon, 1 Jun 2026 20:14:54 +0300 Subject: [PATCH] feat: optional count fields added MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds an optional count field used by the client-side debounce feature to merge repeated occurrences of the same error within a short time window into a single network message, while still tracking how many real occurrences it represents. - CatcherMessage.count — set by Catcher SDK on the message sent to Collector - RepetitionDBScheme.count — set by the grouper worker on the stored repetition, carrying the same number through to API/Garage Both fields are optional; absent or 1 means a single occurrence — no behavior change for clients/data that don't use debounce. --- build/src/catchers/catcher-message.d.ts | 5 +++++ build/src/dbScheme/repetition.d.ts | 6 ++++++ package.json | 2 +- src/catchers/catcher-message.ts | 6 ++++++ src/dbScheme/repetition.ts | 7 +++++++ 5 files changed, 25 insertions(+), 1 deletion(-) diff --git a/build/src/catchers/catcher-message.d.ts b/build/src/catchers/catcher-message.d.ts index 5cd3b49..1caa249 100644 --- a/build/src/catchers/catcher-message.d.ts +++ b/build/src/catchers/catcher-message.d.ts @@ -63,6 +63,11 @@ export interface CatcherMessage { * All information about the event */ payload: CatcherMessagePayload; + /** + * Number of identical occurrences this message represents. + * Computed on Catcher side to dedupe similar events caused in the same time. + */ + count?: number; } /** * Type that represents a Catcher message accepted by the collector diff --git a/build/src/dbScheme/repetition.d.ts b/build/src/dbScheme/repetition.d.ts index e0601b1..e7b5fae 100644 --- a/build/src/dbScheme/repetition.d.ts +++ b/build/src/dbScheme/repetition.d.ts @@ -29,6 +29,12 @@ export interface RepetitionDBScheme { * (created by the Collector) */ timestamp: number; + /** + * Number of real client-side occurrences merged into this single repetition + * by Catcher-side debounce (see CatcherMessage.count). + * Absent or 1 — this repetition represents a single occurrence. + */ + count?: number; } /** * Repetition with decoded event data diff --git a/package.json b/package.json index 9b8df56..ca1136c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hawk.so/types", - "version": "0.6.3", + "version": "0.6.4", "description": "TypeScript definitions for Hawk", "types": "build/index.d.ts", "main": "build/index.js", diff --git a/src/catchers/catcher-message.ts b/src/catchers/catcher-message.ts index 845e88e..0fbb118 100644 --- a/src/catchers/catcher-message.ts +++ b/src/catchers/catcher-message.ts @@ -83,6 +83,12 @@ export interface CatcherMessage { * All information about the event */ payload: CatcherMessagePayload; + + /** + * Number of identical occurrences this message represents. + * Computed on Catcher side to dedupe similar events caused in the same time. + */ + count?: number; } /** diff --git a/src/dbScheme/repetition.ts b/src/dbScheme/repetition.ts index bd659d7..576efdf 100644 --- a/src/dbScheme/repetition.ts +++ b/src/dbScheme/repetition.ts @@ -34,6 +34,13 @@ export interface RepetitionDBScheme { * (created by the Collector) */ timestamp: number; + + /** + * Number of real client-side occurrences merged into this single repetition + * by Catcher-side debounce (see CatcherMessage.count). + * Absent or 1 — this repetition represents a single occurrence. + */ + count?: number; } /**