@wirecat/whatsapp-cli 0.0.0-stage → 0.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 (134) hide show
  1. package/LICENSE +204 -0
  2. package/README.md +401 -2
  3. package/dist/adapter/adapter.d.ts +13 -0
  4. package/dist/adapter/adapter.d.ts.map +1 -0
  5. package/dist/adapter/adapter.js +554 -0
  6. package/dist/adapter/adapter.js.map +1 -0
  7. package/dist/adapter/channels.d.ts +43 -0
  8. package/dist/adapter/channels.d.ts.map +1 -0
  9. package/dist/adapter/channels.js +100 -0
  10. package/dist/adapter/channels.js.map +1 -0
  11. package/dist/adapter/checks.d.ts +6 -0
  12. package/dist/adapter/checks.d.ts.map +1 -0
  13. package/dist/adapter/checks.js +2 -0
  14. package/dist/adapter/checks.js.map +1 -0
  15. package/dist/adapter/errors.d.ts +13 -0
  16. package/dist/adapter/errors.d.ts.map +1 -0
  17. package/dist/adapter/errors.js +38 -0
  18. package/dist/adapter/errors.js.map +1 -0
  19. package/dist/adapter/format-markdown.d.ts +8 -0
  20. package/dist/adapter/format-markdown.d.ts.map +1 -0
  21. package/dist/adapter/format-markdown.js +80 -0
  22. package/dist/adapter/format-markdown.js.map +1 -0
  23. package/dist/adapter/groups.d.ts +25 -0
  24. package/dist/adapter/groups.d.ts.map +1 -0
  25. package/dist/adapter/groups.js +252 -0
  26. package/dist/adapter/groups.js.map +1 -0
  27. package/dist/adapter/map.d.ts +23 -0
  28. package/dist/adapter/map.d.ts.map +1 -0
  29. package/dist/adapter/map.js +121 -0
  30. package/dist/adapter/map.js.map +1 -0
  31. package/dist/adapter/pins.d.ts +11 -0
  32. package/dist/adapter/pins.d.ts.map +1 -0
  33. package/dist/adapter/pins.js +10 -0
  34. package/dist/adapter/pins.js.map +1 -0
  35. package/dist/adapter/polls.d.ts +21 -0
  36. package/dist/adapter/polls.d.ts.map +1 -0
  37. package/dist/adapter/polls.js +103 -0
  38. package/dist/adapter/polls.js.map +1 -0
  39. package/dist/adapter/privacy.d.ts +18 -0
  40. package/dist/adapter/privacy.d.ts.map +1 -0
  41. package/dist/adapter/privacy.js +94 -0
  42. package/dist/adapter/privacy.js.map +1 -0
  43. package/dist/adapter/settings.d.ts +21 -0
  44. package/dist/adapter/settings.d.ts.map +1 -0
  45. package/dist/adapter/settings.js +76 -0
  46. package/dist/adapter/settings.js.map +1 -0
  47. package/dist/app.d.ts +6 -0
  48. package/dist/app.d.ts.map +1 -0
  49. package/dist/app.js +16 -0
  50. package/dist/app.js.map +1 -0
  51. package/dist/bin/wa.d.ts +3 -0
  52. package/dist/bin/wa.d.ts.map +1 -0
  53. package/dist/bin/wa.js +14 -0
  54. package/dist/bin/wa.js.map +1 -0
  55. package/dist/commands/session.d.ts +48 -0
  56. package/dist/commands/session.d.ts.map +1 -0
  57. package/dist/commands/session.js +201 -0
  58. package/dist/commands/session.js.map +1 -0
  59. package/dist/commands/setup.d.ts +3 -0
  60. package/dist/commands/setup.d.ts.map +1 -0
  61. package/dist/commands/setup.js +140 -0
  62. package/dist/commands/setup.js.map +1 -0
  63. package/dist/commands/update.d.ts +2 -0
  64. package/dist/commands/update.d.ts.map +1 -0
  65. package/dist/commands/update.js +17 -0
  66. package/dist/commands/update.js.map +1 -0
  67. package/dist/diagnose.d.ts +77 -0
  68. package/dist/diagnose.d.ts.map +1 -0
  69. package/dist/diagnose.js +84 -0
  70. package/dist/diagnose.js.map +1 -0
  71. package/dist/engine/channels.d.ts +100 -0
  72. package/dist/engine/channels.d.ts.map +1 -0
  73. package/dist/engine/channels.js +29 -0
  74. package/dist/engine/channels.js.map +1 -0
  75. package/dist/engine/contract.d.ts +1049 -0
  76. package/dist/engine/contract.d.ts.map +1 -0
  77. package/dist/engine/contract.js +353 -0
  78. package/dist/engine/contract.js.map +1 -0
  79. package/dist/engine/events.d.ts +9 -0
  80. package/dist/engine/events.d.ts.map +1 -0
  81. package/dist/engine/events.js +23 -0
  82. package/dist/engine/events.js.map +1 -0
  83. package/dist/engine/go-engine.d.ts +23 -0
  84. package/dist/engine/go-engine.d.ts.map +1 -0
  85. package/dist/engine/go-engine.js +227 -0
  86. package/dist/engine/go-engine.js.map +1 -0
  87. package/dist/engine/groups.d.ts +171 -0
  88. package/dist/engine/groups.d.ts.map +1 -0
  89. package/dist/engine/groups.js +66 -0
  90. package/dist/engine/groups.js.map +1 -0
  91. package/dist/engine/privacy.d.ts +33 -0
  92. package/dist/engine/privacy.d.ts.map +1 -0
  93. package/dist/engine/privacy.js +23 -0
  94. package/dist/engine/privacy.js.map +1 -0
  95. package/dist/engine/settings.d.ts +45 -0
  96. package/dist/engine/settings.d.ts.map +1 -0
  97. package/dist/engine/settings.js +34 -0
  98. package/dist/engine/settings.js.map +1 -0
  99. package/dist/engine-binary.d.ts +5 -0
  100. package/dist/engine-binary.d.ts.map +1 -0
  101. package/dist/engine-binary.js +18 -0
  102. package/dist/engine-binary.js.map +1 -0
  103. package/dist/install/postinstall.d.ts +8 -0
  104. package/dist/install/postinstall.d.ts.map +1 -0
  105. package/dist/install/postinstall.js +63 -0
  106. package/dist/install/postinstall.js.map +1 -0
  107. package/dist/messenger.d.ts +63 -0
  108. package/dist/messenger.d.ts.map +1 -0
  109. package/dist/messenger.js +186 -0
  110. package/dist/messenger.js.map +1 -0
  111. package/dist/paths.d.ts +5 -0
  112. package/dist/paths.d.ts.map +1 -0
  113. package/dist/paths.js +7 -0
  114. package/dist/paths.js.map +1 -0
  115. package/dist/program.d.ts +12 -0
  116. package/dist/program.d.ts.map +1 -0
  117. package/dist/program.js +86 -0
  118. package/dist/program.js.map +1 -0
  119. package/dist/reasons.d.ts +4 -0
  120. package/dist/reasons.d.ts.map +1 -0
  121. package/dist/reasons.js +21 -0
  122. package/dist/reasons.js.map +1 -0
  123. package/dist/update.d.ts +7 -0
  124. package/dist/update.d.ts.map +1 -0
  125. package/dist/update.js +19 -0
  126. package/dist/update.js.map +1 -0
  127. package/dist/version.d.ts +2 -0
  128. package/dist/version.d.ts.map +1 -0
  129. package/dist/version.js +2 -0
  130. package/dist/version.js.map +1 -0
  131. package/install/postinstall.mjs +3 -0
  132. package/install/windows.ps1 +161 -0
  133. package/package.json +89 -4
  134. package/skills/whatsapp-cli/SKILL.md +325 -0
