@open-wa/schema 5.3.0 → 5.5.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/calling-media--BLrFrPc.cjs +113 -0
  2. package/dist/calling-media--BLrFrPc.cjs.map +1 -0
  3. package/dist/calling-media-BNTYvogE.mjs +60 -0
  4. package/dist/calling-media-BNTYvogE.mjs.map +1 -0
  5. package/dist/calling-media-CeGgSzhw.d.cts +48 -0
  6. package/dist/calling-media-CeGgSzhw.d.cts.map +1 -0
  7. package/dist/calling-media-CeGgSzhw.d.mts +48 -0
  8. package/dist/calling-media-CeGgSzhw.d.mts.map +1 -0
  9. package/dist/calling-media.cjs +8 -0
  10. package/dist/calling-media.d.cts +2 -0
  11. package/dist/calling-media.d.mts +2 -0
  12. package/dist/calling-media.mjs +2 -0
  13. package/dist/generated/index.cjs +94 -3
  14. package/dist/generated/index.cjs.map +1 -1
  15. package/dist/generated/index.d.cts +2328 -133
  16. package/dist/generated/index.d.cts.map +1 -1
  17. package/dist/generated/index.d.mts +2328 -133
  18. package/dist/generated/index.d.mts.map +1 -1
  19. package/dist/generated/index.mjs +94 -3
  20. package/dist/generated/index.mjs.map +1 -1
  21. package/dist/{index-C9Ad0lEr.d.cts → index-BWvNXopK.d.cts} +2375 -41
  22. package/dist/index-BWvNXopK.d.cts.map +1 -0
  23. package/dist/{index-D0QN2PaW.d.mts → index-Co8HQxm8.d.mts} +2375 -41
  24. package/dist/index-Co8HQxm8.d.mts.map +1 -0
  25. package/dist/index.cjs +191 -20
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.cts +3 -2
  28. package/dist/index.d.mts +3 -2
  29. package/dist/index.mjs +105 -21
  30. package/dist/index.mjs.map +1 -1
  31. package/dist/methods/index.cjs +34 -1
  32. package/dist/methods/index.d.cts +2 -2
  33. package/dist/methods/index.d.mts +2 -2
  34. package/dist/methods/index.mjs +2 -2
  35. package/dist/{methods-BhLsQNtL.mjs → methods-BH7nDC3z.mjs} +816 -51
  36. package/dist/methods-BH7nDC3z.mjs.map +1 -0
  37. package/dist/{methods-BGmdzjd3.cjs → methods-DpDzgsbe.cjs} +1284 -63
  38. package/dist/methods-DpDzgsbe.cjs.map +1 -0
  39. package/package.json +15 -4
  40. package/src/calling-media.ts +64 -0
  41. package/src/calling-wire.ts +17 -0
  42. package/src/calling.ts +61 -0
  43. package/src/common-types.ts +16 -0
  44. package/src/effect-projection.ts +67 -0
  45. package/src/events/calls.ts +12 -0
  46. package/src/events/groups.ts +30 -6
  47. package/src/events/index.ts +4 -0
  48. package/src/events/messaging.ts +7 -7
  49. package/src/events/polls.ts +11 -0
  50. package/src/events/registry.ts +2 -1
  51. package/src/events/whatsapp-events.ts +13 -0
  52. package/src/generated/AliasMap.ts +30 -1
  53. package/src/generated/BaseClient.ts +153 -8
  54. package/src/generated/BaseNamespacedClient.ts +36 -1
  55. package/src/generated/openapi.json +22999 -12765
  56. package/src/generated/types.ts +87 -0
  57. package/src/index.ts +10 -0
  58. package/src/license.ts +10 -0
  59. package/src/media-options.ts +46 -0
  60. package/src/methods/calls.ts +23 -0
  61. package/src/methods/contacts.ts +10 -1
  62. package/src/methods/groups.ts +9 -3
  63. package/src/methods/index.ts +2 -0
  64. package/src/methods/messaging.ts +159 -45
  65. package/src/methods/session.ts +10 -0
  66. package/src/methods/whatsapp-events.ts +35 -0
  67. package/src/polls.ts +37 -0
  68. package/src/session-refresh.ts +15 -0
  69. package/src/whatsapp-event-registry.ts +17 -0
  70. package/src/whatsapp-events.ts +91 -0
  71. package/dist/index-C9Ad0lEr.d.cts.map +0 -1
  72. package/dist/index-D0QN2PaW.d.mts.map +0 -1
  73. package/dist/methods-BGmdzjd3.cjs.map +0 -1
  74. package/dist/methods-BhLsQNtL.mjs.map +0 -1
