Skip to content

Commit 94da0a9

Browse files
authored
refactor(whatsapp): localize internal types (#101959)
1 parent 22ae651 commit 94da0a9

8 files changed

Lines changed: 14 additions & 16 deletions

File tree

extensions/whatsapp/src/auto-reply/mentions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export type MentionConfig = {
2121
isSelfChat?: boolean;
2222
};
2323

24-
export type MentionTargets = {
24+
type MentionTargets = {
2525
normalizedMentions: WhatsAppIdentity[];
2626
self: WhatsAppIdentity;
2727
};

extensions/whatsapp/src/inbound-policy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import type { AdmittedWebInboundMessage } from "./inbound/types.js";
1919
import { resolveWhatsAppRuntimeGroupPolicy } from "./runtime-group-policy.js";
2020
import { isSelfChatMode, normalizeE164 } from "./text-runtime.js";
2121

22-
export type ResolvedWhatsAppInboundPolicy = {
22+
type ResolvedWhatsAppInboundPolicy = {
2323
account: ResolvedWhatsAppAccount;
2424
dmPolicy: DmPolicy;
2525
groupPolicy: GroupPolicy;

extensions/whatsapp/src/inbound/access-control.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { warnMissingProviderGroupPolicyFallbackOnce } from "openclaw/plugin-sdk/
77
import { resolveWhatsAppInboundPolicy, resolveWhatsAppIngressAccess } from "../inbound-policy.js";
88
import { buildWhatsAppInboundAdmission, type WhatsAppInboundAdmission } from "./admission.js";
99

10-
export type BlockedInboundAccessControlResult = {
10+
type BlockedInboundAccessControlResult = {
1111
allowed: false;
1212
shouldMarkRead: false;
1313
isSelfChat: boolean;

extensions/whatsapp/src/inbound/durable-receive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export type WhatsAppReadReceiptTarget = {
1717
participant?: string;
1818
};
1919

20-
export type SerializedWhatsAppDurableInboundMessage = PluginJsonValue;
20+
type SerializedWhatsAppDurableInboundMessage = PluginJsonValue;
2121

2222
export type WhatsAppDurableInboundPayload = {
2323
message: SerializedWhatsAppDurableInboundMessage;

extensions/whatsapp/src/inbound/monitor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ function resolveRetryableWhatsAppInboundError(
137137
return new WhatsAppRetryableInboundError(formatErrorMessage(error), { cause: error });
138138
}
139139
export type WhatsAppGroupMetadataCache = Map<string, WhatsAppGroupMetadataCacheEntry>;
140-
export type WhatsAppBaileysCacheEntry<T> = {
140+
type WhatsAppBaileysCacheEntry<T> = {
141141
expiresAt: number;
142142
value: T;
143143
};

extensions/whatsapp/src/inbound/test-message.test-helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import type {
1212
WhatsAppInboundPlatform,
1313
} from "./types.js";
1414

15-
export type TestWhatsAppInboundAdmissionOverrides = Partial<
15+
type TestWhatsAppInboundAdmissionOverrides = Partial<
1616
Omit<
1717
WhatsAppInboundAdmission,
1818
| "account"

extensions/whatsapp/src/qa-driver.runtime.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,28 @@ import {
1919
} from "./socket-timing.js";
2020
import { jidToE164 } from "./text-runtime.js";
2121

22-
export type WhatsAppQaDriverObservedMessageKind =
22+
type WhatsAppQaDriverObservedMessageKind =
2323
| "media"
2424
| "location"
2525
| "poll"
2626
| "reaction"
2727
| "text"
2828
| "unknown";
2929

30-
export type WhatsAppQaDriverQuotedMessage = {
30+
type WhatsAppQaDriverQuotedMessage = {
3131
messageId?: string;
3232
participant?: string;
3333
text?: string;
3434
};
3535

36-
export type WhatsAppQaDriverObservedReaction = {
36+
type WhatsAppQaDriverObservedReaction = {
3737
emoji: string;
3838
fromMe?: boolean;
3939
messageId?: string;
4040
participant?: string;
4141
};
4242

43-
export type WhatsAppQaDriverObservedPoll = {
43+
type WhatsAppQaDriverObservedPoll = {
4444
options: string[];
4545
question?: string;
4646
};
@@ -61,14 +61,14 @@ export type WhatsAppQaDriverObservedMessage = {
6161
text: string;
6262
};
6363

64-
export type WhatsAppQaDriverSendTextOptions = Pick<ActiveWebSendOptions, "quotedMessageKey">;
64+
type WhatsAppQaDriverSendTextOptions = Pick<ActiveWebSendOptions, "quotedMessageKey">;
6565

66-
export type WhatsAppQaDriverSendMediaOptions = Pick<
66+
type WhatsAppQaDriverSendMediaOptions = Pick<
6767
ActiveWebSendOptions,
6868
"asDocument" | "fileName" | "gifPlayback" | "quotedMessageKey"
6969
>;
7070

71-
export type WhatsAppQaDriverSendReactionOptions = {
71+
type WhatsAppQaDriverSendReactionOptions = {
7272
fromMe: boolean;
7373
participant?: string;
7474
};

extensions/whatsapp/src/resolve-outbound-target.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ import {
77
normalizeWhatsAppTarget,
88
} from "./normalize-target.js";
99

10-
export type WhatsAppOutboundTargetResolution =
11-
| { ok: true; to: string }
12-
| { ok: false; error: Error };
10+
type WhatsAppOutboundTargetResolution = { ok: true; to: string } | { ok: false; error: Error };
1311

1412
function whatsappAllowFromPolicyError(target: string): Error {
1513
return new Error(`Target "${target}" is not listed in the configured WhatsApp allowFrom policy.`);

0 commit comments

Comments
 (0)