fix: tighten inbound replay typing

This commit is contained in:
Peter Steinberger
2026-04-13 08:23:26 -07:00
parent 63965dc70b
commit c09031f15a
3 changed files with 25 additions and 25 deletions

View File

@@ -99,13 +99,14 @@ describe("createNextcloudTalkWebhookServer replay handling", () => {
stateDir: params.stateDir,
});
return async (message: NextcloudTalkInboundMessage) =>
return async (message: NextcloudTalkInboundMessage): Promise<void> => {
await processNextcloudTalkReplayGuardedMessage({
replayGuard,
accountId: params.accountId ?? "acct",
message,
handleMessage: () => params.handleMessage(message),
});
};
}
it("acknowledges replayed requests and skips onMessage side effects", async () => {

View File

@@ -46,6 +46,10 @@ function shouldClearSocketRefAfterSendFailure(err: unknown): boolean {
return /closed|reset|disconnect|no active socket/i.test(formatError(err));
}
function isNonEmptyString(value: string | undefined): value is string {
return Boolean(value);
}
export type MonitorWebInboxOptions = {
verbose: boolean;
accountId: string;
@@ -132,11 +136,7 @@ export async function attachWebInboxToSocket(
error?: unknown,
): Promise<void> => {
const dedupeKeys = [
...new Set(
entries
.map((entry) => entry.dedupeKey)
.filter((dedupeKey): dedupeKey is string => Boolean(dedupeKey)),
),
...new Set(entries.map((entry) => entry.dedupeKey).filter(isNonEmptyString)),
];
if (dedupeKeys.length === 0) {
return;