@@ -13,6 +13,16 @@ export abstract class BaseClient {
13
13
  throw new Error('BaseClient.pup is not available without a runtime implementation.');
14
14
  }
15
15
 
16
+ /**
17
+ * Render a sticker locally using automatic whole-job backend selection and ordered effects, then submit through the private donor finalizer. Author and pack labels are configurable; donor app links are owned by the installed patch. Returns a submitted message ID, not a delivery receipt. Unknown send outcomes must be reconciled before retrying.
18
+ */
19
+ public sendSticker = implementMethod(Methods.sendSticker);
20
+
21
+ /**
22
+ * Sends images and videos together as a native WhatsApp album with one caption on its first item. GIFs use MP4 video data with isGif: true. Documents are rejected. Phone-number IDs are resolved to LIDs; the destination chat must already be loaded and allow sending. WhatsApp controls the minimum item count and upload limits. Runtime failures include the parent and submitted child IDs when available; inspect the chat before retrying.
23
+ */
24
+ public sendAlbum = implementMethod(Methods.sendAlbum);
25
+
16
26
  /**
17
27
  * 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.
18
28
  */
@@ -34,28 +44,28 @@ export abstract class BaseClient {
34
44
  public sendPaymentRequest = implementMethod(Methods.sendPaymentRequest);
35
45
 
36
46
  /**
37
- * Sends an image to a chat
47
+ * Sends media through the native attachment pipeline, including images and videos. Options select presentation, view once, GIF playback or circular video notes; media is not transcoded. Returns submission status, not a delivery receipt.
38
48
  */
39
49
  public sendImage = implementMethod(Methods.sendImage);
40
50
 
41
51
  /**
42
- * Sends a file or document to a chat
52
+ * Sends an image, video, audio file or document using MIME detection or an explicit typed presentation. Incompatible options are rejected before sending. Media is not transcoded.
43
53
  */
44
54
  public sendFile = implementMethod(Methods.sendFile);
45
55
 
46
56
  /**
47
- * Sends an audio file to a chat
57
+ * Sends an audio attachment with an optional quoted message. Use sendPtt for voice notes and view-once audio.
48
58
  */
49
59
  public sendAudio = implementMethod(Methods.sendAudio);
50
60
 
51
61
  /**
52
- * Sends a voice note (push-to-talk) to a chat
62
+ * Sends prepared audio as a voice note, optionally view once. It does not transcode the input; use suitable voice-note audio such as Ogg Opus.
53
63
  * @aliases sendVoiceNote
54
64
  */
55
65
  public sendPtt = implementMethod(Methods.sendPtt);
56
66
 
57
67
  /**
58
- * Sends a video as an animated GIF
68
+ * Sends MP4 video with WhatsApp GIF playback. GIF is a video presentation flag; this method does not convert a GIF image or transcode video.
59
69
  */
60
70
  public sendVideoAsGif = implementMethod(Methods.sendVideoAsGif);
61
71
 
@@ -97,10 +107,30 @@ export abstract class BaseClient {
97
107
  public sendListMessage = implementMethod(Methods.sendListMessage);
98
108
 
99
109
  /**
100
- * Sends a poll message
110
+ * Sends a text poll with a selection limit, quote, optional closing time in Unix milliseconds and hidden voter names. Closing time and hidden names require native WhatsApp support for the sending account/chat. These fields select the native V6 poll payload.
101
111
  */
102
112
  public sendPoll = implementMethod(Methods.sendPoll);
103
113
 
114
+ /**
115
+ * Votes using option IDs returned by getPollResults; an empty array removes the current vote. The poll must be open and allow this account to vote.
116
+ */
117
+ public voteOnPoll = implementMethod(Methods.voteOnPoll);
118
+
119
+ /**
120
+ * Hydrates the local poll vote store and returns synced counts, choices and votes. Hidden-voter polls omit voter identities and the votes array. Unsynced votes may be absent.
121
+ */
122
+ public getPollResults = implementMethod(Methods.getPollResults);
123
+
124
+ /**
125
+ * Pins a message in its chat for everyone, subject to native permissions. This differs from pinChat, which changes the current account chat list.
126
+ */
127
+ public pinMessage = implementMethod(Methods.pinMessage);
128
+
129
+ /**
130
+ * Removes a message pin for everyone, subject to native chat permissions.
131
+ */
132
+ public unpinMessage = implementMethod(Methods.unpinMessage);
133
+
104
134
  /**
105
135
  * Sends a banner image
106
136
  */
@@ -140,6 +170,11 @@ export abstract class BaseClient {
140
170
  */
141
171
  public getMessageById = implementMethod(Methods.getMessageById);
142
172
 
173
+ /**
174
+ * Returns currently loaded image and video messages associated with an album, including GIF videos. The album can arrive before its media, so the array may be incomplete. Returns false if the album is not loaded or the ID belongs to another message type.
175
+ */
176
+ public getAlbumMessages = implementMethod(Methods.getAlbumMessages);
177
+
143
178
  /**
144
179
  * Retrieves all messages in the session
145
180
  * @aliases listMessages
@@ -187,6 +222,11 @@ export abstract class BaseClient {
187
222
  */
188
223
  public unstarMessage = implementMethod(Methods.unstarMessage);
189
224
 
225
+ /**
226
+ * Edits the text of a message through the installed private patch
227
+ */
228
+ public editMessage = implementMethod(Methods.editMessage);
229
+
190
230
  /**
191
231
  * React to message with emoji
192
232
  */
@@ -204,7 +244,7 @@ export abstract class BaseClient {
204
244
  public loadEarlierMessages = implementMethod(Methods.loadEarlierMessages);
205
245
 
206
246
  /**
207
- * Downloads a file from a URL and sends it to a chat
247
+ * Downloads media and sends it through sendFile with the same typed presentation options.
208
248
  */
209
249
  public sendFileFromUrl = implementMethod(Methods.sendFileFromUrl);
210
250
 
@@ -291,6 +331,16 @@ export abstract class BaseClient {
291
331
  */
292
332
  public isChatOnline = implementMethod(Methods.isChatOnline);
293
333
 
334
+ /**
335
+ * Ask a direct LID chat to voluntarily share their phone number. A submitted request does not confirm sharing.
336
+ */
337
+ public requestPhoneNumber = implementMethod(Methods.requestPhoneNumber);
338
+
339
+ /**
340
+ * Share the signed-in account’s own phone number with a direct LID chat using WhatsApp’s native protocol. No arbitrary phone number is accepted.
341
+ */
342
+ public sharePhoneNumber = implementMethod(Methods.sharePhoneNumber);
343
+
294
344
  /**
295
345
  * Retrieves all contacts
296
346
  * @aliases listContacts
@@ -364,7 +414,7 @@ export abstract class BaseClient {
364
414
  public getGroupMembersId = implementMethod(Methods.getGroupMembersId);
365
415
 
366
416
  /**
367
- * Get group metadata
417
+ * Get the group title and description through the installed private patch
368
418
  */
369
419
  public getGroupInfo = implementMethod(Methods.getGroupInfo);
370
420
 
@@ -610,6 +660,11 @@ export abstract class BaseClient {
610
660
  */
611
661
  public getLicenseType = implementMethod(Methods.getLicenseType);
612
662
 
663
+ /**
664
+ * Get enabled and disabled licensed features from the accepted licence patch. This reports licence access; actions check runtime availability automatically.
665
+ */
666
+ public getLicenseFeatures = implementMethod(Methods.getLicenseFeatures);
667
+
613
668
  /**
614
669
  * Get user agent
615
670
  * @aliases getGeneratedUserAgent
@@ -676,6 +731,96 @@ export abstract class BaseClient {
676
731
  */
677
732
  public sendRawMessage = implementMethod(Methods.sendRawMessage);
678
733
 
734
+ /**
735
+ * Optional calling availability for UI and diagnostics. Actions perform admission automatically.
736
+ */
737
+ public getCallCapabilities = implementMethod(Methods.getCallCapabilities);
738
+
739
+ /**
740
+ * Get the current call snapshot. SDK clients hydrate its bound methods.
741
+ */
742
+ public getActiveCall = implementMethod(Methods.getActiveCall);
743
+
744
+ /**
745
+ * Prepare media and accept this incoming call.
746
+ */
747
+ public acceptCall = implementMethod(Methods.acceptCall);
748
+
749
+ /**
750
+ * Prepare media and place an outgoing audio or video call.
751
+ */
752
+ public startCall = implementMethod(Methods.startCall);
753
+
754
+ /**
755
+ * Reject this call with native state confirmation.
756
+ */
757
+ public rejectCall = implementMethod(Methods.rejectCall);
758
+
759
+ /**
760
+ * Request hangup for this call.
761
+ */
762
+ public endCall = implementMethod(Methods.endCall);
763
+
764
+ /**
765
+ * Mute or unmute the microphone without ending reception.
766
+ */
767
+ public muteCall = implementMethod(Methods.muteCall);
768
+
769
+ /**
770
+ * Discard queued outgoing audio.
771
+ */
772
+ public clearCallAudio = implementMethod(Methods.clearCallAudio);
773
+
774
+ /**
775
+ * Prepare a replacement before releasing the working media.
776
+ */
777
+ public setCallMedia = implementMethod(Methods.setCallMedia);
778
+
779
+ /**
780
+ * Attach an isolated receive-only audio sink. Its failure does not interrupt the call owner.
781
+ */
782
+ public observeCallAudio = implementMethod(Methods.observeCallAudio);
783
+
784
+ /**
785
+ * Stop an audio observer and finalize its sink.
786
+ */
787
+ public stopCallAudioObserver = implementMethod(Methods.stopCallAudioObserver);
788
+
789
+ /**
790
+ * Send a native WhatsApp event with Unix-second times. Returns its submitted message ID; delivery is observed through ACKs.
791
+ */
792
+ public sendEvent = implementMethod(Methods.sendEvent);
793
+
794
+ /**
795
+ * Retrieve an event by message ID from WhatsApp local history. Returns null when absent.
796
+ */
797
+ public getEvent = implementMethod(Methods.getEvent);
798
+
799
+ /**
800
+ * Page through a chat’s locally synced event history, newest first. Pass nextCursor as options.before to retrieve the next page.
801
+ */
802
+ public getEvents = implementMethod(Methods.getEvents);
803
+
804
+ /**
805
+ * Get the latest decrypted RSVP per participant, including responses persisted in WhatsApp local history.
806
+ */
807
+ public getEventResponses = implementMethod(Methods.getEventResponses);
808
+
809
+ /**
810
+ * Edit an event created by this account. Unspecified fields retain their current values; endTime: null removes the end time.
811
+ */
812
+ public editEvent = implementMethod(Methods.editEvent);
813
+
814
+ /**
815
+ * Cancel an event created by this account using WhatsApp’s encrypted event edit action.
816
+ */
817
+ public cancelEvent = implementMethod(Methods.cancelEvent);
818
+
819
+ /**
820
+ * RSVP through WhatsApp’s native encrypted event-response action.
821
+ */
822
+ public respondToEvent = implementMethod(Methods.respondToEvent);
823
+
679
824
  /**
680
825
  * Alias of sendPtt.
681
826
  */
@@ -13,6 +13,20 @@ export abstract class BaseNamespacedClient extends BaseClient {
13
13
  getProfilesProducts: this.getBusinessProducts
14
14
  };
15
15
 
16
+ public calls = {
17
+ acceptCall: this.acceptCall,
18
+ clearCallAudio: this.clearCallAudio,
19
+ endCall: this.endCall,
20
+ getActiveCall: this.getActiveCall,
21
+ getCallCapabilities: this.getCallCapabilities,
22
+ muteCall: this.muteCall,
23
+ observeCallAudio: this.observeCallAudio,
24
+ rejectCall: this.rejectCall,
25
+ setCallMedia: this.setCallMedia,
26
+ startCall: this.startCall,
27
+ stopCallAudioObserver: this.stopCallAudioObserver
28
+ };
29
+
16
30
  public chatIds = {
17
31
  all: this.getAllChatIds,
18
32
  getAll: this.getAllChatIds,
@@ -67,9 +81,21 @@ export abstract class BaseNamespacedClient extends BaseClient {
67
81
  getProfilePicture: this.getProfilePicture,
68
82
  getReadReceipts: this.checkReadReceipts,
69
83
  list: this.getAllContacts,
84
+ requestPhoneNumber: this.requestPhoneNumber,
85
+ sharePhoneNumber: this.sharePhoneNumber,
70
86
  unblock: this.unblockContact
71
87
  };
72
88
 
89
+ public events = {
90
+ cancelEvent: this.cancelEvent,
91
+ editEvent: this.editEvent,
92
+ get: this.getEvents,
93
+ getEvent: this.getEvent,
94
+ getEventResponses: this.getEventResponses,
95
+ respondToEvent: this.respondToEvent,
96
+ sendEvent: this.sendEvent
97
+ };
98
+
73
99
  public groups = {
74
100
  addParticipant: this.addParticipant,
75
101
  all: this.getAllGroups,
@@ -119,22 +145,27 @@ export abstract class BaseNamespacedClient extends BaseClient {
119
145
  public messages = {
120
146
  all: this.getAllMessages,
121
147
  delete: this.deleteMessage,
148
+ edit: this.editMessage,
122
149
  forward: this.forwardMessages,
123
150
  get: this.getMessageById,
151
+ getAlbum: this.getAlbumMessages,
124
152
  getAll: this.getAllMessages,
125
153
  getById: this.getMessageById,
126
154
  getForLLM: this.getMessagesForLLM,
127
155
  getGptArray: this.getMessagesForLLM,
128
156
  getInfo: this.getMessageInfo,
129
157
  getMyLast: this.getMyLastMessage,
158
+ getPollResults: this.getPollResults,
130
159
  getStarred: this.getStarredMessages,
131
160
  getUnsent: this.getUnsentMessages,
132
161
  getVCards: this.getVCards,
133
162
  list: this.getAllMessages,
134
163
  loadEarlier: this.loadEarlierMessages,
135
164
  loadOlder: this.loadEarlierMessages,
165
+ pin: this.pinMessage,
136
166
  react: this.react,
137
167
  sendAdvancedButtons: this.sendAdvancedButtons,
168
+ sendAlbum: this.sendAlbum,
138
169
  sendAudio: this.sendAudio,
139
170
  sendBanner: this.sendBanner,
140
171
  sendButtons: this.sendButtons,
@@ -156,6 +187,7 @@ export abstract class BaseNamespacedClient extends BaseClient {
156
187
  sendRaw: this.sendRawMessage,
157
188
  sendReplyWithMentions: this.sendReplyWithMentions,
158
189
  sendSeen: this.sendSeen,
190
+ sendSticker: this.sendSticker,
159
191
  sendText: this.sendText,
160
192
  sendTextWithMentions: this.sendTextWithMentions,
161
193
  sendVCard: this.sendVCard,
@@ -165,7 +197,9 @@ export abstract class BaseNamespacedClient extends BaseClient {
165
197
  sendYoutubeLink: this.sendYouTubeLink,
166
198
  sendYouTubeLink: this.sendYouTubeLink,
167
199
  star: this.starMessage,
168
- unstar: this.unstarMessage
200
+ unpin: this.unpinMessage,
201
+ unstar: this.unstarMessage,
202
+ voteOnPoll: this.voteOnPoll
169
203
  };
170
204
 
171
205
  public mystatus = {
@@ -180,6 +214,7 @@ export abstract class BaseNamespacedClient extends BaseClient {
180
214
  getGeneratedUserAgent: this.getUserAgent,
181
215
  getHostNumber: this.getHostNumber,
182
216
  getIsPlugged: this.isPlugged,
217
+ getLicenseFeatures: this.getLicenseFeatures,
183
218
  getLicenseType: this.getLicenseType,
184
219
  getLoadedMessageCount: this.getLoadedMessageCount,
185
220
  getMe: this.getMe,