





















@@ -48,6 +48,18 @@ const WhatsAppAckReactionSchema = z
4848.strict()
4949.optional();
505051+function stripDeprecatedWhatsAppNoopKeys(value: unknown): unknown {
52+if (!value || typeof value !== "object" || Array.isArray(value)) {
53+return value;
54+}
55+if (!Object.hasOwn(value, "exposeErrorText")) {
56+return value;
57+}
58+const next = { ...(value as Record<string, unknown>) };
59+delete next.exposeErrorText;
60+return next;
61+}
62+5163function buildWhatsAppCommonShape(params: { useDefaults: boolean }) {
5264return {
5365enabled: z.boolean().optional(),
@@ -130,7 +142,7 @@ function enforceAllowlistDmPolicyAllowFrom(params: {
130142});
131143}
132144133-export const WhatsAppAccountSchema = z
145+const WhatsAppAccountObjectSchema = z
134146.object({
135147 ...buildWhatsAppCommonShape({ useDefaults: false }),
136148name: z.string().optional(),
@@ -141,7 +153,12 @@ export const WhatsAppAccountSchema = z
141153})
142154.strict();
143155144-export const WhatsAppConfigSchema = z
156+export const WhatsAppAccountSchema = z.preprocess(
157+stripDeprecatedWhatsAppNoopKeys,
158+WhatsAppAccountObjectSchema,
159+);
160+161+const WhatsAppConfigObjectSchema = z
145162.object({
146163 ...buildWhatsAppCommonShape({ useDefaults: true }),
147164accounts: z.record(z.string(), WhatsAppAccountSchema.optional()).optional(),
@@ -206,3 +223,8 @@ export const WhatsAppConfigSchema = z
206223});
207224}
208225});
226+227+export const WhatsAppConfigSchema = z.preprocess(
228+stripDeprecatedWhatsAppNoopKeys,
229+WhatsAppConfigObjectSchema,
230+);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。