@@ -0,0 +1,1049 @@
1
+ import * as v from "valibot";
2
+ import type { ChannelEngine } from "./channels.js";
3
+ import type { GroupEngine } from "./groups.js";
4
+ import type { PrivacyEngine } from "./privacy.js";
5
+ import type { SettingsEngine } from "./settings.js";
6
+ /**
7
+ * What the engine and the adapter say to each other, in WhatsApp's own terms. The Go engine speaks it as JSON
8
+ * lines; `FakeEngine` speaks it in memory. Bump `PROTOCOL` on any change an older peer would misread — the
9
+ * adapter refuses an engine whose hello names another version.
10
+ *
11
+ * Ids are JIDs as strings. A one-to-one chat is always in its LID form (`…@lid`) when WhatsApp has one for the
12
+ * user, never in phone form: cli-core cannot merge two stored chats, so the engine picks the one id before it
13
+ * emits a chat (cli-private plans/2026-10-16-whatsapp-foundation.md, decision 3). Names are what the address book or the
14
+ * person set; a phone number is never a name.
15
+ */
16
+ export declare const PROTOCOL = 41;
17
+ /**
18
+ * Every request the engine answers. A write changes something on WhatsApp or sends something: cut by a dropped
19
+ * connection or the engine's end, it may have gone through, so it answers `outcome_unknown`, never a retryable error
20
+ * (WC-LIFE-9). The engine's `writes` (engine/cmd/wa-engine/errors.go) must name the same writes; its tests check
21
+ * that and that it dispatches exactly these ops.
22
+ */
23
+ export declare const ENGINE_OPS: {
24
+ readonly send: "write";
25
+ readonly sendMedia: "write";
26
+ readonly sendAlbum: "write";
27
+ readonly forward: "write";
28
+ readonly edit: "write";
29
+ readonly revoke: "write";
30
+ readonly react: "write";
31
+ readonly read: "write";
32
+ readonly createPoll: "write";
33
+ readonly vote: "write";
34
+ readonly pin: "write";
35
+ readonly unpin: "write";
36
+ readonly createGroup: "write";
37
+ readonly join: "write";
38
+ readonly leave: "write";
39
+ readonly updateGroup: "write";
40
+ readonly setGroupPhoto: "write";
41
+ readonly resetLink: "write";
42
+ readonly participants: "write";
43
+ readonly answerRequest: "write";
44
+ readonly block: "write";
45
+ readonly setPrivacy: "write";
46
+ readonly mute: "write";
47
+ readonly updateProfile: "write";
48
+ readonly deleteChat: "write";
49
+ readonly clearChat: "write";
50
+ readonly deleteForMe: "write";
51
+ readonly star: "write";
52
+ readonly archiveChat: "write";
53
+ readonly unarchiveChat: "write";
54
+ readonly pinChat: "write";
55
+ readonly unpinChat: "write";
56
+ readonly markChatRead: "write";
57
+ readonly markChatUnread: "write";
58
+ readonly followChannel: "write";
59
+ readonly unfollowChannel: "write";
60
+ readonly logout: "write";
61
+ readonly connect: "read";
62
+ readonly close: "read";
63
+ readonly link: "read";
64
+ readonly me: "read";
65
+ readonly directory: "read";
66
+ readonly chat: "read";
67
+ readonly download: "read";
68
+ readonly older: "read";
69
+ readonly group: "read";
70
+ readonly requests: "read";
71
+ readonly profile: "read";
72
+ readonly lookup: "read";
73
+ readonly contacts: "read";
74
+ readonly privacy: "read";
75
+ readonly channel: "read";
76
+ readonly channelMessages: "read";
77
+ readonly storedChats: "read";
78
+ readonly canonicalChat: "read";
79
+ };
80
+ export type EngineOp = keyof typeof ENGINE_OPS;
81
+ export declare const isWrite: (op: EngineOp) => boolean;
82
+ export declare const waChat: v.StrictObjectSchema<{
83
+ readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
84
+ /**
85
+ * `unread` and `lastMessageAt` are absent when the source does not say. Only a notice, such as a group leaving its
86
+ * community, leaves out `name` and `participants`: a pushed chat keeps the stored value of whatever is absent.
87
+ */
88
+ readonly name: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
89
+ readonly kind: v.PicklistSchema<["dm", "self", "group", "newsletter", "broadcast"], undefined>;
90
+ readonly unread: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
91
+ readonly lastMessageAt: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>, undefined>;
92
+ readonly participants: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
93
+ readonly archived: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
94
+ readonly muted: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
95
+ /** The community a group is linked to; `null` when a live read says it is in none, absent when nothing said. */
96
+ readonly parent: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>, undefined>, undefined>;
97
+ /** A community itself: a group that holds other groups. */
98
+ readonly community: v.OptionalSchema<v.LiteralSchema<true, undefined>, undefined>;
99
+ /**
100
+ * `left` when WhatsApp said the owner left the group or was removed, `member` when it said the owner was added back;
101
+ * never `null`, which clears `archived` too.
102
+ */
103
+ readonly membershipState: v.OptionalSchema<v.PicklistSchema<["left", "member"], undefined>, undefined>;
104
+ }, undefined>;
105
+ export declare const waContact: v.StrictObjectSchema<{
106
+ readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
107
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
108
+ }, undefined>;
109
+ /**
110
+ * What whatsmeow needs to fetch and decrypt a file again, base64 where it is bytes. Stored as the attachment's opaque
111
+ * `providerRef`, so a download or a forward needs only the store. A channel's files are not encrypted and have no keys.
112
+ */
113
+ export declare const waMediaRef: v.StrictObjectSchema<{
114
+ readonly media: v.PicklistSchema<["image", "video", "audio", "document", "sticker"], undefined>;
115
+ readonly directPath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
116
+ readonly mediaKey: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
117
+ readonly fileSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
118
+ readonly fileEncSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
119
+ /** The upload's URL: a phone does not show a photo or a video whose message lacks it. */
120
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
121
+ readonly mediaKeyTimestamp: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
122
+ }, undefined>;
123
+ /**
124
+ * A download's answer: the new path when the phone had to upload the file again, `null` when WhatsApp still kept it.
125
+ * The key stays that of the stored ref; the checksums come too when the phone encrypted the file again.
126
+ */
127
+ export declare const waDownloaded: v.NullableSchema<v.StrictObjectSchema<{
128
+ readonly directPath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
129
+ readonly fileSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
130
+ readonly fileEncSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
131
+ }, undefined>, undefined>;
132
+ /** A place as its message carried it, kept so a forward sends it again; `geo:` in `url` rounds the coordinates. */
133
+ export declare const waPlaceRef: v.StrictObjectSchema<{
134
+ readonly place: v.StrictObjectSchema<{
135
+ readonly latitude: v.NumberSchema<undefined>;
136
+ readonly longitude: v.NumberSchema<undefined>;
137
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
138
+ readonly address: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
139
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
140
+ }, undefined>;
141
+ }, undefined>;
142
+ /**
143
+ * A contact card as its message carried it, kept so a forward sends it again. The vCard holds a phone number: it
144
+ * stays in the opaque `providerRef`, which cli-core never prints, and never reaches a log or an error.
145
+ */
146
+ export declare const waCardRef: v.StrictObjectSchema<{
147
+ readonly card: v.StrictObjectSchema<{
148
+ readonly name: v.StringSchema<undefined>;
149
+ readonly vcard: v.StringSchema<undefined>;
150
+ }, undefined>;
151
+ }, undefined>;
152
+ /**
153
+ * cli-core's Attachment in WhatsApp's terms: `photo`, `video`, `voice`, `audio`, `document`, `sticker`, `location`
154
+ * (`url` is a `geo:` link), `contact` (its name; the card itself only in `ref`). `ref` is a file's keys, or what a
155
+ * place or a contact card needs to be sent again; a live location has none.
156
+ */
157
+ export declare const waAttachment: v.StrictObjectSchema<{
158
+ readonly kind: v.PicklistSchema<["photo", "video", "voice", "audio", "document", "sticker", "location", "contact"], undefined>;
159
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
160
+ readonly width: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
161
+ readonly height: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
162
+ readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
163
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
164
+ readonly size: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
165
+ readonly mime: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
166
+ readonly duration: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
167
+ readonly ref: v.OptionalSchema<v.UnionSchema<[v.StrictObjectSchema<{
168
+ readonly media: v.PicklistSchema<["image", "video", "audio", "document", "sticker"], undefined>;
169
+ readonly directPath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
170
+ readonly mediaKey: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
171
+ readonly fileSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
172
+ readonly fileEncSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
173
+ /** The upload's URL: a phone does not show a photo or a video whose message lacks it. */
174
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
175
+ readonly mediaKeyTimestamp: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
176
+ }, undefined>, v.StrictObjectSchema<{
177
+ readonly place: v.StrictObjectSchema<{
178
+ readonly latitude: v.NumberSchema<undefined>;
179
+ readonly longitude: v.NumberSchema<undefined>;
180
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
181
+ readonly address: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
182
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
183
+ }, undefined>;
184
+ }, undefined>, v.StrictObjectSchema<{
185
+ readonly card: v.StrictObjectSchema<{
186
+ readonly name: v.StringSchema<undefined>;
187
+ readonly vcard: v.StringSchema<undefined>;
188
+ }, undefined>;
189
+ }, undefined>], undefined>, undefined>;
190
+ }, undefined>;
191
+ /**
192
+ * A poll as its message carries it. An answer's `id` is the start of the SHA-256 of its text, which is what a vote
193
+ * names on the wire. Votes arrive later, live as `vote` events or in a history push's `votes`; cli-core's store
194
+ * counts them.
195
+ */
196
+ export declare const waPoll: v.StrictObjectSchema<{
197
+ readonly question: v.StringSchema<undefined>;
198
+ readonly answers: v.ArraySchema<v.StrictObjectSchema<{
199
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
200
+ readonly text: v.StringSchema<undefined>;
201
+ }, undefined>, undefined>;
202
+ readonly multiple: v.BooleanSchema<undefined>;
203
+ }, undefined>;
204
+ export declare const waMessage: v.StrictObjectSchema<{
205
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
206
+ readonly chat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
207
+ readonly sender: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>, undefined>;
208
+ readonly senderName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
209
+ readonly fromMe: v.BooleanSchema<undefined>;
210
+ readonly timestamp: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
211
+ readonly editedAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
212
+ readonly text: v.StringSchema<undefined>;
213
+ readonly replyTo: v.NullableSchema<v.StringSchema<undefined>, undefined>;
214
+ readonly attachments: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
215
+ readonly kind: v.PicklistSchema<["photo", "video", "voice", "audio", "document", "sticker", "location", "contact"], undefined>;
216
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
217
+ readonly width: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
218
+ readonly height: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
219
+ readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
220
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
221
+ readonly size: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
222
+ readonly mime: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
223
+ readonly duration: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
224
+ readonly ref: v.OptionalSchema<v.UnionSchema<[v.StrictObjectSchema<{
225
+ readonly media: v.PicklistSchema<["image", "video", "audio", "document", "sticker"], undefined>;
226
+ readonly directPath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
227
+ readonly mediaKey: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
228
+ readonly fileSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
229
+ readonly fileEncSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
230
+ /** The upload's URL: a phone does not show a photo or a video whose message lacks it. */
231
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
232
+ readonly mediaKeyTimestamp: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
233
+ }, undefined>, v.StrictObjectSchema<{
234
+ readonly place: v.StrictObjectSchema<{
235
+ readonly latitude: v.NumberSchema<undefined>;
236
+ readonly longitude: v.NumberSchema<undefined>;
237
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
238
+ readonly address: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
239
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
240
+ }, undefined>;
241
+ }, undefined>, v.StrictObjectSchema<{
242
+ readonly card: v.StrictObjectSchema<{
243
+ readonly name: v.StringSchema<undefined>;
244
+ readonly vcard: v.StringSchema<undefined>;
245
+ }, undefined>;
246
+ }, undefined>], undefined>, undefined>;
247
+ }, undefined>, undefined>, undefined>;
248
+ readonly poll: v.OptionalSchema<v.StrictObjectSchema<{
249
+ readonly question: v.StringSchema<undefined>;
250
+ readonly answers: v.ArraySchema<v.StrictObjectSchema<{
251
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
252
+ readonly text: v.StringSchema<undefined>;
253
+ }, undefined>, undefined>;
254
+ readonly multiple: v.BooleanSchema<undefined>;
255
+ }, undefined>, undefined>;
256
+ /** Only ever `true`, on a pushed message the owner starred: a push may be older than a star taken off since. */
257
+ readonly starred: v.OptionalSchema<v.LiteralSchema<true, undefined>, undefined>;
258
+ /** A channel post's number on WhatsApp's servers: a channel's history is read back from it. */
259
+ readonly serverId: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
260
+ }, undefined>;
261
+ /**
262
+ * One person's newest choice in a poll: `selected` is the full SHA-256 of each chosen answer's text, and none takes
263
+ * the vote back. `voter` is in LID form like a sender, and the account's own vote is under `self()`. A vote in a
264
+ * history push carries its `poll`, since the push may not hold that poll; a live `vote` event has none. `votedAt` is
265
+ * when the voter cast it, by WhatsApp's clock: the store keeps a voter's newest vote by it.
266
+ */
267
+ export declare const waVote: v.StrictObjectSchema<{
268
+ readonly chat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
269
+ readonly message: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
270
+ readonly voter: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
271
+ readonly voterName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
272
+ readonly selected: v.ArraySchema<v.StringSchema<undefined>, undefined>;
273
+ readonly votedAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
274
+ readonly poll: v.OptionalSchema<v.StrictObjectSchema<{
275
+ readonly question: v.StringSchema<undefined>;
276
+ readonly answers: v.ArraySchema<v.StrictObjectSchema<{
277
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
278
+ readonly text: v.StringSchema<undefined>;
279
+ }, undefined>, undefined>;
280
+ readonly multiple: v.BooleanSchema<undefined>;
281
+ }, undefined>, undefined>;
282
+ }, undefined>;
283
+ /**
284
+ * A one-to-one chat the engine emitted before in phone form (`from`), now named by its person's LID (`to`). The store
285
+ * moves the old chat to the new id before anything under the new id lands. The engine repeats a re-key for a while,
286
+ * since the CLI may not have been listening; a repeat changes nothing.
287
+ */
288
+ export declare const waRekey: v.StrictObjectSchema<{
289
+ readonly from: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
290
+ readonly to: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
291
+ }, undefined>;
292
+ /**
293
+ * Who joined, left, was added, removed, promoted or demoted in a group, or its new title, live or from the group's
294
+ * service message in a history push. WhatsApp gives a live change no id, so `id` is derived from the chat, the time in
295
+ * seconds, the action and the sorted people: both paths give one change the same id, and the store keeps it once.
296
+ * `by` and `people` are in LID form like a sender; `by` is `null` where WhatsApp did not say who.
297
+ */
298
+ export declare const waChatEvent: v.StrictObjectSchema<{
299
+ readonly chat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
300
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
301
+ readonly timestamp: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
302
+ readonly event: v.PicklistSchema<["join", "leave", "add", "remove", "promote", "demote", "title"], undefined>;
303
+ readonly by: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>, undefined>;
304
+ readonly byName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
305
+ readonly people: v.ArraySchema<v.StrictObjectSchema<{
306
+ readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
307
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
308
+ }, undefined>, undefined>;
309
+ readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
310
+ }, undefined>;
311
+ /**
312
+ * One push from the phone. `kind` follows whatsmeow's sync types; the adapter treats them all alike. `votes` are the
313
+ * votes in the pushed polls, which the store saves with the push, not as `vote` events. `events` are the groups'
314
+ * service messages in the push, which come as no message. `rekeys` apply first.
315
+ */
316
+ export declare const waHistory: v.StrictObjectSchema<{
317
+ readonly kind: v.PicklistSchema<["bootstrap", "recent", "full", "on_demand", "push_name", "other"], undefined>;
318
+ readonly chats: v.ArraySchema<v.StrictObjectSchema<{
319
+ readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
320
+ /**
321
+ * `unread` and `lastMessageAt` are absent when the source does not say. Only a notice, such as a group leaving its
322
+ * community, leaves out `name` and `participants`: a pushed chat keeps the stored value of whatever is absent.
323
+ */
324
+ readonly name: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
325
+ readonly kind: v.PicklistSchema<["dm", "self", "group", "newsletter", "broadcast"], undefined>;
326
+ readonly unread: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
327
+ readonly lastMessageAt: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>, undefined>;
328
+ readonly participants: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
329
+ readonly archived: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
330
+ readonly muted: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
331
+ /** The community a group is linked to; `null` when a live read says it is in none, absent when nothing said. */
332
+ readonly parent: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>, undefined>, undefined>;
333
+ /** A community itself: a group that holds other groups. */
334
+ readonly community: v.OptionalSchema<v.LiteralSchema<true, undefined>, undefined>;
335
+ /**
336
+ * `left` when WhatsApp said the owner left the group or was removed, `member` when it said the owner was added back;
337
+ * never `null`, which clears `archived` too.
338
+ */
339
+ readonly membershipState: v.OptionalSchema<v.PicklistSchema<["left", "member"], undefined>, undefined>;
340
+ }, undefined>, undefined>;
341
+ readonly contacts: v.ArraySchema<v.StrictObjectSchema<{
342
+ readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
343
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
344
+ }, undefined>, undefined>;
345
+ readonly messages: v.ArraySchema<v.StrictObjectSchema<{
346
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
347
+ readonly chat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
348
+ readonly sender: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>, undefined>;
349
+ readonly senderName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
350
+ readonly fromMe: v.BooleanSchema<undefined>;
351
+ readonly timestamp: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
352
+ readonly editedAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
353
+ readonly text: v.StringSchema<undefined>;
354
+ readonly replyTo: v.NullableSchema<v.StringSchema<undefined>, undefined>;
355
+ readonly attachments: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
356
+ readonly kind: v.PicklistSchema<["photo", "video", "voice", "audio", "document", "sticker", "location", "contact"], undefined>;
357
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
358
+ readonly width: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
359
+ readonly height: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
360
+ readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
361
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
362
+ readonly size: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
363
+ readonly mime: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
364
+ readonly duration: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
365
+ readonly ref: v.OptionalSchema<v.UnionSchema<[v.StrictObjectSchema<{
366
+ readonly media: v.PicklistSchema<["image", "video", "audio", "document", "sticker"], undefined>;
367
+ readonly directPath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
368
+ readonly mediaKey: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
369
+ readonly fileSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
370
+ readonly fileEncSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
371
+ /** The upload's URL: a phone does not show a photo or a video whose message lacks it. */
372
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
373
+ readonly mediaKeyTimestamp: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
374
+ }, undefined>, v.StrictObjectSchema<{
375
+ readonly place: v.StrictObjectSchema<{
376
+ readonly latitude: v.NumberSchema<undefined>;
377
+ readonly longitude: v.NumberSchema<undefined>;
378
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
379
+ readonly address: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
380
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
381
+ }, undefined>;
382
+ }, undefined>, v.StrictObjectSchema<{
383
+ readonly card: v.StrictObjectSchema<{
384
+ readonly name: v.StringSchema<undefined>;
385
+ readonly vcard: v.StringSchema<undefined>;
386
+ }, undefined>;
387
+ }, undefined>], undefined>, undefined>;
388
+ }, undefined>, undefined>, undefined>;
389
+ readonly poll: v.OptionalSchema<v.StrictObjectSchema<{
390
+ readonly question: v.StringSchema<undefined>;
391
+ readonly answers: v.ArraySchema<v.StrictObjectSchema<{
392
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
393
+ readonly text: v.StringSchema<undefined>;
394
+ }, undefined>, undefined>;
395
+ readonly multiple: v.BooleanSchema<undefined>;
396
+ }, undefined>, undefined>;
397
+ /** Only ever `true`, on a pushed message the owner starred: a push may be older than a star taken off since. */
398
+ readonly starred: v.OptionalSchema<v.LiteralSchema<true, undefined>, undefined>;
399
+ /** A channel post's number on WhatsApp's servers: a channel's history is read back from it. */
400
+ readonly serverId: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
401
+ }, undefined>, undefined>;
402
+ readonly votes: v.ArraySchema<v.StrictObjectSchema<{
403
+ readonly chat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
404
+ readonly message: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
405
+ readonly voter: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
406
+ readonly voterName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
407
+ readonly selected: v.ArraySchema<v.StringSchema<undefined>, undefined>;
408
+ readonly votedAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
409
+ readonly poll: v.OptionalSchema<v.StrictObjectSchema<{
410
+ readonly question: v.StringSchema<undefined>;
411
+ readonly answers: v.ArraySchema<v.StrictObjectSchema<{
412
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
413
+ readonly text: v.StringSchema<undefined>;
414
+ }, undefined>, undefined>;
415
+ readonly multiple: v.BooleanSchema<undefined>;
416
+ }, undefined>, undefined>;
417
+ }, undefined>, undefined>;
418
+ readonly rekeys: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
419
+ readonly from: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
420
+ readonly to: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
421
+ }, undefined>, undefined>, undefined>;
422
+ readonly events: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
423
+ readonly chat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
424
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
425
+ readonly timestamp: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
426
+ readonly event: v.PicklistSchema<["join", "leave", "add", "remove", "promote", "demote", "title"], undefined>;
427
+ readonly by: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>, undefined>;
428
+ readonly byName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
429
+ readonly people: v.ArraySchema<v.StrictObjectSchema<{
430
+ readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
431
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
432
+ }, undefined>, undefined>;
433
+ readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
434
+ }, undefined>, undefined>, undefined>;
435
+ }, undefined>;
436
+ /**
437
+ * The phone's answer to `older`: the chat's messages sent before the anchor, as many as were asked or fewer. No
438
+ * messages and `more: false` is the chat's start. The engine never answers no messages with `more: true`: a batch of
439
+ * only messages the contract skips is asked past, since cli-core reads any empty page as the start.
440
+ */
441
+ export declare const waOlder: v.StrictObjectSchema<{
442
+ readonly messages: v.ArraySchema<v.StrictObjectSchema<{
443
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
444
+ readonly chat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
445
+ readonly sender: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>, undefined>;
446
+ readonly senderName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
447
+ readonly fromMe: v.BooleanSchema<undefined>;
448
+ readonly timestamp: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
449
+ readonly editedAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
450
+ readonly text: v.StringSchema<undefined>;
451
+ readonly replyTo: v.NullableSchema<v.StringSchema<undefined>, undefined>;
452
+ readonly attachments: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
453
+ readonly kind: v.PicklistSchema<["photo", "video", "voice", "audio", "document", "sticker", "location", "contact"], undefined>;
454
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
455
+ readonly width: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
456
+ readonly height: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
457
+ readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
458
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
459
+ readonly size: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
460
+ readonly mime: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
461
+ readonly duration: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
462
+ readonly ref: v.OptionalSchema<v.UnionSchema<[v.StrictObjectSchema<{
463
+ readonly media: v.PicklistSchema<["image", "video", "audio", "document", "sticker"], undefined>;
464
+ readonly directPath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
465
+ readonly mediaKey: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
466
+ readonly fileSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
467
+ readonly fileEncSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
468
+ /** The upload's URL: a phone does not show a photo or a video whose message lacks it. */
469
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
470
+ readonly mediaKeyTimestamp: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
471
+ }, undefined>, v.StrictObjectSchema<{
472
+ readonly place: v.StrictObjectSchema<{
473
+ readonly latitude: v.NumberSchema<undefined>;
474
+ readonly longitude: v.NumberSchema<undefined>;
475
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
476
+ readonly address: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
477
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
478
+ }, undefined>;
479
+ }, undefined>, v.StrictObjectSchema<{
480
+ readonly card: v.StrictObjectSchema<{
481
+ readonly name: v.StringSchema<undefined>;
482
+ readonly vcard: v.StringSchema<undefined>;
483
+ }, undefined>;
484
+ }, undefined>], undefined>, undefined>;
485
+ }, undefined>, undefined>, undefined>;
486
+ readonly poll: v.OptionalSchema<v.StrictObjectSchema<{
487
+ readonly question: v.StringSchema<undefined>;
488
+ readonly answers: v.ArraySchema<v.StrictObjectSchema<{
489
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
490
+ readonly text: v.StringSchema<undefined>;
491
+ }, undefined>, undefined>;
492
+ readonly multiple: v.BooleanSchema<undefined>;
493
+ }, undefined>, undefined>;
494
+ /** Only ever `true`, on a pushed message the owner starred: a push may be older than a star taken off since. */
495
+ readonly starred: v.OptionalSchema<v.LiteralSchema<true, undefined>, undefined>;
496
+ /** A channel post's number on WhatsApp's servers: a channel's history is read back from it. */
497
+ readonly serverId: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
498
+ }, undefined>, undefined>;
499
+ readonly more: v.BooleanSchema<undefined>;
500
+ }, undefined>;
501
+ /** `outdated`: WhatsApp refuses this engine's version. `stopped`: the engine process ended without being asked. */
502
+ export declare const connectionState: v.PicklistSchema<["connected", "disconnected", "logged_out", "replaced", "banned", "outdated", "stopped"], undefined>;
503
+ export declare const engineEvent: v.VariantSchema<"event", [v.StrictObjectSchema<{
504
+ readonly event: v.LiteralSchema<"history", undefined>;
505
+ readonly history: v.StrictObjectSchema<{
506
+ readonly kind: v.PicklistSchema<["bootstrap", "recent", "full", "on_demand", "push_name", "other"], undefined>;
507
+ readonly chats: v.ArraySchema<v.StrictObjectSchema<{
508
+ readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
509
+ /**
510
+ * `unread` and `lastMessageAt` are absent when the source does not say. Only a notice, such as a group leaving its
511
+ * community, leaves out `name` and `participants`: a pushed chat keeps the stored value of whatever is absent.
512
+ */
513
+ readonly name: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
514
+ readonly kind: v.PicklistSchema<["dm", "self", "group", "newsletter", "broadcast"], undefined>;
515
+ readonly unread: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
516
+ readonly lastMessageAt: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>, undefined>;
517
+ readonly participants: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
518
+ readonly archived: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
519
+ readonly muted: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
520
+ /** The community a group is linked to; `null` when a live read says it is in none, absent when nothing said. */
521
+ readonly parent: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>, undefined>, undefined>;
522
+ /** A community itself: a group that holds other groups. */
523
+ readonly community: v.OptionalSchema<v.LiteralSchema<true, undefined>, undefined>;
524
+ /**
525
+ * `left` when WhatsApp said the owner left the group or was removed, `member` when it said the owner was added back;
526
+ * never `null`, which clears `archived` too.
527
+ */
528
+ readonly membershipState: v.OptionalSchema<v.PicklistSchema<["left", "member"], undefined>, undefined>;
529
+ }, undefined>, undefined>;
530
+ readonly contacts: v.ArraySchema<v.StrictObjectSchema<{
531
+ readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
532
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
533
+ }, undefined>, undefined>;
534
+ readonly messages: v.ArraySchema<v.StrictObjectSchema<{
535
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
536
+ readonly chat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
537
+ readonly sender: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>, undefined>;
538
+ readonly senderName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
539
+ readonly fromMe: v.BooleanSchema<undefined>;
540
+ readonly timestamp: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
541
+ readonly editedAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
542
+ readonly text: v.StringSchema<undefined>;
543
+ readonly replyTo: v.NullableSchema<v.StringSchema<undefined>, undefined>;
544
+ readonly attachments: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
545
+ readonly kind: v.PicklistSchema<["photo", "video", "voice", "audio", "document", "sticker", "location", "contact"], undefined>;
546
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
547
+ readonly width: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
548
+ readonly height: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
549
+ readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
550
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
551
+ readonly size: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
552
+ readonly mime: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
553
+ readonly duration: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
554
+ readonly ref: v.OptionalSchema<v.UnionSchema<[v.StrictObjectSchema<{
555
+ readonly media: v.PicklistSchema<["image", "video", "audio", "document", "sticker"], undefined>;
556
+ readonly directPath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
557
+ readonly mediaKey: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
558
+ readonly fileSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
559
+ readonly fileEncSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
560
+ /** The upload's URL: a phone does not show a photo or a video whose message lacks it. */
561
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
562
+ readonly mediaKeyTimestamp: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
563
+ }, undefined>, v.StrictObjectSchema<{
564
+ readonly place: v.StrictObjectSchema<{
565
+ readonly latitude: v.NumberSchema<undefined>;
566
+ readonly longitude: v.NumberSchema<undefined>;
567
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
568
+ readonly address: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
569
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
570
+ }, undefined>;
571
+ }, undefined>, v.StrictObjectSchema<{
572
+ readonly card: v.StrictObjectSchema<{
573
+ readonly name: v.StringSchema<undefined>;
574
+ readonly vcard: v.StringSchema<undefined>;
575
+ }, undefined>;
576
+ }, undefined>], undefined>, undefined>;
577
+ }, undefined>, undefined>, undefined>;
578
+ readonly poll: v.OptionalSchema<v.StrictObjectSchema<{
579
+ readonly question: v.StringSchema<undefined>;
580
+ readonly answers: v.ArraySchema<v.StrictObjectSchema<{
581
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
582
+ readonly text: v.StringSchema<undefined>;
583
+ }, undefined>, undefined>;
584
+ readonly multiple: v.BooleanSchema<undefined>;
585
+ }, undefined>, undefined>;
586
+ /** Only ever `true`, on a pushed message the owner starred: a push may be older than a star taken off since. */
587
+ readonly starred: v.OptionalSchema<v.LiteralSchema<true, undefined>, undefined>;
588
+ /** A channel post's number on WhatsApp's servers: a channel's history is read back from it. */
589
+ readonly serverId: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
590
+ }, undefined>, undefined>;
591
+ readonly votes: v.ArraySchema<v.StrictObjectSchema<{
592
+ readonly chat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
593
+ readonly message: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
594
+ readonly voter: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
595
+ readonly voterName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
596
+ readonly selected: v.ArraySchema<v.StringSchema<undefined>, undefined>;
597
+ readonly votedAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
598
+ readonly poll: v.OptionalSchema<v.StrictObjectSchema<{
599
+ readonly question: v.StringSchema<undefined>;
600
+ readonly answers: v.ArraySchema<v.StrictObjectSchema<{
601
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
602
+ readonly text: v.StringSchema<undefined>;
603
+ }, undefined>, undefined>;
604
+ readonly multiple: v.BooleanSchema<undefined>;
605
+ }, undefined>, undefined>;
606
+ }, undefined>, undefined>;
607
+ readonly rekeys: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
608
+ readonly from: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
609
+ readonly to: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
610
+ }, undefined>, undefined>, undefined>;
611
+ readonly events: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
612
+ readonly chat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
613
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
614
+ readonly timestamp: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
615
+ readonly event: v.PicklistSchema<["join", "leave", "add", "remove", "promote", "demote", "title"], undefined>;
616
+ readonly by: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>, undefined>;
617
+ readonly byName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
618
+ readonly people: v.ArraySchema<v.StrictObjectSchema<{
619
+ readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
620
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
621
+ }, undefined>, undefined>;
622
+ readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
623
+ }, undefined>, undefined>, undefined>;
624
+ }, undefined>;
625
+ }, undefined>, v.StrictObjectSchema<{
626
+ readonly event: v.LiteralSchema<"message", undefined>;
627
+ readonly message: v.StrictObjectSchema<{
628
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
629
+ readonly chat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
630
+ readonly sender: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>, undefined>;
631
+ readonly senderName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
632
+ readonly fromMe: v.BooleanSchema<undefined>;
633
+ readonly timestamp: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
634
+ readonly editedAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
635
+ readonly text: v.StringSchema<undefined>;
636
+ readonly replyTo: v.NullableSchema<v.StringSchema<undefined>, undefined>;
637
+ readonly attachments: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
638
+ readonly kind: v.PicklistSchema<["photo", "video", "voice", "audio", "document", "sticker", "location", "contact"], undefined>;
639
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
640
+ readonly width: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
641
+ readonly height: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
642
+ readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
643
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
644
+ readonly size: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
645
+ readonly mime: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
646
+ readonly duration: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
647
+ readonly ref: v.OptionalSchema<v.UnionSchema<[v.StrictObjectSchema<{
648
+ readonly media: v.PicklistSchema<["image", "video", "audio", "document", "sticker"], undefined>;
649
+ readonly directPath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
650
+ readonly mediaKey: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
651
+ readonly fileSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
652
+ readonly fileEncSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
653
+ /** The upload's URL: a phone does not show a photo or a video whose message lacks it. */
654
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
655
+ readonly mediaKeyTimestamp: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
656
+ }, undefined>, v.StrictObjectSchema<{
657
+ readonly place: v.StrictObjectSchema<{
658
+ readonly latitude: v.NumberSchema<undefined>;
659
+ readonly longitude: v.NumberSchema<undefined>;
660
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
661
+ readonly address: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
662
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
663
+ }, undefined>;
664
+ }, undefined>, v.StrictObjectSchema<{
665
+ readonly card: v.StrictObjectSchema<{
666
+ readonly name: v.StringSchema<undefined>;
667
+ readonly vcard: v.StringSchema<undefined>;
668
+ }, undefined>;
669
+ }, undefined>], undefined>, undefined>;
670
+ }, undefined>, undefined>, undefined>;
671
+ readonly poll: v.OptionalSchema<v.StrictObjectSchema<{
672
+ readonly question: v.StringSchema<undefined>;
673
+ readonly answers: v.ArraySchema<v.StrictObjectSchema<{
674
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
675
+ readonly text: v.StringSchema<undefined>;
676
+ }, undefined>, undefined>;
677
+ readonly multiple: v.BooleanSchema<undefined>;
678
+ }, undefined>, undefined>;
679
+ /** Only ever `true`, on a pushed message the owner starred: a push may be older than a star taken off since. */
680
+ readonly starred: v.OptionalSchema<v.LiteralSchema<true, undefined>, undefined>;
681
+ /** A channel post's number on WhatsApp's servers: a channel's history is read back from it. */
682
+ readonly serverId: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
683
+ }, undefined>;
684
+ }, undefined>, v.StrictObjectSchema<{
685
+ readonly event: v.LiteralSchema<"edit", undefined>;
686
+ readonly message: v.StrictObjectSchema<{
687
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
688
+ readonly chat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
689
+ readonly sender: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>, undefined>;
690
+ readonly senderName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
691
+ readonly fromMe: v.BooleanSchema<undefined>;
692
+ readonly timestamp: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
693
+ readonly editedAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
694
+ readonly text: v.StringSchema<undefined>;
695
+ readonly replyTo: v.NullableSchema<v.StringSchema<undefined>, undefined>;
696
+ readonly attachments: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
697
+ readonly kind: v.PicklistSchema<["photo", "video", "voice", "audio", "document", "sticker", "location", "contact"], undefined>;
698
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
699
+ readonly width: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
700
+ readonly height: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
701
+ readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
702
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
703
+ readonly size: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
704
+ readonly mime: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
705
+ readonly duration: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
706
+ readonly ref: v.OptionalSchema<v.UnionSchema<[v.StrictObjectSchema<{
707
+ readonly media: v.PicklistSchema<["image", "video", "audio", "document", "sticker"], undefined>;
708
+ readonly directPath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
709
+ readonly mediaKey: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
710
+ readonly fileSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
711
+ readonly fileEncSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
712
+ /** The upload's URL: a phone does not show a photo or a video whose message lacks it. */
713
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
714
+ readonly mediaKeyTimestamp: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
715
+ }, undefined>, v.StrictObjectSchema<{
716
+ readonly place: v.StrictObjectSchema<{
717
+ readonly latitude: v.NumberSchema<undefined>;
718
+ readonly longitude: v.NumberSchema<undefined>;
719
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
720
+ readonly address: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
721
+ readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
722
+ }, undefined>;
723
+ }, undefined>, v.StrictObjectSchema<{
724
+ readonly card: v.StrictObjectSchema<{
725
+ readonly name: v.StringSchema<undefined>;
726
+ readonly vcard: v.StringSchema<undefined>;
727
+ }, undefined>;
728
+ }, undefined>], undefined>, undefined>;
729
+ }, undefined>, undefined>, undefined>;
730
+ readonly poll: v.OptionalSchema<v.StrictObjectSchema<{
731
+ readonly question: v.StringSchema<undefined>;
732
+ readonly answers: v.ArraySchema<v.StrictObjectSchema<{
733
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
734
+ readonly text: v.StringSchema<undefined>;
735
+ }, undefined>, undefined>;
736
+ readonly multiple: v.BooleanSchema<undefined>;
737
+ }, undefined>, undefined>;
738
+ /** Only ever `true`, on a pushed message the owner starred: a push may be older than a star taken off since. */
739
+ readonly starred: v.OptionalSchema<v.LiteralSchema<true, undefined>, undefined>;
740
+ /** A channel post's number on WhatsApp's servers: a channel's history is read back from it. */
741
+ readonly serverId: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
742
+ }, undefined>;
743
+ }, undefined>, v.StrictObjectSchema<{
744
+ readonly event: v.LiteralSchema<"delete", undefined>;
745
+ readonly chat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
746
+ readonly id: v.StringSchema<undefined>;
747
+ }, undefined>, v.StrictObjectSchema<{
748
+ readonly event: v.LiteralSchema<"vote", undefined>;
749
+ readonly vote: v.StrictObjectSchema<{
750
+ readonly chat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
751
+ readonly message: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
752
+ readonly voter: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
753
+ readonly voterName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
754
+ readonly selected: v.ArraySchema<v.StringSchema<undefined>, undefined>;
755
+ readonly votedAt: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
756
+ readonly poll: v.OptionalSchema<v.StrictObjectSchema<{
757
+ readonly question: v.StringSchema<undefined>;
758
+ readonly answers: v.ArraySchema<v.StrictObjectSchema<{
759
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
760
+ readonly text: v.StringSchema<undefined>;
761
+ }, undefined>, undefined>;
762
+ readonly multiple: v.BooleanSchema<undefined>;
763
+ }, undefined>, undefined>;
764
+ }, undefined>;
765
+ }, undefined>, v.StrictObjectSchema<{
766
+ readonly event: v.LiteralSchema<"chat_event", undefined>;
767
+ readonly change: v.StrictObjectSchema<{
768
+ readonly chat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
769
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
770
+ readonly timestamp: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
771
+ readonly event: v.PicklistSchema<["join", "leave", "add", "remove", "promote", "demote", "title"], undefined>;
772
+ readonly by: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>, undefined>;
773
+ readonly byName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
774
+ readonly people: v.ArraySchema<v.StrictObjectSchema<{
775
+ readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
776
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
777
+ }, undefined>, undefined>;
778
+ readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
779
+ }, undefined>;
780
+ }, undefined>, v.StrictObjectSchema<{
781
+ readonly event: v.LiteralSchema<"star", undefined>;
782
+ readonly chat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
783
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
784
+ readonly starred: v.BooleanSchema<undefined>;
785
+ }, undefined>, v.StrictObjectSchema<{
786
+ readonly from: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
787
+ readonly to: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
788
+ readonly event: v.LiteralSchema<"rekey", undefined>;
789
+ }, undefined>, v.StrictObjectSchema<{
790
+ readonly event: v.LiteralSchema<"connection", undefined>;
791
+ readonly state: v.PicklistSchema<["connected", "disconnected", "logged_out", "replaced", "banned", "outdated", "stopped"], undefined>;
792
+ readonly until: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
793
+ }, undefined>], undefined>;
794
+ export declare const engineErrorCode: v.PicklistSchema<["validation_error", "authentication_error", "permission_error", "not_found", "rate_limited", "timeout", "network_error", "provider_error", "provider_unavailable", "outcome_unknown"], undefined>;
795
+ /**
796
+ * Why, for the refusals an agent recovers from differently than their code says: another process holds the device
797
+ * (`device.in-use`), WhatsApp handed the login to another connection (`device.replaced`), logged the device out, refuses
798
+ * this version (`client.outdated`), banned the account, or asked it to slow down (`account.rate-limited`, never the
799
+ * engine's own lookup pace), or has not yet sent the keys a settings change is sealed with (`settings.keys-missing`).
800
+ * A download WhatsApp no longer keeps the file for says how asking the phone to upload it again ended (`media.*`), or
801
+ * that the engine stopped while it waited (`engine.stopped`). The CLI registers each one (`src/reasons.ts`).
802
+ */
803
+ export declare const engineReason: v.PicklistSchema<["device.in-use", "device.replaced", "device.logged-out", "client.outdated", "account.banned", "account.rate-limited", "settings.keys-missing", "media.not-on-phone", "media.phone-cannot-decrypt", "media.phone-answer-unreadable", "media.phone-failed", "media.phone-timeout", "media.retry-failed", "engine.stopped"], undefined>;
804
+ export declare const engineError: v.StrictObjectSchema<{
805
+ readonly code: v.PicklistSchema<["validation_error", "authentication_error", "permission_error", "not_found", "rate_limited", "timeout", "network_error", "provider_error", "provider_unavailable", "outcome_unknown"], undefined>;
806
+ readonly message: v.StringSchema<undefined>;
807
+ readonly reason: v.OptionalSchema<v.PicklistSchema<["device.in-use", "device.replaced", "device.logged-out", "client.outdated", "account.banned", "account.rate-limited", "settings.keys-missing", "media.not-on-phone", "media.phone-cannot-decrypt", "media.phone-answer-unreadable", "media.phone-failed", "media.phone-timeout", "media.retry-failed", "engine.stopped"], undefined>, undefined>;
808
+ /** When a temporary ban ends, if WhatsApp said. */
809
+ readonly until: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
810
+ }, undefined>;
811
+ /** The engine's first line: its protocol and the linked account (`self()`), or `null` before a login. */
812
+ export declare const hello: v.StrictObjectSchema<{
813
+ readonly protocol: v.NumberSchema<undefined>;
814
+ readonly engine: v.StringSchema<undefined>;
815
+ readonly version: v.StringSchema<undefined>;
816
+ readonly self: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>, undefined>;
817
+ }, undefined>;
818
+ export declare const waAccount: v.StrictObjectSchema<{
819
+ readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
820
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
821
+ }, undefined>;
822
+ export declare const waChatCard: v.StrictObjectSchema<{
823
+ readonly chat: v.StrictObjectSchema<{
824
+ readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
825
+ /**
826
+ * `unread` and `lastMessageAt` are absent when the source does not say. Only a notice, such as a group leaving its
827
+ * community, leaves out `name` and `participants`: a pushed chat keeps the stored value of whatever is absent.
828
+ */
829
+ readonly name: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
830
+ readonly kind: v.PicklistSchema<["dm", "self", "group", "newsletter", "broadcast"], undefined>;
831
+ readonly unread: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
832
+ readonly lastMessageAt: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>, undefined>;
833
+ readonly participants: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
834
+ readonly archived: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
835
+ readonly muted: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
836
+ /** The community a group is linked to; `null` when a live read says it is in none, absent when nothing said. */
837
+ readonly parent: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>, undefined>, undefined>;
838
+ /** A community itself: a group that holds other groups. */
839
+ readonly community: v.OptionalSchema<v.LiteralSchema<true, undefined>, undefined>;
840
+ /**
841
+ * `left` when WhatsApp said the owner left the group or was removed, `member` when it said the owner was added back;
842
+ * never `null`, which clears `archived` too.
843
+ */
844
+ readonly membershipState: v.OptionalSchema<v.PicklistSchema<["left", "member"], undefined>, undefined>;
845
+ }, undefined>;
846
+ readonly members: v.NullableSchema<v.ArraySchema<v.StrictObjectSchema<{
847
+ readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
848
+ readonly name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
849
+ }, undefined>, undefined>, undefined>;
850
+ }, undefined>;
851
+ /**
852
+ * A code to show while linking: `qr` is the text of a QR code to draw, `pair` the eight characters to type on the
853
+ * phone. Either one links the account for as long as it is valid, so it is shown and never stored or logged.
854
+ */
855
+ export declare const loginCode: v.StrictObjectSchema<{
856
+ readonly login: v.PicklistSchema<["qr", "pair"], undefined>;
857
+ readonly code: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
858
+ }, undefined>;
859
+ export type WaChat = v.InferOutput<typeof waChat>;
860
+ export type WaContact = v.InferOutput<typeof waContact>;
861
+ export type WaMessage = v.InferOutput<typeof waMessage>;
862
+ export type WaPoll = v.InferOutput<typeof waPoll>;
863
+ export type WaVote = v.InferOutput<typeof waVote>;
864
+ export type WaChatEvent = v.InferOutput<typeof waChatEvent>;
865
+ export type WaMediaRef = v.InferOutput<typeof waMediaRef>;
866
+ export type WaDownloaded = v.InferOutput<typeof waDownloaded>;
867
+ export type WaPlaceRef = v.InferOutput<typeof waPlaceRef>;
868
+ export type WaCardRef = v.InferOutput<typeof waCardRef>;
869
+ export type WaAttachment = v.InferOutput<typeof waAttachment>;
870
+ export type WaHistory = v.InferOutput<typeof waHistory>;
871
+ export type WaRekey = v.InferOutput<typeof waRekey>;
872
+ export type EngineEvent = v.InferOutput<typeof engineEvent>;
873
+ export type ConnectionState = v.InferOutput<typeof connectionState>;
874
+ export type EngineErrorCode = v.InferOutput<typeof engineErrorCode>;
875
+ export type EngineReason = v.InferOutput<typeof engineReason>;
876
+ /** The engine's reasons, and the client's own for an engine that ended, before a request or during a write. */
877
+ export type WaReason = EngineReason | "engine.stopped" | "engine.stopped-mid-write";
878
+ export type Hello = v.InferOutput<typeof hello>;
879
+ export type WaAccount = v.InferOutput<typeof waAccount>;
880
+ export type WaChatCard = v.InferOutput<typeof waChatCard>;
881
+ export type LoginCode = v.InferOutput<typeof loginCode>;
882
+ export type WaOlder = v.InferOutput<typeof waOlder>;
883
+ export interface WaLink {
884
+ method: "qr" | "phone";
885
+ /** International format; the phone method only. Sent to the engine on stdin, never as an argument. */
886
+ phone?: string;
887
+ }
888
+ export interface WaSend {
889
+ chat: string;
890
+ text: string;
891
+ /** The message id WhatsApp will carry; a resend with the same id is the same message. */
892
+ id: string;
893
+ replyTo?: string;
894
+ /** The replied-to message as the store holds it; without it, phones show the quote as unavailable. */
895
+ quoted?: WaQuote;
896
+ }
897
+ export interface WaQuote {
898
+ fromMe: boolean;
899
+ sender: string | null;
900
+ text: string;
901
+ }
902
+ /** One file from this machine, sent with `text` as its caption. `kind` is decided as tg decides it; a sticker goes alone. */
903
+ export interface WaSendMedia extends WaSend {
904
+ file: {
905
+ kind: "photo" | "video" | "voice" | "document" | "sticker";
906
+ path: string;
907
+ name: string;
908
+ };
909
+ }
910
+ /** Photos and videos sent as one album, `text` as the first one's caption. */
911
+ export interface WaSendAlbum extends WaSend {
912
+ files: WaSendMedia["file"][];
913
+ }
914
+ /** A poll to send; `multiple` lets a voter pick any number of answers, else one. */
915
+ export interface WaNewPoll {
916
+ chat: string;
917
+ id: string;
918
+ question: string;
919
+ answers: string[];
920
+ multiple: boolean;
921
+ }
922
+ /**
923
+ * A stored message sent again, marked forwarded: its text and its one file by the keys the store holds, or its place
924
+ * or contact card as the store kept it.
925
+ */
926
+ export interface WaForward {
927
+ chat: string;
928
+ id: string;
929
+ text: string;
930
+ attachment: WaAttachment | null;
931
+ }
932
+ /**
933
+ * A message the account already has, as WhatsApp addresses one: whatsmeow keeps no messages, so whether it is the
934
+ * account's own and who sent it come from cli-core's store. A wrong key is not refused — WhatsApp drops the reaction
935
+ * or the deletion silently — so the adapter sends one only for a message the store holds.
936
+ */
937
+ export interface WaKey {
938
+ chat: string;
939
+ id: string;
940
+ fromMe: boolean;
941
+ /** Who sent it; in a group, required for someone else's message. */
942
+ sender: string | null;
943
+ }
944
+ /** A message key as the engine reads it from a request. */
945
+ export declare const keyFields: ({ chat, id, fromMe, sender }: WaKey) => {
946
+ chat: string;
947
+ message: string;
948
+ fromMe: boolean;
949
+ sender?: string | undefined;
950
+ };
951
+ /** The most messages one `older` request asks the phone for, as WhatsApp's own clients ask. */
952
+ export declare const OLDER_MAX = 50;
953
+ /** A stored message the phone counts back from: WhatsApp needs its id, whether it is the account's own, and its time. */
954
+ export interface WaAnchor extends WaKey {
955
+ timestamp: string;
956
+ }
957
+ /**
958
+ * A refusal from the engine, already in the closed list of codes. Its message is fixed wording: it never repeats a
959
+ * chat name, a JID or anything typed, since errors reach logs and run records.
960
+ */
961
+ export declare class EngineError extends Error {
962
+ readonly code: EngineErrorCode;
963
+ readonly reason?: WaReason | undefined;
964
+ /** When a temporary ban ends, if WhatsApp said. */
965
+ readonly until?: string | undefined;
966
+ constructor(code: EngineErrorCode, message: string, reason?: WaReason | undefined,
967
+ /** When a temporary ban ends, if WhatsApp said. */
968
+ until?: string | undefined);
969
+ }
970
+ /**
971
+ * The engine as the adapter sees it. `GoEngine` runs whatsmeow in a child process; `FakeEngine` serves tests.
972
+ * An event nobody listens for yet is kept and handed to the first listener of its kind, so a history push that
973
+ * comes right after connecting is not lost to a `feed` that started a moment after `watch`.
974
+ */
975
+ export interface WhatsAppEngine extends GroupEngine, PrivacyEngine, SettingsEngine, ChannelEngine {
976
+ /**
977
+ * The linked account, from the engine's own store: no request. `null` before a login. Always the user JID in LID
978
+ * form with no device part (`…@lid`, not `…:12@s.whatsapp.net`): the store keys the account by it, so a change of
979
+ * form later would split the account, and the phone form would put a phone number in a stored key.
980
+ */
981
+ self(): string | null;
982
+ /** Resolves once the engine is connected and receiving. */
983
+ ready(signal: AbortSignal): Promise<void>;
984
+ me(): Promise<WaAccount>;
985
+ /** Every chat the engine knows, for resolving a name. */
986
+ directory(): Promise<WaChat[]>;
987
+ chat(jid: string): Promise<WaChatCard>;
988
+ send(request: WaSend): Promise<WaMessage>;
989
+ /** New text for one of the account's own messages; the answer carries the new text and when it changed. */
990
+ edit(key: WaKey, text: string): Promise<WaMessage>;
991
+ /** Deletes a message for everyone: the account's own, or another's in a group the account administers. */
992
+ revoke(key: WaKey): Promise<void>;
993
+ /** The account's reaction on a message; `null` takes it off. */
994
+ react(key: WaKey, emoji: string | null): Promise<void>;
995
+ /** A read receipt for someone else's message; the sender sees it. Only a command that asked for it calls this. */
996
+ markRead(key: WaKey): Promise<void>;
997
+ /** Uploads the file, then sends it; a failed upload sent nothing. */
998
+ sendMedia(request: WaSendMedia): Promise<WaMessage>;
999
+ /**
1000
+ * Uploads every file, then sends the album and each file tied to it. The answer is the first file's message, under
1001
+ * the send id; the others carry ids derived from it, so a repeat sends the same ones.
1002
+ */
1003
+ sendAlbum(request: WaSendAlbum): Promise<WaMessage>;
1004
+ /**
1005
+ * Writes a stored file to `path`, which must not exist yet; the engine creates it readable by this user alone. A
1006
+ * file WhatsApp no longer keeps is asked of the owner's phone again, for the message `key` names, and fetched from
1007
+ * its new upload, and the answer is that upload's path; a phone that does not answer in time is a `timeout`.
1008
+ */
1009
+ download(attachment: WaAttachment, path: string, key: WaKey): Promise<WaDownloaded>;
1010
+ forward(request: WaForward): Promise<WaMessage>;
1011
+ createPoll(request: WaNewPoll): Promise<WaMessage>;
1012
+ /** The account's vote in a poll, by the answers' texts; none takes it back. Everyone in the chat sees it. */
1013
+ vote(key: WaKey, answers: string[]): Promise<void>;
1014
+ /**
1015
+ * Pins the message for everyone in the chat: WhatsApp has no pin only the account sees. `duration` is 86400,
1016
+ * 604800 or 2592000 seconds. cli-core always sends one; the engine pins for 7 days without one,
1017
+ * which keeps a wa built on cli-core before 0.339.0 working.
1018
+ */
1019
+ pin(key: WaKey, duration?: number): Promise<void>;
1020
+ unpin(key: WaKey): Promise<void>;
1021
+ /**
1022
+ * Asks the phone for up to `count` of the chat's messages sent before `anchor`, and waits for its answer. WhatsApp
1023
+ * keeps no history on its servers: the phone answers only while it is online, and a phone that does not answer in
1024
+ * time is a `timeout`.
1025
+ */
1026
+ older(anchor: WaAnchor, count: number): Promise<WaOlder>;
1027
+ /**
1028
+ * Links this device to the account, showing each code through `onCode` until the phone confirms. Answers the
1029
+ * account at once when the device is already linked.
1030
+ */
1031
+ link(request: WaLink, onCode: (code: LoginCode) => void): Promise<WaAccount>;
1032
+ logout(): Promise<void>;
1033
+ /**
1034
+ * The store's one-to-one chats in phone form, once as `serve` or `watch` starts. One stored so before the engine kept
1035
+ * its table of them is known to it no other way: it goes out as a `rekey` event if its LID is known, and waits for the
1036
+ * paced lookups if not. `recipients` are recipient-list ids the store holds no chat for: one in phone form whose LID
1037
+ * the device knows goes out as a `rekey` event too, and none is looked up or recorded. Never connects.
1038
+ */
1039
+ storedChats(chats: string[], recipients?: string[]): Promise<void>;
1040
+ /**
1041
+ * The chat id the store keeps a typed one-to-one chat under: its LID when whatsmeow's map knows it, else the id as
1042
+ * typed. Reads the map only, never connects, and records nothing.
1043
+ */
1044
+ canonicalChat(jid: string): Promise<string>;
1045
+ /** Events of the given kinds until the returned function is called. */
1046
+ listen(kinds: readonly EngineEvent["event"][], onEvent: (event: EngineEvent) => void): () => void;
1047
+ close(): Promise<void>;
1048
+ }
1049
+ //# sourceMappingURL=contract.d.ts.map