@open-wa/schema 5.0.0 → 5.2.0

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.
Files changed (74) hide show
  1. package/dist/generated/index.cjs +8 -2
  2. package/dist/generated/index.cjs.map +1 -1
  3. package/dist/generated/index.d.cts +7868 -994
  4. package/dist/generated/index.d.cts.map +1 -1
  5. package/dist/generated/index.d.mts +7868 -994
  6. package/dist/generated/index.d.mts.map +1 -1
  7. package/dist/generated/index.mjs +8 -2
  8. package/dist/generated/index.mjs.map +1 -1
  9. package/dist/index-C9Ad0lEr.d.cts +4729 -0
  10. package/dist/index-C9Ad0lEr.d.cts.map +1 -0
  11. package/dist/index-D0QN2PaW.d.mts +4729 -0
  12. package/dist/index-D0QN2PaW.d.mts.map +1 -0
  13. package/dist/index.cjs +109 -1
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +2 -2
  16. package/dist/index.d.mts +2 -2
  17. package/dist/index.mjs +53 -2
  18. package/dist/index.mjs.map +1 -1
  19. package/dist/methods/index.cjs +6 -1
  20. package/dist/methods/index.d.cts +2 -2
  21. package/dist/methods/index.d.mts +2 -2
  22. package/dist/methods/index.mjs +2 -2
  23. package/dist/{methods-Dizm7Fn9.cjs → methods-BGmdzjd3.cjs} +904 -76
  24. package/dist/methods-BGmdzjd3.cjs.map +1 -0
  25. package/dist/{methods-CZqeUhKy.mjs → methods-BhLsQNtL.mjs} +587 -77
  26. package/dist/methods-BhLsQNtL.mjs.map +1 -0
  27. package/package.json +4 -3
  28. package/src/__tests__/generators.contract.test.ts +181 -0
  29. package/src/__tests__/registry.contract.test.ts +81 -0
  30. package/src/client-config.ts +30 -0
  31. package/src/codecs.test.ts +41 -0
  32. package/src/codecs.ts +191 -0
  33. package/src/common-types.ts +287 -0
  34. package/src/config.ts +47 -0
  35. package/src/enums.ts +63 -0
  36. package/src/events/groups.ts +33 -0
  37. package/src/events/index.ts +4 -0
  38. package/src/events/messaging.ts +86 -0
  39. package/src/events/registry.ts +124 -0
  40. package/src/events/state.ts +59 -0
  41. package/src/generated/AliasMap.ts +216 -0
  42. package/src/generated/BaseClient.ts +878 -0
  43. package/src/generated/BaseNamespacedClient.ts +214 -0
  44. package/src/generated/index.ts +5 -0
  45. package/src/generated/openapi.json +30049 -0
  46. package/src/generated/types.ts +383 -0
  47. package/src/http-manifest.ts +97 -0
  48. package/src/implementor.test.ts +88 -0
  49. package/src/implementor.ts +75 -0
  50. package/src/index.ts +46 -0
  51. package/src/interactive.ts +151 -0
  52. package/src/methods/business.ts +52 -0
  53. package/src/methods/chats.ts +264 -0
  54. package/src/methods/communities.ts +121 -0
  55. package/src/methods/contacts.ts +160 -0
  56. package/src/methods/groups.ts +378 -0
  57. package/src/methods/index.ts +34 -0
  58. package/src/methods/interactive.ts +21 -0
  59. package/src/methods/labels.ts +88 -0
  60. package/src/methods/media.ts +36 -0
  61. package/src/methods/messaging.ts +836 -0
  62. package/src/methods/session.ts +262 -0
  63. package/src/methods/status.ts +122 -0
  64. package/src/output-json-schema.ts +27 -0
  65. package/src/parameters.ts +237 -0
  66. package/src/registry.test.ts +30 -0
  67. package/src/registry.ts +601 -0
  68. package/src/return-types.ts +125 -0
  69. package/dist/index-BHcd0h7x.d.mts +0 -1265
  70. package/dist/index-BHcd0h7x.d.mts.map +0 -1
  71. package/dist/index-ChYFQM1K.d.cts +0 -1265
  72. package/dist/index-ChYFQM1K.d.cts.map +0 -1
  73. package/dist/methods-CZqeUhKy.mjs.map +0 -1
  74. package/dist/methods-Dizm7Fn9.cjs.map +0 -1
@@ -2,11 +2,17 @@ import { d as parameterRegistry, o as defineMethodV2 } from "./registry-BIddXpin
2
2
  import { z } from "zod";
3
3
  import { assertFile, getDUrl } from "@open-wa/utils";
4
4
  //#region src/common-types.ts
