@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
@@ -0,0 +1,59 @@
1
+ import { z } from 'zod';
2
+ import { defineListenerV2 } from './registry';
3
+
4
+ export const StateEnum = z.enum([
5
+ 'STARTING',
6
+ 'AUTHENTICATING',
7
+ 'READY',
8
+ 'STOPPED',
9
+ 'CONNECTED',
10
+ 'DISCONNECTED',
11
+ 'SYNCING',
12
+ 'CONFLICT',
13
+ 'UNLAUNCHED',
14
+ 'PAIRING',
15
+ 'TIMEOUT',
16
+ ]);
17
+
18
+ export const stateChangedEvent = defineListenerV2('stateChanged', {
19
+ legacyName: 'onStateChanged',
20
+ meta: {
21
+ description: 'Fired when connection state changes',
22
+ namespace: 'state',
23
+ status: 'stable',
24
+ license: 'none',
25
+ },
26
+ payload: z.object({
27
+ state: StateEnum,
28
+ previousState: StateEnum.optional(),
29
+ }),
30
+ });
31
+
32
+ export const chatStateEvent = defineListenerV2('chatState', {
33
+ legacyName: 'onChatState',
34
+ meta: {
35
+ description: 'Fired when someone is typing or recording',
36
+ namespace: 'state',
37
+ status: 'stable',
38
+ license: 'none',
39
+ },
40
+ payload: z.object({
41
+ chatId: z.string(),
42
+ state: z.enum(['typing', 'recording', 'paused']),
43
+ senderId: z.string(),
44
+ }),
45
+ });
46
+
47
+ export const logoutEvent = defineListenerV2('logout', {
48
+ legacyName: 'onLogout',
49
+ meta: {
50
+ description: 'Fired when the session is logged out',
51
+ namespace: 'state',
52
+ status: 'stable',
53
+ license: 'none',
54
+ },
55
+ payload: z.object({
56
+ reason: z.string().optional(),
57
+ timestamp: z.number(),
58
+ }),
59
+ });
@@ -0,0 +1,216 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * This file was automatically generated by packages/schema/scripts/gen-client-implementation.ts
4
+ * Do not edit this file manually.
5
+ */
6
+ export const clientMethodAliasMap = {
7
+ "messages.sendText": "sendText",
8
+ "messages.sendTextWithMentions": "sendTextWithMentions",
9
+ "messages.sendReplyWithMentions": "sendReplyWithMentions",
10
+ "messages.sendPaymentRequest": "sendPaymentRequest",
11
+ "messages.sendImage": "sendImage",
12
+ "messages.sendFile": "sendFile",
13
+ "messages.sendAudio": "sendAudio",
14
+ "sendVoiceNote": "sendPtt",
15
+ "messages.sendPtt": "sendPtt",
16
+ "messages.sendVoiceNote": "sendPtt",
17
+ "messages.sendVideoAsGif": "sendVideoAsGif",
18
+ "messages.sendLocation": "sendLocation",
19
+ "messages.sendVCard": "sendVCard",
20
+ "messages.sendContact": "sendContact",
21
+ "sendContacts": "sendMultipleContacts",
22
+ "messages.sendContacts": "sendMultipleContacts",
23
+ "messages.sendMultipleContacts": "sendMultipleContacts",
24
+ "messages.sendButtons": "sendButtons",
25
+ "messages.sendAdvancedButtons": "sendAdvancedButtons",
26
+ "sendList": "sendListMessage",
27
+ "messages.sendList": "sendListMessage",
28
+ "messages.sendPoll": "sendPoll",
29
+ "messages.sendBanner": "sendBanner",
30
+ "sendYoutubeLink": "sendYouTubeLink",
31
+ "messages.sendYouTubeLink": "sendYouTubeLink",
32
+ "messages.sendYoutubeLink": "sendYouTubeLink",
33
+ "sendLink": "sendLinkWithAutoPreview",
34
+ "messages.sendLinkWithAutoPreview": "sendLinkWithAutoPreview",
35
+ "messages.sendLink": "sendLinkWithAutoPreview",
36
+ "sendLinkWithThumbnail": "sendMessageWithThumb",
37
+ "messages.sendLinkWithThumbnail": "sendMessageWithThumb",
38
+ "messages.sendWithThumb": "sendMessageWithThumb",
39
+ "messages.forward": "forwardMessages",
40
+ "messages.delete": "deleteMessage",
41
+ "getMessage": "getMessageById",
42
+ "messages.get": "getMessageById",
43
+ "messages.getById": "getMessageById",
44
+ "listMessages": "getAllMessages",
45
+ "messages.getAll": "getAllMessages",
46
+ "messages.all": "getAllMessages",
47
+ "messages.list": "getAllMessages",
48
+ "messages.getMyLast": "getMyLastMessage",
49
+ "messages.getStarred": "getStarredMessages",
50
+ "messages.getUnsent": "getUnsentMessages",
51
+ "messages.getInfo": "getMessageInfo",
52
+ "messages.getVCards": "getVCards",
53
+ "getGptArray": "getMessagesForLLM",
54
+ "messages.getForLLM": "getMessagesForLLM",
55
+ "messages.getGptArray": "getMessagesForLLM",
56
+ "messages.star": "starMessage",
57
+ "messages.unstar": "unstarMessage",
58
+ "messages.react": "react",
59
+ "messages.sendSeen": "sendSeen",
60
+ "loadOlderMessages": "loadEarlierMessages",
61
+ "messages.loadEarlier": "loadEarlierMessages",
62
+ "messages.loadOlder": "loadEarlierMessages",
63
+ "messages.sendFileFromUrl": "sendFileFromUrl",
64
+ "listChats": "getAllChats",
65
+ "chats.getAll": "getAllChats",
66
+ "chats.all": "getAllChats",
67
+ "chats.list": "getAllChats",
68
+ "chats.ids": "getAllChatIds",
69
+ "listChatIds": "getAllChatIds",
70
+ "chatIds.getAll": "getAllChatIds",
71
+ "chatIds.all": "getAllChatIds",
72
+ "chatIds.list": "getAllChatIds",
73
+ "getChatById": "getChat",
74
+ "chats.get": "getChat",
75
+ "chats.getById": "getChat",
76
+ "chats.getWithNonContacts": "getChatWithNonContacts",
77
+ "chats.archive": "archiveChat",
78
+ "chats.unarchive": "unarchiveChat",
79
+ "chats.clear": "clearChat",
80
+ "chats.delete": "deleteChat",
81
+ "chats.pin": "pinChat",
82
+ "chats.unpin": "unpinChat",
83
+ "chats.mute": "muteChat",
84
+ "chats.unmute": "unmuteChat",
85
+ "chats.markAsRead": "markAsRead",
86
+ "chats.markAsUnread": "markAsUnread",
87
+ "chats.setEphemeral": "setChatEphemeral",
88
+ "chats.isOnline": "isChatOnline",
89
+ "listContacts": "getAllContacts",
90
+ "contacts.getAll": "getAllContacts",
91
+ "contacts.all": "getAllContacts",
92
+ "contacts.list": "getAllContacts",
93
+ "contacts.get": "getContact",
94
+ "contacts.getCommonGroups": "getCommonGroups",
95
+ "contacts.getNumberProfile": "getNumberProfile",
96
+ "contacts.getBlockedIds": "getBlockedIds",
97
+ "contactBlock": "blockContact",
98
+ "contacts.block": "blockContact",
99
+ "contacts.contactBlock": "blockContact",
100
+ "contactUnblock": "unblockContact",
101
+ "contacts.unblock": "unblockContact",
102
+ "contacts.contactUnblock": "unblockContact",
103
+ "getReadReceipts": "checkReadReceipts",
104
+ "contacts.checkReadReceipts": "checkReadReceipts",
105
+ "contacts.getReadReceipts": "checkReadReceipts",
106
+ "contacts.checkNumberStatus": "checkNumberStatus",
107
+ "getProfilePicFromServer": "getProfilePicture",
108
+ "contacts.getProfilePicture": "getProfilePicture",
109
+ "contacts.getProfilePicFromServer": "getProfilePicture",
110
+ "groups.getMembers": "getGroupMembers",
111
+ "listGroups": "getAllGroups",
112
+ "groups.getAll": "getAllGroups",
113
+ "groups.all": "getAllGroups",
114
+ "groups.list": "getAllGroups",
115
+ "getGroupMemberIds": "getGroupMembersId",
116
+ "groups.getMemberIds": "getGroupMembersId",
117
+ "groups.getMembersId": "getGroupMembersId",
118
+ "groups.getInfo": "getGroupInfo",
119
+ "groups.getAdmins": "getGroupAdmins",
120
+ "groups.getKicked": "getKickedGroups",
121
+ "groups.getInviteLink": "getGroupInviteLink",
122
+ "groups.create": "createGroup",
123
+ "groups.leave": "leaveGroup",
124
+ "joinGroup": "joinGroupViaLink",
125
+ "groups.join": "joinGroupViaLink",
126
+ "groups.joinViaLink": "joinGroupViaLink",
127
+ "groups.revokeInviteLink": "revokeGroupInviteLink",
128
+ "groups.setTitle": "setGroupTitle",
129
+ "groups.setDescription": "setGroupDescription",
130
+ "groups.setIcon": "setGroupIcon",
131
+ "groups.setAdminsOnly": "setGroupToAdminsOnly",
132
+ "groups.setToAdminsOnly": "setGroupToAdminsOnly",
133
+ "groups.setEditAdminsOnly": "setGroupEditToAdminsOnly",
134
+ "groups.setEditToAdminsOnly": "setGroupEditToAdminsOnly",
135
+ "addGroupParticipant": "addParticipant",
136
+ "groups.addParticipant": "addParticipant",
137
+ "removeGroupParticipant": "removeParticipant",
138
+ "groups.removeParticipant": "removeParticipant",
139
+ "promoteGroupParticipant": "promoteParticipant",
140
+ "groups.promoteParticipant": "promoteParticipant",
141
+ "demoteGroupParticipant": "demoteParticipant",
142
+ "groups.demoteParticipant": "demoteParticipant",
143
+ "groups.approveJoinRequest": "approveGroupJoinRequest",
144
+ "groups.rejectJoinRequest": "rejectGroupJoinRequest",
145
+ "listCommunities": "getAllCommunities",
146
+ "communities.getAll": "getAllCommunities",
147
+ "communities.all": "getAllCommunities",
148
+ "communities.list": "getAllCommunities",
149
+ "communities.getInfo": "getCommunityInfo",
150
+ "communities.getParticipantIds": "getCommunityParticipantIds",
151
+ "communities.getAdminIds": "getCommunityAdminIds",
152
+ "communities.getParticipants": "getCommunityParticipants",
153
+ "communities.getAdmins": "getCommunityAdmins",
154
+ "status.postText": "postTextStatus",
155
+ "status.postImage": "postImageStatus",
156
+ "status.postVideo": "postVideoStatus",
157
+ "getStatuses": "getStories",
158
+ "status.getAll": "getStories",
159
+ "status.getStories": "getStories",
160
+ "status.get": "getStories",
161
+ "mystatus.getStatus": "getStatus",
162
+ "status.delete": "deleteStatus",
163
+ "deleteAllStatuses": "deleteAllStatus",
164
+ "status.deleteAll": "deleteAllStatus",
165
+ "listLabels": "getAllLabels",
166
+ "labels.getAll": "getAllLabels",
167
+ "labels.all": "getAllLabels",
168
+ "labels.list": "getAllLabels",
169
+ "labels.getChats": "getChatsByLabel",
170
+ "labels.getChatsBy": "getChatsByLabel",
171
+ "labels.add": "addLabel",
172
+ "labels.remove": "removeLabel",
173
+ "business.getProfile": "getBusinessProfile",
174
+ "getBusinessProfilesProducts": "getBusinessProducts",
175
+ "business.getProducts": "getBusinessProducts",
176
+ "business.getProfilesProducts": "getBusinessProducts",
177
+ "business.getOrder": "getOrder",
178
+ "session.getMe": "getMe",
179
+ "session.getHostNumber": "getHostNumber",
180
+ "session.getConnectionState": "getConnectionState",
181
+ "getWhatsAppVersion": "getWAVersion",
182
+ "session.getWAVersion": "getWAVersion",
183
+ "session.getWhatsAppVersion": "getWAVersion",
184
+ "session.getBatteryLevel": "getBatteryLevel",
185
+ "getIsPlugged": "isPlugged",
186
+ "session.isPlugged": "isPlugged",
187
+ "session.getIsPlugged": "isPlugged",
188
+ "session.getFeatures": "getFeatures",
189
+ "session.getLicenseType": "getLicenseType",
190
+ "getGeneratedUserAgent": "getUserAgent",
191
+ "session.getUserAgent": "getUserAgent",
192
+ "session.getGeneratedUserAgent": "getUserAgent",
193
+ "session.getProcessStats": "getProcessStats",
194
+ "getAmountOfLoadedMessages": "getLoadedMessageCount",
195
+ "session.getLoadedMessageCount": "getLoadedMessageCount",
196
+ "session.getAmountOfLoadedMessages": "getLoadedMessageCount",
197
+ "takeScreenshot": "getSnapshot",
198
+ "session.getSnapshot": "getSnapshot",
199
+ "session.takeScreenshot": "getSnapshot",
200
+ "session.healthCheck": "healthCheck",
201
+ "setDisplayName": "setMyName",
202
+ "session.setName": "setMyName",
203
+ "session.setMyName": "setMyName",
204
+ "session.setDisplayName": "setMyName",
205
+ "setStatusText": "setMyStatus",
206
+ "session.setStatus": "setMyStatus",
207
+ "session.setMyStatus": "setMyStatus",
208
+ "session.setStatusText": "setMyStatus",
209
+ "setProfilePic": "setProfilePicture",
210
+ "session.setProfilePicture": "setProfilePicture",
211
+ "session.setProfilePic": "setProfilePicture",
212
+ "media.decrypt": "decryptMedia",
213
+ "media.download": "downloadMedia",
214
+ "messages.sendInteractive": "sendInteractive",
215
+ "messages.sendRaw": "sendRawMessage"
216
+ } as const;