5
- const ContactIdSchema$1 = z.string().brand("ContactId");
6
- const ChatIdSchema$1 = z.string().brand("ChatId");
7
- const MessageIdSchema$1 = z.string().brand("MessageId");
8
- const GroupChatIdSchema = z.string().brand("GroupChatId");
9
- const GroupIdSchema$1 = z.string().brand("GroupId");
5
+ const ContactIdSchema$1 = z.string().brand("ContactId").describe("Opaque WhatsApp contact identifier. Preserve the exact value returned by the API.");
6
+ const ChatIdSchema$1 = z.string().brand("ChatId").describe("Opaque conversation identifier. Use the exact value returned by a message event or chat lookup.");
7
+ const MessageIdSchema$1 = z.string().brand("MessageId").describe("Message identifier returned by a send method or message event.");
8
+ const GroupChatIdSchema = z.string().brand("GroupChatId").describe("Opaque group conversation identifier returned by a group lookup or join method.");
9
+ const GroupIdSchema$1 = z.string().brand("GroupId").describe("Identifier for a WhatsApp group. Use the value returned by the API.");
10
+ const DataURLSchema = z.templateLiteral([
11
+ "data:",
12
+ z.string(),
13
+ ";base64,",
14
+ z.string()
15
+ ]);
10
16
  const GroupMetadataSchema = z.object({
11
17
  id: GroupIdSchema$1,
12
18
  subject: z.string(),
@@ -22,7 +28,7 @@ const GroupMetadataSchema = z.object({
22
28
  isAdmin: z.boolean(),
23
29
  isSuperAdmin: z.boolean().optional()
24
30
  }))
25
- }).passthrough();
31
+ }).passthrough().describe("Serialized group metadata returned by group lookups. Additional WhatsApp Web fields may be present.");
26
32
  const IdSchema = z.object({
27
33
  server: z.string(),
28
34
  user: z.string(),
@@ -192,7 +198,7 @@ const ContactSchema = z.object({
192
198
  isUser: z.boolean().optional(),
193
199
  isWAContact: z.boolean().optional(),
194
200
  labels: z.array(z.string()).optional(),
195
- msgs: z.array(z.any()).optional(),
201
+ msgs: z.array(z.unknown()).nullable().optional(),
196
202
  profilePicThumbObj: z.object({
197
203
  eurl: z.string().optional(),
198
204
  id: IdSchema.optional(),
@@ -215,28 +221,218 @@ const LocationSchema = z.object({
215
221
  url: z.string().optional().describe("WhatsApp location URL")
216
222
  }).passthrough();
217
223
  const ChatSchema = z.object({
218
- id: ContactIdSchema$1.or(GroupChatIdSchema),
224
+ id: ChatIdSchema$1,
219
225
  name: z.string().optional(),
220
226
  formattedTitle: z.string().optional(),
221
227
  isGroup: z.boolean(),
222
- contact: ContactSchema,
223
- groupMetadata: z.any().optional(),
224
- presence: z.any().optional(),
228
+ contact: ContactSchema.nullable(),
229
+ groupMetadata: GroupMetadataSchema.nullable().optional(),
230
+ presence: z.record(z.string(), z.unknown()).nullable().optional(),
225
231
  t: z.number().optional(),
226
232
  unreadCount: z.number().optional(),
227
233
  lastReceivedKey: z.any().optional(),
228
- msgs: z.array(z.any()).optional(),
234
+ msgs: z.array(z.unknown()).nullable().optional(),
229
235
  isReadOnly: z.boolean().optional(),
230
236
  muteExpiration: z.number().optional(),
231
237
  notSpam: z.boolean().optional(),
232
238
  pin: z.number().optional(),
233
239
  ack: z.any().optional()
234
- }).passthrough();
240
+ }).passthrough().describe("Serialized chat returned by chat lookups and listings. Its id is an opaque ChatId; additional WhatsApp Web fields may be present.");
235
241
  const MessageSchema = MessageSchemaBase.extend({
236
242
  sender: ContactSchema,
237
243
  chat: ChatSchema
238
244
  });
239
- const MessageIdReturnSchema = z.object({ _serialized: z.string() }).passthrough();
245
+ const SerializedMessageIdSchema = z.object({ _serialized: z.string() }).passthrough();
246
+ const MessageIdReturnSchema = z.union([MessageIdSchema$1, SerializedMessageIdSchema]).describe("A message ID as a string or an object containing the serialized ID. Validate it before passing it to another method.");
247
+ //#endregion
248
+ //#region src/return-types.ts
249
+ const LabelSchema = z.object({
250
+ id: z.string(),
251
+ name: z.string(),
252
+ items: z.array(z.object({
253
+ type: z.enum([
254
+ "Chat",
255
+ "Contact",
256
+ "Message"
257
+ ]),
258
+ id: z.string()
259
+ }))
260
+ }).passthrough();
261
+ const NumberCheckSchema = z.object({
262
+ id: z.union([IdSchema, ContactIdSchema$1]),
263
+ status: z.unknown().describe("HTTP-like status code, or a provider error value when lookup fails."),
264
+ isBusiness: z.boolean().optional(),
265
+ canReceiveMessage: z.boolean(),
266
+ numberExists: z.boolean().optional()
267
+ }).passthrough();
268
+ const CommonGroupSchema = z.object({
269
+ id: GroupIdSchema$1,
270
+ title: z.string()
271
+ }).passthrough();
272
+ const GroupCreationResultSchema = z.object({
273
+ gid: z.union([GroupIdSchema$1, IdSchema]),
274
+ status: z.number().optional(),
275
+ participants: z.union([z.record(z.string(), z.object({
276
+ code: z.number(),
277
+ invite_code: z.string().optional(),
278
+ invite_code_exp: z.string().optional()
279
+ })), z.array(z.record(z.string(), z.unknown()))]).optional()
280
+ }).passthrough();
281
+ const CommunityMetadataSchema = GroupMetadataSchema.extend({ subGroups: z.array(GroupMetadataSchema) });
282
+ const CommunityParticipantIdsSchema = z.object({
283
+ id: GroupChatIdSchema,
284
+ participants: z.array(ContactIdSchema$1),
285
+ subgroup: z.boolean()
286
+ });
287
+ const CommunityAdminIdsSchema = z.object({
288
+ id: GroupChatIdSchema,
289
+ admins: z.array(ContactIdSchema$1),
290
+ subgroup: z.boolean()
291
+ });
292
+ const CommunityParticipantsSchema = z.object({
293
+ id: GroupChatIdSchema,
294
+ participants: z.array(ContactSchema),
295
+ subgroup: z.boolean()
296
+ });
297
+ const CommunityAdminsSchema = z.object({
298
+ id: GroupChatIdSchema,
299
+ admins: z.array(ContactSchema),
300
+ subgroup: z.boolean()
301
+ });
302
+ const MessageInteractionSchema = z.object({
303
+ id: ContactIdSchema$1,
304
+ t: z.number()
305
+ });
306
+ const MessageInfoSchema = z.object({
307
+ id: MessageIdSchema$1,
308
+ deliveryRemaining: z.number(),
309
+ playedRemaining: z.number(),
310
+ readRemaining: z.number(),
311
+ delivery: z.array(MessageInteractionSchema),
312
+ read: z.array(MessageInteractionSchema),
313
+ played: z.array(MessageInteractionSchema)
314
+ }).passthrough();
315
+ const LLMMessageSchema = z.object({
316
+ role: z.enum(["user", "assistant"]),
317
+ content: z.string()
318
+ });
319
+ const ContactStatusSchema = z.object({
320
+ id: z.string(),
321
+ status: z.string()
322
+ });
323
+ const HostAccountSchema = z.object({ me: z.union([IdSchema, ContactIdSchema$1]) }).passthrough().describe("Host account attributes plus the current account ID. Additional WhatsApp Web attributes vary by version.");
324
+ const HealthCheckSchema = z.object({
325
+ queuedMessages: z.number().optional(),
326
+ state: z.string().optional(),
327
+ isPhoneDisconnected: z.boolean().optional(),
328
+ isHere: z.boolean().optional(),
329
+ wapiInjected: z.boolean().optional(),
330
+ online: z.boolean().optional(),
331
+ tryingToReachPhone: z.boolean().optional(),
332
+ retryingIn: z.number().optional(),
333
+ batteryLow: z.boolean().optional()
334
+ }).passthrough().describe("Browser health diagnostics. This is not the Easy API /health HTTP envelope.");
335
+ const LicenseTypeSchema = z.enum([
336
+ "CUSTOM",
337
+ "B2B_RESTRICTED_VOLUME_LICENSE",
338
+ "Insiders Program",
339
+ "Text Story License Key",
340
+ "Image Story License Key",
341
+ "Video Story License Key",
342
+ "Premium License Key",
343
+ "NONE"
344
+ ]);
345
+ const ProductSchema = z.object({
346
+ id: z.string(),
347
+ currency: z.string(),
348
+ name: z.string().optional(),
349
+ description: z.string().optional(),
350
+ isHidden: z.boolean().optional(),
351
+ catalogWid: z.string().optional(),
352
+ url: z.string().optional(),
353
+ availability: z.union([z.number(), z.literal("unknown")]).optional(),
354
+ reviewStatus: z.enum([
355
+ "NO_REVIEW",
356
+ "PENDING",
357
+ "REJECTED",
358
+ "APPROVED",
359
+ "OUTDATED"
360
+ ]).optional(),
361
+ imageCdnUrl: z.string().optional(),
362
+ imageCount: z.number().optional(),
363
+ additionalImageCdnUrl: z.array(z.string()).optional(),
364
+ priceAmount1000: z.number().optional(),
365
+ retailerId: z.string().optional(),
366
+ t: z.number().optional()
367
+ }).passthrough();
368
+ const CartItemSchema = z.object({
369
+ id: z.string(),
370
+ name: z.string(),
371
+ qty: z.number(),
372
+ thumbnailId: z.string(),
373
+ thumbnailUrl: z.string()
374
+ });
375
+ const OrderSchema = z.object({
376
+ id: z.string(),
377
+ createdAt: z.number(),
378
+ currency: z.string(),
379
+ products: z.array(CartItemSchema),
380
+ sellerJid: z.string(),
381
+ subtotal: z.string(),
382
+ total: z.string(),
383
+ message: MessageSchema.optional()
384
+ }).passthrough();
385
+ const BusinessProfileSchema = z.object({
386
+ id: ContactIdSchema$1,
387
+ tag: z.string().optional(),
388
+ description: z.string().optional(),
389
+ categories: z.array(z.object({
390
+ id: z.string(),
391
+ localized_display_name: z.string()
392
+ })).optional(),
393
+ profileOptions: z.object({
394
+ commerceExperience: z.enum([
395
+ "catalog",
396
+ "none",
397
+ "shop"
398
+ ]),
399
+ cartEnabled: z.boolean()
400
+ }).optional(),
401
+ email: z.string().optional(),
402
+ website: z.array(z.string()).optional(),
403
+ businessHours: z.object({
404
+ config: z.record(z.string(), z.object({
405
+ mode: z.enum([
406
+ "specific_hours",
407
+ "open_24h",
408
+ "appointment_only"
409
+ ]),
410
+ hours: z.array(z.array(z.number()))
411
+ })),
412
+ timezone: z.string()
413
+ }).optional(),
414
+ catalogStatus: z.string().optional(),
415
+ address: z.string().optional(),
416
+ fbPage: z.unknown().optional(),
417
+ igProfessional: z.unknown().optional(),
418
+ isProfileLinked: z.boolean().optional(),
419
+ coverPhoto: z.object({
420
+ id: z.string(),
421
+ url: z.string()
422
+ }).optional(),
423
+ latitude: z.number().optional(),
424
+ longitude: z.number().optional()
425
+ }).passthrough();
426
+ const FeatureFlagsSchema = z.record(z.string(), z.unknown()).describe("WhatsApp feature flags keyed by name. Values are provider-defined and must be narrowed before use.");
427
+ const ProcessStatsSchema = z.record(z.string(), z.unknown()).describe("Process diagnostics keyed by process ID. The provider controls each entry; no stable entry shape is guaranteed.");
428
+ const NumberProfileSchema = ContactSchema.partial().describe("Provisional number profile based on the public Contact fields. Fields are optional and additional provider fields are unknown. The licensed getNumberProfile payload has not been verified against this model.");
429
+ const StorySchema = MessageSchema.omit({
430
+ chat: true,
431
+ sender: true
432
+ }).extend({
433
+ chat: MessageSchema.shape.chat.nullable().optional(),
434
+ sender: ContactSchema.nullable().optional()
435
+ }).describe("Message-shaped status entry, based on the legacy story API. Chat and sender may be absent or null. The licensed getStories payload has not been verified against this model.");
240
436
  //#endregion
241
437
  //#region src/codecs.ts
242
438
  const chatIdPattern = /^\d+(-\d+)?@(c|g)\.us$|^\d+@lid$/;
@@ -454,18 +650,17 @@ const messageIdsParam = z.union([z.array(messageIdParam), messageIdParam]).descr
454
650
  keyAliases: ["messages"]
455
651
  });
456
652
  const mentionedJidListParam = z.array(contactIdParam).optional().describe("List of mentioned contact IDs").register(parameterRegistry, { example: ["447123456789@c.us", "441234567890@c.us"] });
457
- const messageOptionsParam = z.any().optional().describe("Additional message options").register(parameterRegistry, { example: {
458
- quotedMsg: "messageId",
459
- mentionedJidList: ["447123456789@c.us"]
460
- } });
653
+ const messageOptionsParam = z.unknown().optional().describe("Reserved for compatibility with legacy request shapes. The current sendText Client implementation ignores this argument; use reply() or sendTextWithMentions() for quoted replies and mentions.").register(parameterRegistry, { formatDescription: "Accepted as unknown for compatibility; currently ignored by sendText. Use reply() or sendTextWithMentions() for supported reply and mention behavior." });
461
654
  //#endregion
462
655
  //#region src/methods/messaging.ts
656
+ /** The normalized serialized message key returned by the public sendText client. */
657
+ const SendTextResultSchema = z.string().regex(/^(true|false)_[^\s_]+@[^\s_]+_[^\s]+$/).brand("MessageId").describe("Validated serialized message ID. This confirms the send returned an ID, not delivery or reading.");
463
658
  /**
464
659
  * Sends a text message to a chat
465
660
  */
466
661
  const sendText = defineMethodV2("sendText", {
467
662
  meta: {
468
- description: "Sends a text message to a chat",
663
+ description: "Sends a text message and returns a validated serialized message ID. The in-process Client throws SendTextError on failure. An unknown outcome means the message may have been sent: check the chat before retrying. Starting a chat with a new number requires an applied restricted or premium license.",
469
664
  action: "send",
470
665
  namespace: "messages",
471
666
  license: "none",
@@ -482,7 +677,7 @@ const sendText = defineMethodV2("sendText", {
482
677
  "content",
483
678
  "options"
484
679
  ],
485
- output: MessageIdReturnSchema.or(z.boolean()).or(z.string())
680
+ output: SendTextResultSchema
486
681
  });
487
682
  /**
488
683
  * Sends a text message with mentions
@@ -772,7 +967,7 @@ const sendContact = defineMethodV2("sendContact", {
772
967
  contactId: contactIdParam.or(z.array(contactIdParam))
773
968
  }),
774
969
  parameterOrder: ["to", "contactId"],
775
- output: MessageIdReturnSchema.or(z.boolean())
970
+ output: MessageIdReturnSchema.or(z.boolean()).or(z.void())
776
971
  });
777
972
  /**
778
973
  * Sends multiple contacts
@@ -1107,7 +1302,7 @@ const getMessageById = defineMethodV2("getMessageById", {
1107
1302
  },
1108
1303
  input: z.object({ messageId: messageIdParam }),
1109
1304
  parameterOrder: ["messageId"],
1110
- output: z.any()
1305
+ output: MessageSchema.nullable().or(z.literal(false))
1111
1306
  });
1112
1307
  /**
1113
1308
  * Retrieves all messages in the session
@@ -1131,7 +1326,7 @@ const getAllMessages = defineMethodV2("getAllMessages", {
1131
1326
  "includeMe",
1132
1327
  "includeNotifications"
1133
1328
  ],
1134
- output: z.array(z.any())
1329
+ output: z.array(MessageSchema)
1135
1330
  });
1136
1331
  const getMyLastMessage = defineMethodV2("getMyLastMessage", {
1137
1332
  meta: {
@@ -1144,7 +1339,7 @@ const getMyLastMessage = defineMethodV2("getMyLastMessage", {
1144
1339
  },
1145
1340
  input: z.object({ chatId: chatIdParam.optional() }),
1146
1341
  parameterOrder: ["chatId"],
1147
- output: z.any()
1342
+ output: MessageSchema.optional()
1148
1343
  });
1149
1344
  const getStarredMessages = defineMethodV2("getStarredMessages", {
1150
1345
  meta: {
@@ -1157,7 +1352,7 @@ const getStarredMessages = defineMethodV2("getStarredMessages", {
1157
1352
  },
1158
1353
  input: z.object({ chatId: chatIdParam.optional() }),
1159
1354
  parameterOrder: ["chatId"],
1160
- output: z.array(z.any())
1355
+ output: z.array(MessageSchema)
1161
1356
  });
1162
1357
  const getUnsentMessages = defineMethodV2("getUnsentMessages", {
1163
1358
  meta: {
@@ -1170,7 +1365,7 @@ const getUnsentMessages = defineMethodV2("getUnsentMessages", {
1170
1365
  },
1171
1366
  input: z.object({}),
1172
1367
  parameterOrder: [],
1173
- output: z.array(z.any())
1368
+ output: z.array(MessageSchema)
1174
1369
  });
1175
1370
  const getMessageInfo = defineMethodV2("getMessageInfo", {
1176
1371
  meta: {
@@ -1183,7 +1378,7 @@ const getMessageInfo = defineMethodV2("getMessageInfo", {
1183
1378
  },
1184
1379
  input: z.object({ messageId: messageIdParam }),
1185
1380
  parameterOrder: ["messageId"],
1186
- output: z.any()
1381
+ output: MessageInfoSchema
1187
1382
  });
1188
1383
  const getVCards = defineMethodV2("getVCards", {
1189
1384
  meta: {
@@ -1214,7 +1409,7 @@ const getMessagesForLLM = defineMethodV2("getMessagesForLLM", {
1214
1409
  last: z.number().optional().default(10)
1215
1410
  }),
1216
1411
  parameterOrder: ["chatId", "last"],
1217
- output: z.any()
1412
+ output: z.array(LLMMessageSchema)
1218
1413
  });
1219
1414
  const starMessage = defineMethodV2("starMessage", {
1220
1415
  meta: {
@@ -1294,7 +1489,7 @@ const loadEarlierMessages = defineMethodV2("loadEarlierMessages", {
1294
1489
  "count",
1295
1490
  "includeMe"
1296
1491
  ],
1297
- output: z.array(z.any())
1492
+ output: z.array(MessageSchema)
1298
1493
  });
1299
1494
  const sendFileFromUrl = defineMethodV2("sendFileFromUrl", {
1300
1495
  meta: {
@@ -1325,7 +1520,7 @@ const sendFileFromUrl = defineMethodV2("sendFileFromUrl", {
1325
1520
  //#region src/methods/chats.ts
1326
1521
  const getAllChats = defineMethodV2("getAllChats", {
1327
1522
  meta: {
1328
- description: "Retrieves all chats",
1523
+ description: "Returns serialized Chat objects from the current session, optionally limited to chats with unread messages.",
1329
1524
  action: "read",
1330
1525
  namespace: "chats",
1331
1526
  license: "none",
@@ -1334,7 +1529,7 @@ const getAllChats = defineMethodV2("getAllChats", {
1334
1529
  },
1335
1530
  input: z.object({ withNewMessagesOnly: withNewMessagesOnlyParam }),
1336
1531
  parameterOrder: ["withNewMessagesOnly"],
1337
- output: z.array(z.any())
1532
+ output: z.array(ChatSchema)
1338
1533
  });
1339
1534
  const getAllChatIds = defineMethodV2("getAllChatIds", {
1340
1535
  meta: {
@@ -1348,7 +1543,7 @@ const getAllChatIds = defineMethodV2("getAllChatIds", {
1348
1543
  },
1349
1544
  input: z.object({}),
1350
1545
  parameterOrder: [],
1351
- output: z.array(z.string())
1546
+ output: z.array(ChatIdSchema$1)
1352
1547
  });
1353
1548
  const getChat = defineMethodV2("getChat", {
1354
1549
  meta: {
@@ -1362,7 +1557,7 @@ const getChat = defineMethodV2("getChat", {
1362
1557
  },
1363
1558
  input: z.object({ chatId: chatIdParam }),
1364
1559
  parameterOrder: ["chatId"],
1365
- output: z.any()
1560
+ output: ChatSchema.nullable().optional().or(z.literal(false))
1366
1561
  });
1367
1562
  const getChatWithNonContacts = defineMethodV2("getChatWithNonContacts", {
1368
1563
  meta: {
@@ -1375,7 +1570,7 @@ const getChatWithNonContacts = defineMethodV2("getChatWithNonContacts", {
1375
1570
  },
1376
1571
  input: z.object({}),
1377
1572
  parameterOrder: [],
1378
- output: z.array(z.any())
1573
+ output: z.array(ContactSchema)
1379
1574
  });
1380
1575
  const archiveChat = defineMethodV2("archiveChat", {
1381
1576
  meta: {
@@ -1562,7 +1757,7 @@ const getAllContacts = defineMethodV2("getAllContacts", {
1562
1757
  },
1563
1758
  input: z.object({}),
1564
1759
  parameterOrder: [],
1565
- output: z.array(z.any())
1760
+ output: z.array(ContactSchema)
1566
1761
  });
1567
1762
  const getContact = defineMethodV2("getContact", {
1568
1763
  meta: {
@@ -1575,7 +1770,7 @@ const getContact = defineMethodV2("getContact", {
1575
1770
  },
1576
1771
  input: z.object({ contactId: contactIdParam }),
1577
1772
  parameterOrder: ["contactId"],
1578
- output: z.any()
1773
+ output: ContactSchema.nullable()
1579
1774
  });
1580
1775
  const getCommonGroups = defineMethodV2("getCommonGroups", {
1581
1776
  meta: {
@@ -1588,7 +1783,7 @@ const getCommonGroups = defineMethodV2("getCommonGroups", {
1588
1783
  },
1589
1784
  input: z.object({ contactId: contactIdParam }),
1590
1785
  parameterOrder: ["contactId"],
1591
- output: z.any()
1786
+ output: z.array(CommonGroupSchema).or(z.literal(false))
1592
1787
  });
1593
1788
  const getNumberProfile = defineMethodV2("getNumberProfile", {
1594
1789
  meta: {
@@ -1601,7 +1796,7 @@ const getNumberProfile = defineMethodV2("getNumberProfile", {
1601
1796
  },
1602
1797
  input: z.object({ contactId: contactIdParam }),
1603
1798
  parameterOrder: ["contactId"],
1604
- output: z.any()
1799
+ output: NumberProfileSchema
1605
1800
  });
1606
1801
  const getBlockedIds = defineMethodV2("getBlockedIds", {
1607
1802
  meta: {
@@ -1614,7 +1809,7 @@ const getBlockedIds = defineMethodV2("getBlockedIds", {
1614
1809
  },
1615
1810
  input: z.object({}),
1616
1811
  parameterOrder: [],
1617
- output: z.array(z.string())
1812
+ output: z.array(ContactIdSchema$1).or(z.literal(false))
1618
1813
  });
1619
1814
  const blockContact = defineMethodV2("blockContact", {
1620
1815
  meta: {
@@ -1671,7 +1866,7 @@ const checkNumberStatus = defineMethodV2("checkNumberStatus", {
1671
1866
  },
1672
1867
  input: z.object({ contactId: contactIdParam }),
1673
1868
  parameterOrder: ["contactId"],
1674
- output: z.any()
1869
+ output: NumberCheckSchema
1675
1870
  });
1676
1871
  const getProfilePicture = defineMethodV2("getProfilePicture", {
1677
1872
  meta: {
@@ -1701,7 +1896,7 @@ const getGroupMembers = defineMethodV2("getGroupMembers", {
1701
1896
  },
1702
1897
  input: z.object({ groupId: groupIdParam }),
1703
1898
  parameterOrder: ["groupId"],
1704
- output: z.array(z.any())
1899
+ output: z.array(ContactSchema)
1705
1900
  });
1706
1901
  const getAllGroups = defineMethodV2("getAllGroups", {
1707
1902
  meta: {
@@ -1714,7 +1909,7 @@ const getAllGroups = defineMethodV2("getAllGroups", {
1714
1909
  },
1715
1910
  input: z.object({ withNewMessagesOnly: withNewMessagesOnlyParam }),
1716
1911
  parameterOrder: ["withNewMessagesOnly"],
1717
- output: z.array(z.any())
1912
+ output: z.array(ChatSchema)
1718
1913
  });
1719
1914
  const getGroupMembersId = defineMethodV2("getGroupMembersId", {
1720
1915
  meta: {
@@ -1731,7 +1926,7 @@ const getGroupMembersId = defineMethodV2("getGroupMembersId", {
1731
1926
  },
1732
1927
  input: z.object({ groupId: groupIdParam }),
1733
1928
  parameterOrder: ["groupId"],
1734
- output: z.array(z.string())
1929
+ output: z.array(ContactIdSchema$1)
1735
1930
  });
1736
1931
  const getGroupInfo = defineMethodV2("getGroupInfo", {
1737
1932
  meta: {
@@ -1744,7 +1939,7 @@ const getGroupInfo = defineMethodV2("getGroupInfo", {
1744
1939
  },
1745
1940
  input: z.object({ groupId: groupIdParam }),
1746
1941
  parameterOrder: ["groupId"],
1747
- output: z.any()
1942
+ output: GroupMetadataSchema.nullable()
1748
1943
  });
1749
1944
  const getGroupAdmins = defineMethodV2("getGroupAdmins", {
1750
1945
  meta: {
@@ -1757,7 +1952,7 @@ const getGroupAdmins = defineMethodV2("getGroupAdmins", {
1757
1952
  },
1758
1953
  input: z.object({ groupId: groupIdParam }),
1759
1954
  parameterOrder: ["groupId"],
1760
- output: z.array(z.any())
1955
+ output: z.array(ContactIdSchema$1)
1761
1956
  });
1762
1957
  const getKickedGroups = defineMethodV2("getKickedGroups", {
1763
1958
  meta: {
@@ -1770,7 +1965,7 @@ const getKickedGroups = defineMethodV2("getKickedGroups", {
1770
1965
  },
1771
1966
  input: z.object({}),
1772
1967
  parameterOrder: [],
1773
- output: z.array(z.string())
1968
+ output: z.array(GroupChatIdSchema)
1774
1969
  });
1775
1970
  const getGroupInviteLink = defineMethodV2("getGroupInviteLink", {
1776
1971
  meta: {
@@ -1799,7 +1994,7 @@ const createGroup = defineMethodV2("createGroup", {
1799
1994
  contacts: z.array(contactIdParam).describe("Contact IDs to add")
1800
1995
  }),
1801
1996
  parameterOrder: ["name", "contacts"],
1802
- output: z.any()
1997
+ output: GroupCreationResultSchema.nullable()
1803
1998
  });
1804
1999
  const leaveGroup = defineMethodV2("leaveGroup", {
1805
2000
  meta: {
@@ -1812,7 +2007,7 @@ const leaveGroup = defineMethodV2("leaveGroup", {
1812
2007
  },
1813
2008
  input: z.object({ groupId: groupIdParam }),
1814
2009
  parameterOrder: ["groupId"],
1815
- output: z.any()
2010
+ output: z.void()
1816
2011
  });
1817
2012
  const joinGroupViaLink = defineMethodV2("joinGroupViaLink", {
1818
2013
  meta: {
@@ -1833,10 +2028,10 @@ const joinGroupViaLink = defineMethodV2("joinGroupViaLink", {
1833
2028
  }),
1834
2029
  parameterOrder: ["link", "returnChatObj"],
1835
2030
  output: z.union([
1836
- z.string(),
2031
+ GroupChatIdSchema,
1837
2032
  z.boolean(),
1838
2033
  z.number(),
1839
- z.any()
2034
+ ChatSchema
1840
2035
  ])
1841
2036
  });
1842
2037
  const revokeGroupInviteLink = defineMethodV2("revokeGroupInviteLink", {
@@ -2050,7 +2245,7 @@ const getAllCommunities = defineMethodV2("getAllCommunities", {
2050
2245
  },
2051
2246
  input: z.object({}),
2052
2247
  parameterOrder: [],
2053
- output: z.array(z.string())
2248
+ output: z.array(GroupChatIdSchema)
2054
2249
  });
2055
2250
  /**
2056
2251
  * Get community info
@@ -2066,7 +2261,7 @@ const getCommunityInfo = defineMethodV2("getCommunityInfo", {
2066
2261
  },
2067
2262
  input: z.object({ communityId: communityIdParam }),
2068
2263
  parameterOrder: ["communityId"],
2069
- output: z.any()
2264
+ output: CommunityMetadataSchema
2070
2265
  });
2071
2266
  /**
2072
2267
  * Get community participant IDs
@@ -2082,7 +2277,7 @@ const getCommunityParticipantIds = defineMethodV2("getCommunityParticipantIds",
2082
2277
  },
2083
2278
  input: z.object({ communityId: communityIdParam }),
2084
2279
  parameterOrder: ["communityId"],
2085
- output: z.any()
2280
+ output: z.array(CommunityParticipantIdsSchema)
2086
2281
  });
2087
2282
  /**
2088
2283
  * Get community admin IDs
@@ -2098,7 +2293,7 @@ const getCommunityAdminIds = defineMethodV2("getCommunityAdminIds", {
2098
2293
  },
2099
2294
  input: z.object({ communityId: communityIdParam }),
2100
2295
  parameterOrder: ["communityId"],
2101
- output: z.any()
2296
+ output: z.array(CommunityAdminIdsSchema)
2102
2297
  });
2103
2298
  /**
2104
2299
  * Get community participants
@@ -2114,7 +2309,7 @@ const getCommunityParticipants = defineMethodV2("getCommunityParticipants", {
2114
2309
  },
2115
2310
  input: z.object({ communityId: communityIdParam }),
2116
2311
  parameterOrder: ["communityId"],
2117
- output: z.any()
2312
+ output: z.array(CommunityParticipantsSchema)
2118
2313
  });
2119
2314
  /**
2120
2315
  * Get community admins
@@ -2130,7 +2325,7 @@ const getCommunityAdmins = defineMethodV2("getCommunityAdmins", {
2130
2325
  },
2131
2326
  input: z.object({ communityId: communityIdParam }),
2132
2327
  parameterOrder: ["communityId"],
2133
- output: z.any()
2328
+ output: z.array(CommunityAdminsSchema)
2134
2329
  });
2135
2330
  //#endregion
2136
2331
  //#region src/methods/status.ts
@@ -2153,7 +2348,7 @@ const postTextStatus = defineMethodV2("postTextStatus", {
2153
2348
  "backgroundColor",
2154
2349
  "font"
2155
2350
  ],
2156
- output: z.any()
2351
+ output: MessageIdSchema$1.or(z.string()).or(z.boolean())
2157
2352
  });
2158
2353
  const postImageStatus = defineMethodV2("postImageStatus", {
2159
2354
  meta: {
@@ -2169,7 +2364,7 @@ const postImageStatus = defineMethodV2("postImageStatus", {
2169
2364
  caption: z.string().optional().describe("Status caption")
2170
2365
  }),
2171
2366
  parameterOrder: ["image", "caption"],
2172
- output: z.any()
2367
+ output: MessageIdSchema$1.or(z.string()).or(z.boolean())
2173
2368
  });
2174
2369
  const postVideoStatus = defineMethodV2("postVideoStatus", {
2175
2370
  meta: {
@@ -2185,7 +2380,7 @@ const postVideoStatus = defineMethodV2("postVideoStatus", {
2185
2380
  caption: z.string().optional().describe("Status caption")
2186
2381
  }),
2187
2382
  parameterOrder: ["video", "caption"],
2188
- output: z.any()
2383
+ output: MessageIdSchema$1.or(z.string()).or(z.boolean())
2189
2384
  });
2190
2385
  const getStories = defineMethodV2("getStories", {
2191
2386
  meta: {
@@ -2202,7 +2397,7 @@ const getStories = defineMethodV2("getStories", {
2202
2397
  },
2203
2398
  input: z.object({}),
2204
2399
  parameterOrder: [],
2205
- output: z.array(z.any())
2400
+ output: z.array(StorySchema)
2206
2401
  });
2207
2402
  const getStatus = defineMethodV2("getStatus", {
2208
2403
  meta: {
@@ -2215,7 +2410,7 @@ const getStatus = defineMethodV2("getStatus", {
2215
2410
  },
2216
2411
  input: z.object({ contactId: contactIdParam }),
2217
2412
  parameterOrder: ["contactId"],
2218
- output: z.any()
2413
+ output: ContactStatusSchema
2219
2414
  });
2220
2415
  const deleteStatus = defineMethodV2("deleteStatus", {
2221
2416
  meta: {
@@ -2228,7 +2423,7 @@ const deleteStatus = defineMethodV2("deleteStatus", {
2228
2423
  },
2229
2424
  input: z.object({ statusesToDelete: z.union([z.string(), z.array(z.string())]).describe("Status ID(s)") }),
2230
2425
  parameterOrder: ["statusesToDelete"],
2231
- output: z.any()
2426
+ output: z.boolean()
2232
2427
  });
2233
2428
  const deleteAllStatus = defineMethodV2("deleteAllStatus", {
2234
2429
  meta: {
@@ -2242,7 +2437,7 @@ const deleteAllStatus = defineMethodV2("deleteAllStatus", {
2242
2437
  },
2243
2438
  input: z.object({}),
2244
2439
  parameterOrder: [],
2245
- output: z.any()
2440
+ output: z.boolean()
2246
2441
  });
2247
2442
  //#endregion
2248
2443
  //#region src/methods/labels.ts
@@ -2260,7 +2455,7 @@ const getAllLabels = defineMethodV2("getAllLabels", {
2260
2455
  },
2261
2456
  input: z.object({}),
2262
2457
  parameterOrder: [],
2263
- output: z.array(z.any())
2458
+ output: z.array(LabelSchema)
2264
2459
  });
2265
2460
  /**
2266
2461
  * Get chats by label
@@ -2277,7 +2472,7 @@ const getChatsByLabel = defineMethodV2("getChatsByLabel", {
2277
2472
  },
2278
2473
  input: z.object({ label: z.string().describe("Label name") }),
2279
2474
  parameterOrder: ["label"],
2280
- output: z.array(z.any())
2475
+ output: z.array(ChatSchema)
2281
2476
  });
2282
2477
  /**
2283
2478
  * Add label
@@ -2330,7 +2525,7 @@ const getBusinessProfile = defineMethodV2("getBusinessProfile", {
2330
2525
  },
2331
2526
  input: z.object({ contactId: contactIdParam }),
2332
2527
  parameterOrder: ["contactId"],
2333
- output: z.any()
2528
+ output: BusinessProfileSchema
2334
2529
  });
2335
2530
  const getBusinessProducts = defineMethodV2("getBusinessProducts", {
2336
2531
  meta: {
@@ -2345,7 +2540,7 @@ const getBusinessProducts = defineMethodV2("getBusinessProducts", {
2345
2540
  },
2346
2541
  input: z.object({ contactId: contactIdParam }),
2347
2542
  parameterOrder: ["contactId"],
2348
- output: z.any()
2543
+ output: z.array(ProductSchema).or(z.literal(false))
2349
2544
  });
2350
2545
  const getOrder = defineMethodV2("getOrder", {
2351
2546
  meta: {
@@ -2358,7 +2553,7 @@ const getOrder = defineMethodV2("getOrder", {
2358
2553
  },
2359
2554
  input: z.object({ id: z.union([messageIdParam, z.string()]).describe("Order or message ID") }),
2360
2555
  parameterOrder: ["id"],
2361
- output: z.any()
2556
+ output: OrderSchema
2362
2557
  });
2363
2558
  //#endregion
2364
2559
  //#region src/methods/session.ts
@@ -2373,7 +2568,7 @@ const getMe = defineMethodV2("getMe", {
2373
2568
  },
2374
2569
  input: z.object({}),
2375
2570
  parameterOrder: [],
2376
- output: z.any()
2571
+ output: HostAccountSchema
2377
2572
  });
2378
2573
  const getHostNumber = defineMethodV2("getHostNumber", {
2379
2574
  meta: {
@@ -2399,7 +2594,7 @@ const getConnectionState = defineMethodV2("getConnectionState", {
2399
2594
  },
2400
2595
  input: z.object({}),
2401
2596
  parameterOrder: [],
2402
- output: z.any()
2597
+ output: z.string()
2403
2598
  });
2404
2599
  const getWAVersion = defineMethodV2("getWAVersion", {
2405
2600
  meta: {
@@ -2454,7 +2649,7 @@ const getFeatures = defineMethodV2("getFeatures", {
2454
2649
  },
2455
2650
  input: z.object({}),
2456
2651
  parameterOrder: [],
2457
- output: z.any()
2652
+ output: FeatureFlagsSchema
2458
2653
  });
2459
2654
  const getLicenseType = defineMethodV2("getLicenseType", {
2460
2655
  meta: {
@@ -2467,7 +2662,7 @@ const getLicenseType = defineMethodV2("getLicenseType", {
2467
2662
  },
2468
2663
  input: z.object({}),
2469
2664
  parameterOrder: [],
2470
- output: z.union([z.any(), z.boolean()])
2665
+ output: LicenseTypeSchema.or(z.literal(false))
2471
2666
  });
2472
2667
  const getUserAgent = defineMethodV2("getUserAgent", {
2473
2668
  meta: {
@@ -2495,7 +2690,7 @@ const getProcessStats = defineMethodV2("getProcessStats", {
2495
2690
  },
2496
2691
  input: z.object({}),
2497
2692
  parameterOrder: [],
2498
- output: z.any()
2693
+ output: ProcessStatsSchema
2499
2694
  });
2500
2695
  const getLoadedMessageCount = defineMethodV2("getLoadedMessageCount", {
2501
2696
  meta: {
@@ -2545,7 +2740,7 @@ const healthCheck = defineMethodV2("healthCheck", {
2545
2740
  },
2546
2741
  input: z.object({}),
2547
2742
  parameterOrder: [],
2548
- output: z.any()
2743
+ output: HealthCheckSchema
2549
2744
  });
2550
2745
  const setMyName = defineMethodV2("setMyName", {
2551
2746
  meta: {
@@ -2609,7 +2804,7 @@ const decryptMedia = defineMethodV2("decryptMedia", {
2609
2804
  },
2610
2805
  input: z.object({ message: MessageSchema.describe("Message object containing media") }),
2611
2806
  parameterOrder: ["message"],
2612
- output: z.string().describe("Base64 encoded decrypted media")
2807
+ output: DataURLSchema
2613
2808
  });
2614
2809
  const downloadMedia = defineMethodV2("downloadMedia", {
2615
2810
  meta: {
@@ -2628,6 +2823,321 @@ const downloadMedia = defineMethodV2("downloadMedia", {
2628
2823
  output: z.string().describe("Path to the saved file")
2629
2824
  });
2630
2825
  //#endregion
2631
- export { rejectGroupJoinRequest as $, GroupIdSchema as $n, sendLinkWithAutoPreview as $t, postImageStatus as A, locationNameParam as An, MessageIdReturnSchema as Ar, unarchiveChat as At, approveGroupJoinRequest as B, stickerDataParam as Bn, getStarredMessages as Bt, getAllLabels as C, fileDataParam as Cn, ChatSchema as Cr, getChatWithNonContacts as Ct, deleteStatus as D, includeMeParam as Dn, IdSchema as Dr, muteChat as Dt, deleteAllStatus as E, imageDataParam as En, GroupMetadataSchema as Er, markAsUnread as Et, getCommunityAdmins as F, messageOptionsParam as Fn, getAllMessages as Ft, getGroupInfo as G, withNewMessagesOnlyParam as Gn, sendAdvancedButtons as Gt, demoteParticipant as H, userAgentParam as Hn, getVCards as Ht, getCommunityInfo as I, nameParam as In, getMessageById as It, getGroupMembersId as J, ChatIdSchema as Jn, sendButtons as Jt, getGroupInviteLink as K, Base64ToDataUrlSchema as Kn, sendAudio as Kt, getCommunityParticipantIds as L, onlyLocalParam as Ln, getMessageInfo as Lt, postVideoStatus as M, mentionedJidListParam as Mn, MessageTypes as Mr, unpinChat as Mt, getAllCommunities as N, messageIdParam as Nn, SimpleListener as Nr, deleteMessage as Nt, getStatus as O, includeNotificationsParam as On, LocationSchema as Or, pinChat as Ot, getCommunityAdminIds as P, messageIdsParam as Pn, forwardMessages as Pt, promoteParticipant as Q, GroupIdCodecSchema as Qn, sendImage as Qt, getCommunityParticipants as R, skipMyMessagesParam as Rn, getMessagesForLLM as Rt, addLabel as S, documentDataParam as Sn, urlToDataUrlCodec as Sr, getChat as St, removeLabel as T, groupIdParam as Tn, GroupChatIdSchema as Tr, markAsRead as Tt, getAllGroups as U, videoDataParam as Un, loadEarlierMessages as Ut, createGroup as V, toParam as Vn, getUnsentMessages as Vt, getGroupAdmins as W, waitForIdParam as Wn, react as Wt, joinGroupViaLink as X, ContactIdSchema as Xn, sendFile as Xt, getKickedGroups as Y, ContactIdCodecSchema as Yn, sendContact as Yt, leaveGroup as Z, FileToDataUrlSchema as Zn, sendFileFromUrl as Zt, setMyStatus as _, captionParam as _n, isoDatetimeToDate as _r, archiveChat as _t, getFeatures as a, sendPoll as an, UnixSecondsToDateSchema as ar, setGroupTitle as at, getBusinessProfile as b, contactIdParam as bn, unixMillisToDate as br, getAllChatIds as bt, getLoadedMessageCount as c, sendSeen as cn, contactIdCodec as cr, checkNumberStatus as ct, getSnapshot as d, sendVCard as dn, fileToBufferCodec as dr, getBlockedIds as dt, sendListMessage as en, HexColorSchema as er, removeParticipant as et, getUserAgent as f, sendVideoAsGif as fn, fileToDataUrlCodec as fr, getCommonGroups as ft, setMyName as g, audioDataParam as gn, hexColorCodec as gr, unblockContact as gt, isPlugged as h, unstarMessage as hn, groupIdCodec as hr, getProfilePicture as ht, getConnectionState as i, sendPaymentRequest as in, UnixMillisToDateSchema as ir, setGroupIcon as it, postTextStatus as j, longitudeParam as jn, MessageSchema as jr, unmuteChat as jt, getStories as k, latitudeParam as kn, MessageAck as kr, setChatEphemeral as kt, getMe as l, sendText as ln, createFileCodec as lr, checkReadReceipts as lt, healthCheck as m, starMessage as mn, fileToTempPathCodec as mr, getNumberProfile as mt, downloadMedia as n, sendMessageWithThumb as nn, MessageIdCodecSchema as nr, setGroupDescription as nt, getHostNumber as o, sendPtt as on, base64ToDataUrlCodec as or, setGroupToAdminsOnly as ot, getWAVersion as p, sendYouTubeLink as pn, fileToStreamCodec as pr, getContact as pt, getGroupMembers as q, ChatIdCodecSchema as qn, sendBanner as qt, getBatteryLevel as r, sendMultipleContacts as rn, MessageIdSchema as rr, setGroupEditToAdminsOnly as rt, getLicenseType as s, sendReplyWithMentions as sn, chatIdCodec as sr, blockContact as st, decryptMedia as t, sendLocation as tn, IsoDatetimeToDateSchema as tr, revokeGroupInviteLink as tt, getProcessStats as u, sendTextWithMentions as un, fileToBase64Codec as ur, getAllContacts as ut, setProfilePicture as v, chatIdParam as vn, jsonStringCodec as vr, clearChat as vt, getChatsByLabel as w, filenameParam as wn, ContactSchema as wr, isChatOnline as wt, getOrder as x, contentParam as xn, unixSecondsToDate as xr, getAllChats as xt, getBusinessProducts as y, communityIdParam as yn, messageIdCodec as yr, deleteChat as yt, addParticipant as z, statusTextParam as zn, getMyLastMessage as zt };
2826
+ //#region src/interactive.ts
2827
+ const JsonValueSchema = z.lazy(() => z.union([
2828
+ z.null(),
2829
+ z.boolean(),
2830
+ z.number().finite(),
2831
+ z.string(),
2832
+ z.array(JsonValueSchema),
2833
+ z.record(z.string(), JsonValueSchema)
2834
+ ]));
2835
+ const JsonObjectSchema = z.record(z.string(), JsonValueSchema);
2836
+ const text = z.string().min(1);
2837
+ const url = z.url().refine((value) => /^https?:\/\//i.test(value), "Use an HTTP or HTTPS URL");
2838
+ const id = text.describe("Stable application-defined ID returned when the recipient chooses this item");
2839
+ const ReplyActionSchema = z.object({
2840
+ type: z.literal("reply"),
2841
+ id,
2842
+ label: text
2843
+ }).strict();
2844
+ const LinkActionSchema = z.object({
2845
+ type: z.literal("url"),
2846
+ label: text,
2847
+ url
2848
+ }).strict();
2849
+ const CallActionSchema = z.object({
2850
+ type: z.literal("call"),
2851
+ label: text,
2852
+ phoneNumber: text
2853
+ }).strict();
2854
+ const CopyActionSchema = z.object({
2855
+ type: z.literal("copy"),
2856
+ label: text,
2857
+ code: text
2858
+ }).strict();
2859
+ const InteractiveActionSchema = z.discriminatedUnion("type", [
2860
+ ReplyActionSchema,
2861
+ LinkActionSchema,
2862
+ CallActionSchema,
2863
+ CopyActionSchema
2864
+ ]);
2865
+ const NativeActionSchema = z.object({
2866
+ name: text.describe("WhatsApp native action name; availability depends on the recipient and account"),
2867
+ parameters: JsonObjectSchema.optional()
2868
+ }).strict();
2869
+ const actions = z.array(InteractiveActionSchema).min(1).superRefine((items, ctx) => {
2870
+ const replies = items.filter((item) => item.type === "reply");
2871
+ if (replies.length && replies.length !== items.length) ctx.addIssue({
2872
+ code: "custom",
2873
+ message: "Reply actions cannot be mixed with URL, call or copy actions"
2874
+ });
2875
+ const ids = /* @__PURE__ */ new Set();
2876
+ items.forEach((item, index) => {
2877
+ if (item.type !== "reply") return;
2878
+ if (ids.has(item.id)) ctx.addIssue({
2879
+ code: "custom",
2880
+ path: [index, "id"],
2881
+ message: "Duplicate reply ID"
2882
+ });
2883
+ ids.add(item.id);
2884
+ });
2885
+ });
2886
+ const media = {
2887
+ source: text.describe("HTTP(S) URL, local file path or base64 data URL; resolved by the client before sending"),
2888
+ filename: text.optional(),
2889
+ title: z.string().optional()
2890
+ };
2891
+ const InteractiveHeaderSchema = z.discriminatedUnion("type", [
2892
+ z.object({
2893
+ type: z.literal("text"),
2894
+ text
2895
+ }).strict(),
2896
+ z.object({
2897
+ type: z.literal("image"),
2898
+ ...media
2899
+ }).strict(),
2900
+ z.object({
2901
+ type: z.literal("video"),
2902
+ ...media
2903
+ }).strict(),
2904
+ z.object({
2905
+ type: z.literal("document"),
2906
+ ...media
2907
+ }).strict()
2908
+ ]);
2909
+ const base = {
2910
+ version: z.literal(1).optional().describe("Document format version, defaults to 1; independent of WhatsApp protocol versions"),
2911
+ body: text,
2912
+ footer: z.string().optional()
2913
+ };
2914
+ const ButtonsContentSchema = z.object({
2915
+ ...base,
2916
+ type: z.literal("buttons"),
2917
+ header: InteractiveHeaderSchema.optional(),
2918
+ actions
2919
+ }).strict();
2920
+ const ListRowSchema = z.object({
2921
+ id,
2922
+ title: text,
2923
+ description: z.string().optional()
2924
+ }).strict();
2925
+ const ListContentSchema = z.object({
2926
+ ...base,
2927
+ type: z.literal("list"),
2928
+ title: z.string().optional(),
2929
+ buttonLabel: text.default("Choose an option"),
2930
+ sections: z.array(z.object({
2931
+ title: z.string().optional(),
2932
+ rows: z.array(ListRowSchema).min(1)
2933
+ }).strict()).min(1)
2934
+ }).strict();
2935
+ const FormQuestionSchema = z.object({
2936
+ type: z.enum(["singleSelect", "multiSelect"]),
2937
+ id,
2938
+ label: text,
2939
+ options: z.array(z.object({
2940
+ id,
2941
+ label: text
2942
+ }).strict()).min(1),
2943
+ allowCustomAnswer: z.boolean().optional()
2944
+ }).strict();
2945
+ const FormContentSchema = z.object({
2946
+ ...base,
2947
+ type: z.literal("form"),
2948
+ title: z.string().optional(),
2949
+ questions: z.array(FormQuestionSchema).min(1)
2950
+ }).strict();
2951
+ const CarouselCardSchema = z.object({
2952
+ body: text,
2953
+ header: z.object({
2954
+ type: z.literal("image"),
2955
+ ...media
2956
+ }).strict(),
2957
+ actions
2958
+ }).strict();
2959
+ const CarouselContentSchema = z.object({
2960
+ ...base,
2961
+ type: z.literal("carousel"),
2962
+ cards: z.array(CarouselCardSchema).min(1)
2963
+ }).strict();
2964
+ const BookingContentSchema = z.object({
2965
+ ...base,
2966
+ type: z.literal("booking"),
2967
+ title: z.string().optional(),
2968
+ buttonLabel: text.default("View booking"),
2969
+ booking: z.object({
2970
+ startAt: z.iso.datetime({ offset: true }),
2971
+ endAt: z.iso.datetime({ offset: true }).optional(),
2972
+ location: z.string().optional(),
2973
+ url: url.optional(),
2974
+ managementUrl: url.optional(),
2975
+ phoneNumber: z.string().optional(),
2976
+ email: z.email().optional(),
2977
+ description: z.string().optional(),
2978
+ labels: z.object({
2979
+ language: z.string().optional(),
2980
+ meetingType: z.string().optional(),
2981
+ detailsTitle: z.string().optional(),
2982
+ addToCalendar: z.string().optional(),
2983
+ viewOnMap: z.string().optional(),
2984
+ manageBooking: z.string().optional()
2985
+ }).strict().optional()
2986
+ }).strict(),
2987
+ actions: z.array(z.discriminatedUnion("type", [
2988
+ LinkActionSchema,
2989
+ CallActionSchema,
2990
+ CopyActionSchema
2991
+ ])).optional()
2992
+ }).strict();
2993
+ const NativeContentSchema = z.object({
2994
+ ...base,
2995
+ type: z.literal("native"),
2996
+ header: InteractiveHeaderSchema.optional(),
2997
+ actions: z.array(NativeActionSchema).min(1),
2998
+ parameters: JsonObjectSchema.optional()
2999
+ }).strict().describe("Advanced extension for new native action types; parameters are passed through without claiming recipient support");
3000
+ const InteractiveContentSchema = z.discriminatedUnion("type", [
3001
+ ButtonsContentSchema,
3002
+ ListContentSchema,
3003
+ FormContentSchema,
3004
+ CarouselContentSchema,
3005
+ BookingContentSchema,
3006
+ NativeContentSchema
3007
+ ]).superRefine((content, ctx) => {
3008
+ const unique = (items, path) => {
3009
+ const seen = /* @__PURE__ */ new Set();
3010
+ items.forEach((item, index) => {
3011
+ if (seen.has(item.id)) ctx.addIssue({
3012
+ code: "custom",
3013
+ path: [
3014
+ ...path,
3015
+ index,
3016
+ "id"
3017
+ ],
3018
+ message: "IDs must be unique"
3019
+ });
3020
+ seen.add(item.id);
3021
+ });
3022
+ };
3023
+ if (content.type === "form") {
3024
+ unique(content.questions, ["questions"]);
3025
+ content.questions.forEach((q, index) => {
3026
+ unique(q.options, [
3027
+ "questions",
3028
+ index,
3029
+ "options"
3030
+ ]);
3031
+ if (q.id === "__openwa_form__") ctx.addIssue({
3032
+ code: "custom",
3033
+ path: [
3034
+ "questions",
3035
+ index,
3036
+ "id"
3037
+ ],
3038
+ message: "This question ID is reserved"
3039
+ });
3040
+ });
3041
+ }
3042
+ if (content.type === "list") {
3043
+ const seen = /* @__PURE__ */ new Set();
3044
+ content.sections.forEach((section, s) => section.rows.forEach((row, r) => {
3045
+ if (seen.has(row.id)) ctx.addIssue({
3046
+ code: "custom",
3047
+ path: [
3048
+ "sections",
3049
+ s,
3050
+ "rows",
3051
+ r,
3052
+ "id"
3053
+ ],
3054
+ message: "Row IDs must be unique across sections"
3055
+ });
3056
+ seen.add(row.id);
3057
+ }));
3058
+ }
3059
+ if (content.type === "booking" && content.booking.endAt && Date.parse(content.booking.endAt) <= Date.parse(content.booking.startAt)) ctx.addIssue({
3060
+ code: "custom",
3061
+ path: ["booking", "endAt"],
3062
+ message: "Booking end must be after its start"
3063
+ });
3064
+ });
3065
+ /** Validate a JSON document without sending it or loading media; suitable for UI builders. */
3066
+ function defineInteractiveMessage(content) {
3067
+ return InteractiveContentSchema.parse(content);
3068
+ }
3069
+ const responseBase = {
3070
+ messageId: text,
3071
+ chatId: text,
3072
+ senderId: text,
3073
+ originalMessageId: z.string().optional().describe("Original WhatsApp stanza ID; may not be a full serialized message key"),
3074
+ timestamp: z.number().optional(),
3075
+ raw: JsonObjectSchema
3076
+ };
3077
+ const FormResponseSchema = z.object({
3078
+ ...responseBase,
3079
+ type: z.literal("form"),
3080
+ answers: z.record(z.string(), z.union([z.string(), z.array(z.string())]))
3081
+ });
3082
+ const InteractiveResponseSchema = z.discriminatedUnion("type", [
3083
+ FormResponseSchema,
3084
+ z.object({
3085
+ ...responseBase,
3086
+ type: z.literal("reply"),
3087
+ id: text,
3088
+ label: z.string().optional()
3089
+ }),
3090
+ z.object({
3091
+ ...responseBase,
3092
+ type: z.literal("list"),
3093
+ id: text,
3094
+ label: z.string().optional()
3095
+ }),
3096
+ z.object({
3097
+ ...responseBase,
3098
+ type: z.literal("native"),
3099
+ name: text,
3100
+ parameters: JsonValueSchema.optional(),
3101
+ parseError: z.string().optional()
3102
+ })
3103
+ ]);
3104
+ //#endregion
3105
+ //#region src/methods/interactive.ts
3106
+ const SendInteractiveInputSchema = z.object({
3107
+ to: toParam,
3108
+ content: InteractiveContentSchema
3109
+ }).strict();
3110
+ const SendRawMessageInputSchema = z.object({
3111
+ to: toParam,
3112
+ payload: JsonObjectSchema
3113
+ }).strict();
3114
+ const sendInteractive = defineMethodV2("sendInteractive", {
3115
+ meta: {
3116
+ description: "Send a portable interactive message document (Insiders and above)",
3117
+ namespace: "messages",
3118
+ action: "send",
3119
+ license: "insiders",
3120
+ functionality: "both",
3121
+ httpMethod: "POST"
3122
+ },
3123
+ input: SendInteractiveInputSchema,
3124
+ parameterOrder: ["to", "content"],
3125
+ output: z.string()
3126
+ });
3127
+ const sendRawMessage = defineMethodV2("sendRawMessage", {
3128
+ meta: {
3129
+ description: "Send a constructed WhatsApp protobuf Message payload (Insiders and above); media must already be uploaded",
3130
+ namespace: "messages",
3131
+ action: "send",
3132
+ license: "insiders",
3133
+ functionality: "both",
3134
+ httpMethod: "POST"
3135
+ },
3136
+ input: SendRawMessageInputSchema,
3137
+ parameterOrder: ["to", "payload"],
3138
+ output: z.string()
3139
+ });
3140
+ //#endregion
3141
+ export { deleteStatus as $, imageDataParam as $n, CommunityAdminIdsSchema as $r, muteChat as $t, getConnectionState as A, MessageTypes as Ai, sendMultipleContacts as An, MessageIdSchema as Ar, setGroupIcon as At, healthCheck as B, sendYouTubeLink as Bn, fileToStreamCodec as Br, getNumberProfile as Bt, NativeActionSchema as C, GroupChatIdSchema as Ci, sendFile as Cn, ContactIdSchema as Cr, leaveGroup as Ct, decryptMedia as D, MessageAck as Di, sendListMessage as Dn, HexColorSchema as Dr, revokeGroupInviteLink as Dt, defineInteractiveMessage as E, LocationSchema as Ei, sendLinkWithAutoPreview as En, GroupIdSchema as Er, removeParticipant as Et, getMe as F, sendSeen as Fn, contactIdCodec as Fr, checkReadReceipts as Ft, getBusinessProducts as G, chatIdParam as Gn, jsonStringCodec as Gr, deleteChat as Gt, setMyName as H, unstarMessage as Hn, groupIdCodec as Hr, unblockContact as Ht, getProcessStats as I, sendText as In, createFileCodec as Ir, getAllContacts as It, addLabel as J, contentParam as Jn, unixSecondsToDate as Jr, getChat as Jt, getBusinessProfile as K, communityIdParam as Kn, messageIdCodec as Kr, getAllChatIds as Kt, getSnapshot as L, sendTextWithMentions as Ln, fileToBase64Codec as Lr, getBlockedIds as Lt, getHostNumber as M, SimpleListener as Mi, sendPoll as Mn, UnixSecondsToDateSchema as Mr, setGroupToAdminsOnly as Mt, getLicenseType as N, sendPtt as Nn, base64ToDataUrlCodec as Nr, blockContact as Nt, downloadMedia as O, MessageIdReturnSchema as Oi, sendLocation as On, IsoDatetimeToDateSchema as Or, setGroupDescription as Ot, getLoadedMessageCount as P, sendReplyWithMentions as Pn, chatIdCodec as Pr, checkNumberStatus as Pt, deleteAllStatus as Q, groupIdParam as Qn, CommonGroupSchema as Qr, markAsUnread as Qt, getUserAgent as R, sendVCard as Rn, fileToBufferCodec as Rr, getCommonGroups as Rt, ListRowSchema as S, DataURLSchema as Si, sendContact as Sn, ContactIdCodecSchema as Sr, joinGroupViaLink as St, ReplyActionSchema as T, IdSchema as Ti, sendImage as Tn, GroupIdCodecSchema as Tr, rejectGroupJoinRequest as Tt, setMyStatus as U, audioDataParam as Un, hexColorCodec as Ur, archiveChat as Ut, isPlugged as V, starMessage as Vn, fileToTempPathCodec as Vr, getProfilePicture as Vt, setProfilePicture as W, captionParam as Wn, isoDatetimeToDate as Wr, clearChat as Wt, getChatsByLabel as X, fileDataParam as Xn, BusinessProfileSchema as Xr, isChatOnline as Xt, getAllLabels as Y, documentDataParam as Yn, urlToDataUrlCodec as Yr, getChatWithNonContacts as Yt, removeLabel as Z, filenameParam as Zn, CartItemSchema as Zr, markAsRead as Zt, InteractiveResponseSchema as _, ProcessStatsSchema as _i, react as _n, waitForIdParam as _r, getGroupInfo as _t, BookingContentSchema as a, FeatureFlagsSchema as ai, SendTextResultSchema as an, mentionedJidListParam as ar, getAllCommunities as at, LinkActionSchema as b, ChatSchema as bi, sendBanner as bn, ChatIdCodecSchema as br, getGroupMembersId as bt, CarouselCardSchema as c, HostAccountSchema as ci, getAllMessages as cn, messageOptionsParam as cr, getCommunityInfo as ct, FormContentSchema as d, LicenseTypeSchema as di, getMessagesForLLM as dn, skipMyMessagesParam as dr, addParticipant as dt, CommunityAdminsSchema as ei, pinChat as en, includeMeParam as er, getStatus as et, FormQuestionSchema as f, MessageInfoSchema as fi, getMyLastMessage as fn, statusTextParam as fr, approveGroupJoinRequest as ft, InteractiveHeaderSchema as g, OrderSchema as gi, loadEarlierMessages as gn, videoDataParam as gr, getGroupAdmins as gt, InteractiveContentSchema as h, NumberProfileSchema as hi, getVCards as hn, userAgentParam as hr, getAllGroups as ht, sendRawMessage as i, ContactStatusSchema as ii, unpinChat as in, longitudeParam as ir, postVideoStatus as it, getFeatures as j, SerializedMessageIdSchema as ji, sendPaymentRequest as jn, UnixMillisToDateSchema as jr, setGroupTitle as jt, getBatteryLevel as k, MessageSchema as ki, sendMessageWithThumb as kn, MessageIdCodecSchema as kr, setGroupEditToAdminsOnly as kt, CarouselContentSchema as l, LLMMessageSchema as li, getMessageById as ln, nameParam as lr, getCommunityParticipantIds as lt, InteractiveActionSchema as m, NumberCheckSchema as mi, getUnsentMessages as mn, toParam as mr, demoteParticipant as mt, SendRawMessageInputSchema as n, CommunityParticipantIdsSchema as ni, unarchiveChat as nn, latitudeParam as nr, postImageStatus as nt, ButtonsContentSchema as o, GroupCreationResultSchema as oi, deleteMessage as on, messageIdParam as or, getCommunityAdminIds as ot, FormResponseSchema as p, MessageInteractionSchema as pi, getStarredMessages as pn, stickerDataParam as pr, createGroup as pt, getOrder as q, contactIdParam as qn, unixMillisToDate as qr, getAllChats as qt, sendInteractive as r, CommunityParticipantsSchema as ri, unmuteChat as rn, locationNameParam as rr, postTextStatus as rt, CallActionSchema as s, HealthCheckSchema as si, forwardMessages as sn, messageIdsParam as sr, getCommunityAdmins as st, SendInteractiveInputSchema as t, CommunityMetadataSchema as ti, setChatEphemeral as tn, includeNotificationsParam as tr, getStories as tt, CopyActionSchema as u, LabelSchema as ui, getMessageInfo as un, onlyLocalParam as ur, getCommunityParticipants as ut, JsonObjectSchema as v, ProductSchema as vi, sendAdvancedButtons as vn, withNewMessagesOnlyParam as vr, getGroupInviteLink as vt, NativeContentSchema as w, GroupMetadataSchema as wi, sendFileFromUrl as wn, FileToDataUrlSchema as wr, promoteParticipant as wt, ListContentSchema as x, ContactSchema as xi, sendButtons as xn, ChatIdSchema as xr, getKickedGroups as xt, JsonValueSchema as y, StorySchema as yi, sendAudio as yn, Base64ToDataUrlSchema as yr, getGroupMembers as yt, getWAVersion as z, sendVideoAsGif as zn, fileToDataUrlCodec as zr, getContact as zt };
2632
3142
 
2633
- //# sourceMappingURL=methods-CZqeUhKy.mjs.map
3143
+ //# sourceMappingURL=methods-BhLsQNtL.mjs.map