@wirecat/whatsapp-cli 0.1.0 → 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 (102) hide show
  1. package/README.md +213 -94
  2. package/dist/adapter/adapter.d.ts +8 -4
  3. package/dist/adapter/adapter.d.ts.map +1 -1
  4. package/dist/adapter/adapter.js +313 -85
  5. package/dist/adapter/adapter.js.map +1 -1
  6. package/dist/adapter/channels.d.ts +43 -0
  7. package/dist/adapter/channels.d.ts.map +1 -0
  8. package/dist/adapter/channels.js +100 -0
  9. package/dist/adapter/channels.js.map +1 -0
  10. package/dist/adapter/checks.d.ts +2 -3
  11. package/dist/adapter/checks.d.ts.map +1 -1
  12. package/dist/adapter/checks.js +1 -2
  13. package/dist/adapter/checks.js.map +1 -1
  14. package/dist/adapter/errors.d.ts +0 -5
  15. package/dist/adapter/errors.d.ts.map +1 -1
  16. package/dist/adapter/errors.js +7 -9
  17. package/dist/adapter/errors.js.map +1 -1
  18. package/dist/adapter/groups.d.ts +5 -1
  19. package/dist/adapter/groups.d.ts.map +1 -1
  20. package/dist/adapter/groups.js +51 -9
  21. package/dist/adapter/groups.js.map +1 -1
  22. package/dist/adapter/map.d.ts +16 -2
  23. package/dist/adapter/map.d.ts.map +1 -1
  24. package/dist/adapter/map.js +56 -7
  25. package/dist/adapter/map.js.map +1 -1
  26. package/dist/adapter/pins.d.ts +11 -0
  27. package/dist/adapter/pins.d.ts.map +1 -0
  28. package/dist/adapter/pins.js +10 -0
  29. package/dist/adapter/pins.js.map +1 -0
  30. package/dist/adapter/polls.d.ts +1 -1
  31. package/dist/adapter/polls.d.ts.map +1 -1
  32. package/dist/adapter/polls.js +2 -2
  33. package/dist/adapter/polls.js.map +1 -1
  34. package/dist/adapter/privacy.d.ts +18 -0
  35. package/dist/adapter/privacy.d.ts.map +1 -0
  36. package/dist/adapter/privacy.js +94 -0
  37. package/dist/adapter/privacy.js.map +1 -0
  38. package/dist/adapter/settings.d.ts +21 -0
  39. package/dist/adapter/settings.d.ts.map +1 -0
  40. package/dist/adapter/settings.js +76 -0
  41. package/dist/adapter/settings.js.map +1 -0
  42. package/dist/bin/wa.js +0 -13
  43. package/dist/bin/wa.js.map +1 -1
  44. package/dist/commands/session.d.ts +18 -7
  45. package/dist/commands/session.d.ts.map +1 -1
  46. package/dist/commands/session.js +92 -93
  47. package/dist/commands/session.js.map +1 -1
  48. package/dist/commands/setup.d.ts.map +1 -1
  49. package/dist/commands/setup.js +77 -129
  50. package/dist/commands/setup.js.map +1 -1
  51. package/dist/commands/update.d.ts.map +1 -1
  52. package/dist/commands/update.js +3 -22
  53. package/dist/commands/update.js.map +1 -1
  54. package/dist/engine/channels.d.ts +100 -0
  55. package/dist/engine/channels.d.ts.map +1 -0
  56. package/dist/engine/channels.js +29 -0
  57. package/dist/engine/channels.js.map +1 -0
  58. package/dist/engine/contract.d.ts +475 -43
  59. package/dist/engine/contract.d.ts.map +1 -1
  60. package/dist/engine/contract.js +178 -11
  61. package/dist/engine/contract.js.map +1 -1
  62. package/dist/engine/go-engine.d.ts.map +1 -1
  63. package/dist/engine/go-engine.js +23 -34
  64. package/dist/engine/go-engine.js.map +1 -1
  65. package/dist/engine/groups.d.ts +26 -14
  66. package/dist/engine/groups.d.ts.map +1 -1
  67. package/dist/engine/groups.js +2 -0
  68. package/dist/engine/groups.js.map +1 -1
  69. package/dist/engine/privacy.d.ts +33 -0
  70. package/dist/engine/privacy.d.ts.map +1 -0
  71. package/dist/engine/privacy.js +23 -0
  72. package/dist/engine/privacy.js.map +1 -0
  73. package/dist/engine/settings.d.ts +45 -0
  74. package/dist/engine/settings.d.ts.map +1 -0
  75. package/dist/engine/settings.js +34 -0
  76. package/dist/engine/settings.js.map +1 -0
  77. package/dist/install/postinstall.d.ts.map +1 -1
  78. package/dist/install/postinstall.js +4 -3
  79. package/dist/install/postinstall.js.map +1 -1
  80. package/dist/messenger.d.ts +3 -4
  81. package/dist/messenger.d.ts.map +1 -1
  82. package/dist/messenger.js +29 -14
  83. package/dist/messenger.js.map +1 -1
  84. package/dist/program.d.ts +5 -1
  85. package/dist/program.d.ts.map +1 -1
  86. package/dist/program.js +10 -38
  87. package/dist/program.js.map +1 -1
  88. package/dist/reasons.d.ts.map +1 -1
  89. package/dist/reasons.js +8 -0
  90. package/dist/reasons.js.map +1 -1
  91. package/dist/update.d.ts +0 -1
  92. package/dist/update.d.ts.map +1 -1
  93. package/dist/update.js +0 -7
  94. package/dist/update.js.map +1 -1
  95. package/dist/version.d.ts +1 -1
  96. package/dist/version.js +1 -1
  97. package/package.json +10 -10
  98. package/skills/whatsapp-cli/SKILL.md +59 -24
  99. package/dist/commands/answer.d.ts +0 -7
  100. package/dist/commands/answer.d.ts.map +0 -1
  101. package/dist/commands/answer.js +0 -11
  102. package/dist/commands/answer.js.map +0 -1
@@ -1,5 +1,8 @@
1
1
  import * as v from "valibot";
2
+ import type { ChannelEngine } from "./channels.js";
2
3
  import type { GroupEngine } from "./groups.js";
4
+ import type { PrivacyEngine } from "./privacy.js";
5
+ import type { SettingsEngine } from "./settings.js";
3
6
  /**
4
7
  * What the engine and the adapter say to each other, in WhatsApp's own terms. The Go engine speaks it as JSON
5
8
  * lines; `FakeEngine` speaks it in memory. Bump `PROTOCOL` on any change an older peer would misread — the
@@ -10,16 +13,94 @@ import type { GroupEngine } from "./groups.js";
10
13
  * emits a chat (cli-private plans/2026-10-16-whatsapp-foundation.md, decision 3). Names are what the address book or the
11
14
  * person set; a phone number is never a name.
12
15
  */
13
- export declare const PROTOCOL = 10;
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;
14
82
  export declare const waChat: v.StrictObjectSchema<{
15
83
  readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
16
- readonly name: v.NullableSchema<v.StringSchema<undefined>, 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>;
17
89
  readonly kind: v.PicklistSchema<["dm", "self", "group", "newsletter", "broadcast"], undefined>;
18
- readonly unread: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
19
- readonly lastMessageAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
20
- readonly participants: v.NullableSchema<v.NumberSchema<undefined>, 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>;
21
93
  readonly archived: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
22
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>;
23
104
  }, undefined>;
24
105
  export declare const waContact: v.StrictObjectSchema<{
25
106
  readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
@@ -35,10 +116,43 @@ export declare const waMediaRef: v.StrictObjectSchema<{
35
116
  readonly mediaKey: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
36
117
  readonly fileSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
37
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>;
38
151
  }, undefined>;
39
152
  /**
40
153
  * cli-core's Attachment in WhatsApp's terms: `photo`, `video`, `voice`, `audio`, `document`, `sticker`, `location`
41
- * (`url` is a `geo:` link), `contact` (its name only — the card holds a phone number). `ref` only for a file.
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.
42
156
  */
43
157
  export declare const waAttachment: v.StrictObjectSchema<{
44
158
  readonly kind: v.PicklistSchema<["photo", "video", "voice", "audio", "document", "sticker", "location", "contact"], undefined>;
@@ -50,13 +164,29 @@ export declare const waAttachment: v.StrictObjectSchema<{
50
164
  readonly size: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
51
165
  readonly mime: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
52
166
  readonly duration: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
53
- readonly ref: v.OptionalSchema<v.StrictObjectSchema<{
167
+ readonly ref: v.OptionalSchema<v.UnionSchema<[v.StrictObjectSchema<{
54
168
  readonly media: v.PicklistSchema<["image", "video", "audio", "document", "sticker"], undefined>;
55
169
  readonly directPath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
56
170
  readonly mediaKey: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
57
171
  readonly fileSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
58
172
  readonly fileEncSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
59
- }, 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>;
60
190
  }, undefined>;
61
191
  /**
62
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
@@ -91,13 +221,29 @@ export declare const waMessage: v.StrictObjectSchema<{
91
221
  readonly size: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
92
222
  readonly mime: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
93
223
  readonly duration: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
94
- readonly ref: v.OptionalSchema<v.StrictObjectSchema<{
224
+ readonly ref: v.OptionalSchema<v.UnionSchema<[v.StrictObjectSchema<{
95
225
  readonly media: v.PicklistSchema<["image", "video", "audio", "document", "sticker"], undefined>;
96
226
  readonly directPath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
97
227
  readonly mediaKey: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
98
228
  readonly fileSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
99
229
  readonly fileEncSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
100
- }, 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>;
101
247
  }, undefined>, undefined>, undefined>;
102
248
  readonly poll: v.OptionalSchema<v.StrictObjectSchema<{
103
249
  readonly question: v.StringSchema<undefined>;
@@ -107,6 +253,10 @@ export declare const waMessage: v.StrictObjectSchema<{
107
253
  }, undefined>, undefined>;
108
254
  readonly multiple: v.BooleanSchema<undefined>;
109
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>;
110
260
  }, undefined>;
111
261
  /**
112
262
  * One person's newest choice in a poll: `selected` is the full SHA-256 of each chosen answer's text, and none takes
@@ -130,21 +280,63 @@ export declare const waVote: v.StrictObjectSchema<{
130
280
  readonly multiple: v.BooleanSchema<undefined>;
131
281
  }, undefined>, undefined>;
132
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>;
133
311
  /**
134
312
  * One push from the phone. `kind` follows whatsmeow's sync types; the adapter treats them all alike. `votes` are the
135
- * votes in the pushed polls, which the store saves with the push, not as `vote` events.
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.
136
315
  */
137
316
  export declare const waHistory: v.StrictObjectSchema<{
138
317
  readonly kind: v.PicklistSchema<["bootstrap", "recent", "full", "on_demand", "push_name", "other"], undefined>;
139
318
  readonly chats: v.ArraySchema<v.StrictObjectSchema<{
140
319
  readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
141
- readonly name: v.NullableSchema<v.StringSchema<undefined>, 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>;
142
325
  readonly kind: v.PicklistSchema<["dm", "self", "group", "newsletter", "broadcast"], undefined>;
143
- readonly unread: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
144
- readonly lastMessageAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
145
- readonly participants: v.NullableSchema<v.NumberSchema<undefined>, 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>;
146
329
  readonly archived: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
147
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>;
148
340
  }, undefined>, undefined>;
149
341
  readonly contacts: v.ArraySchema<v.StrictObjectSchema<{
150
342
  readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
@@ -170,13 +362,29 @@ export declare const waHistory: v.StrictObjectSchema<{
170
362
  readonly size: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
171
363
  readonly mime: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
172
364
  readonly duration: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
173
- readonly ref: v.OptionalSchema<v.StrictObjectSchema<{
365
+ readonly ref: v.OptionalSchema<v.UnionSchema<[v.StrictObjectSchema<{
174
366
  readonly media: v.PicklistSchema<["image", "video", "audio", "document", "sticker"], undefined>;
175
367
  readonly directPath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
176
368
  readonly mediaKey: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
177
369
  readonly fileSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
178
370
  readonly fileEncSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
179
- }, 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>;
180
388
  }, undefined>, undefined>, undefined>;
181
389
  readonly poll: v.OptionalSchema<v.StrictObjectSchema<{
182
390
  readonly question: v.StringSchema<undefined>;
@@ -186,6 +394,10 @@ export declare const waHistory: v.StrictObjectSchema<{
186
394
  }, undefined>, undefined>;
187
395
  readonly multiple: v.BooleanSchema<undefined>;
188
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>;
189
401
  }, undefined>, undefined>;
190
402
  readonly votes: v.ArraySchema<v.StrictObjectSchema<{
191
403
  readonly chat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
@@ -203,6 +415,23 @@ export declare const waHistory: v.StrictObjectSchema<{
203
415
  readonly multiple: v.BooleanSchema<undefined>;
204
416
  }, undefined>, undefined>;
205
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>;
206
435
  }, undefined>;
207
436
  /**
208
437
  * The phone's answer to `older`: the chat's messages sent before the anchor, as many as were asked or fewer. No
@@ -230,13 +459,29 @@ export declare const waOlder: v.StrictObjectSchema<{
230
459
  readonly size: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
231
460
  readonly mime: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
232
461
  readonly duration: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
233
- readonly ref: v.OptionalSchema<v.StrictObjectSchema<{
462
+ readonly ref: v.OptionalSchema<v.UnionSchema<[v.StrictObjectSchema<{
234
463
  readonly media: v.PicklistSchema<["image", "video", "audio", "document", "sticker"], undefined>;
235
464
  readonly directPath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
236
465
  readonly mediaKey: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
237
466
  readonly fileSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
238
467
  readonly fileEncSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
239
- }, 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>;
240
485
  }, undefined>, undefined>, undefined>;
241
486
  readonly poll: v.OptionalSchema<v.StrictObjectSchema<{
242
487
  readonly question: v.StringSchema<undefined>;
@@ -246,6 +491,10 @@ export declare const waOlder: v.StrictObjectSchema<{
246
491
  }, undefined>, undefined>;
247
492
  readonly multiple: v.BooleanSchema<undefined>;
248
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>;
249
498
  }, undefined>, undefined>;
250
499
  readonly more: v.BooleanSchema<undefined>;
251
500
  }, undefined>;
@@ -257,13 +506,26 @@ export declare const engineEvent: v.VariantSchema<"event", [v.StrictObjectSchema
257
506
  readonly kind: v.PicklistSchema<["bootstrap", "recent", "full", "on_demand", "push_name", "other"], undefined>;
258
507
  readonly chats: v.ArraySchema<v.StrictObjectSchema<{
259
508
  readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
260
- readonly name: v.NullableSchema<v.StringSchema<undefined>, 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>;
261
514
  readonly kind: v.PicklistSchema<["dm", "self", "group", "newsletter", "broadcast"], undefined>;
262
- readonly unread: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
263
- readonly lastMessageAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
264
- readonly participants: v.NullableSchema<v.NumberSchema<undefined>, 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>;
265
518
  readonly archived: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
266
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>;
267
529
  }, undefined>, undefined>;
268
530
  readonly contacts: v.ArraySchema<v.StrictObjectSchema<{
269
531
  readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
@@ -289,13 +551,29 @@ export declare const engineEvent: v.VariantSchema<"event", [v.StrictObjectSchema
289
551
  readonly size: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
290
552
  readonly mime: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
291
553
  readonly duration: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
292
- readonly ref: v.OptionalSchema<v.StrictObjectSchema<{
554
+ readonly ref: v.OptionalSchema<v.UnionSchema<[v.StrictObjectSchema<{
293
555
  readonly media: v.PicklistSchema<["image", "video", "audio", "document", "sticker"], undefined>;
294
556
  readonly directPath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
295
557
  readonly mediaKey: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
296
558
  readonly fileSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
297
559
  readonly fileEncSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
298
- }, 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>;
299
577
  }, undefined>, undefined>, undefined>;
300
578
  readonly poll: v.OptionalSchema<v.StrictObjectSchema<{
301
579
  readonly question: v.StringSchema<undefined>;
@@ -305,6 +583,10 @@ export declare const engineEvent: v.VariantSchema<"event", [v.StrictObjectSchema
305
583
  }, undefined>, undefined>;
306
584
  readonly multiple: v.BooleanSchema<undefined>;
307
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>;
308
590
  }, undefined>, undefined>;
309
591
  readonly votes: v.ArraySchema<v.StrictObjectSchema<{
310
592
  readonly chat: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
@@ -322,6 +604,23 @@ export declare const engineEvent: v.VariantSchema<"event", [v.StrictObjectSchema
322
604
  readonly multiple: v.BooleanSchema<undefined>;
323
605
  }, undefined>, undefined>;
324
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>;
325
624
  }, undefined>;
326
625
  }, undefined>, v.StrictObjectSchema<{
327
626
  readonly event: v.LiteralSchema<"message", undefined>;
@@ -345,13 +644,29 @@ export declare const engineEvent: v.VariantSchema<"event", [v.StrictObjectSchema
345
644
  readonly size: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
346
645
  readonly mime: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
347
646
  readonly duration: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
348
- readonly ref: v.OptionalSchema<v.StrictObjectSchema<{
647
+ readonly ref: v.OptionalSchema<v.UnionSchema<[v.StrictObjectSchema<{
349
648
  readonly media: v.PicklistSchema<["image", "video", "audio", "document", "sticker"], undefined>;
350
649
  readonly directPath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
351
650
  readonly mediaKey: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
352
651
  readonly fileSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
353
652
  readonly fileEncSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
354
- }, 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>;
355
670
  }, undefined>, undefined>, undefined>;
356
671
  readonly poll: v.OptionalSchema<v.StrictObjectSchema<{
357
672
  readonly question: v.StringSchema<undefined>;
@@ -361,6 +676,10 @@ export declare const engineEvent: v.VariantSchema<"event", [v.StrictObjectSchema
361
676
  }, undefined>, undefined>;
362
677
  readonly multiple: v.BooleanSchema<undefined>;
363
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>;
364
683
  }, undefined>;
365
684
  }, undefined>, v.StrictObjectSchema<{
366
685
  readonly event: v.LiteralSchema<"edit", undefined>;
@@ -384,13 +703,29 @@ export declare const engineEvent: v.VariantSchema<"event", [v.StrictObjectSchema
384
703
  readonly size: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
385
704
  readonly mime: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
386
705
  readonly duration: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
387
- readonly ref: v.OptionalSchema<v.StrictObjectSchema<{
706
+ readonly ref: v.OptionalSchema<v.UnionSchema<[v.StrictObjectSchema<{
388
707
  readonly media: v.PicklistSchema<["image", "video", "audio", "document", "sticker"], undefined>;
389
708
  readonly directPath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>]>;
390
709
  readonly mediaKey: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
391
710
  readonly fileSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
392
711
  readonly fileEncSha256: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
393
- }, 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>;
394
729
  }, undefined>, undefined>, undefined>;
395
730
  readonly poll: v.OptionalSchema<v.StrictObjectSchema<{
396
731
  readonly question: v.StringSchema<undefined>;
@@ -400,6 +735,10 @@ export declare const engineEvent: v.VariantSchema<"event", [v.StrictObjectSchema
400
735
  }, undefined>, undefined>;
401
736
  readonly multiple: v.BooleanSchema<undefined>;
402
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>;
403
742
  }, undefined>;
404
743
  }, undefined>, v.StrictObjectSchema<{
405
744
  readonly event: v.LiteralSchema<"delete", undefined>;
@@ -423,22 +762,51 @@ export declare const engineEvent: v.VariantSchema<"event", [v.StrictObjectSchema
423
762
  readonly multiple: v.BooleanSchema<undefined>;
424
763
  }, undefined>, undefined>;
425
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>;
426
789
  }, undefined>, v.StrictObjectSchema<{
427
790
  readonly event: v.LiteralSchema<"connection", undefined>;
428
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>;
429
793
  }, undefined>], undefined>;
430
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>;
431
795
  /**
432
796
  * Why, for the refusals an agent recovers from differently than their code says: another process holds the device
433
797
  * (`device.in-use`), WhatsApp handed the login to another connection (`device.replaced`), logged the device out, refuses
434
798
  * this version (`client.outdated`), banned the account, or asked it to slow down (`account.rate-limited`, never the
435
- * engine's own lookup pace). The CLI registers each one (`src/reasons.ts`).
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`).
436
802
  */
437
- export declare const engineReason: v.PicklistSchema<["device.in-use", "device.replaced", "device.logged-out", "client.outdated", "account.banned", "account.rate-limited"], undefined>;
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>;
438
804
  export declare const engineError: v.StrictObjectSchema<{
439
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>;
440
806
  readonly message: v.StringSchema<undefined>;
441
- readonly reason: v.OptionalSchema<v.PicklistSchema<["device.in-use", "device.replaced", "device.logged-out", "client.outdated", "account.banned", "account.rate-limited"], undefined>, 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>;
442
810
  }, undefined>;
443
811
  /** The engine's first line: its protocol and the linked account (`self()`), or `null` before a login. */
444
812
  export declare const hello: v.StrictObjectSchema<{
@@ -454,13 +822,26 @@ export declare const waAccount: v.StrictObjectSchema<{
454
822
  export declare const waChatCard: v.StrictObjectSchema<{
455
823
  readonly chat: v.StrictObjectSchema<{
456
824
  readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
457
- readonly name: v.NullableSchema<v.StringSchema<undefined>, 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>;
458
830
  readonly kind: v.PicklistSchema<["dm", "self", "group", "newsletter", "broadcast"], undefined>;
459
- readonly unread: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
460
- readonly lastMessageAt: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>, undefined>;
461
- readonly participants: v.NullableSchema<v.NumberSchema<undefined>, 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>;
462
834
  readonly archived: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
463
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>;
464
845
  }, undefined>;
465
846
  readonly members: v.NullableSchema<v.ArraySchema<v.StrictObjectSchema<{
466
847
  readonly jid: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IncludesAction<string, "@", undefined>]>;
@@ -480,9 +861,14 @@ export type WaContact = v.InferOutput<typeof waContact>;
480
861
  export type WaMessage = v.InferOutput<typeof waMessage>;
481
862
  export type WaPoll = v.InferOutput<typeof waPoll>;
482
863
  export type WaVote = v.InferOutput<typeof waVote>;
864
+ export type WaChatEvent = v.InferOutput<typeof waChatEvent>;
483
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>;
484
869
  export type WaAttachment = v.InferOutput<typeof waAttachment>;
485
870
  export type WaHistory = v.InferOutput<typeof waHistory>;
871
+ export type WaRekey = v.InferOutput<typeof waRekey>;
486
872
  export type EngineEvent = v.InferOutput<typeof engineEvent>;
487
873
  export type ConnectionState = v.InferOutput<typeof connectionState>;
488
874
  export type EngineErrorCode = v.InferOutput<typeof engineErrorCode>;
@@ -513,14 +899,18 @@ export interface WaQuote {
513
899
  sender: string | null;
514
900
  text: string;
515
901
  }
516
- /** One file from this machine, sent with `text` as its caption. `kind` is decided as tg decides it. */
902
+ /** One file from this machine, sent with `text` as its caption. `kind` is decided as tg decides it; a sticker goes alone. */
517
903
  export interface WaSendMedia extends WaSend {
518
904
  file: {
519
- kind: "photo" | "video" | "voice" | "document";
905
+ kind: "photo" | "video" | "voice" | "document" | "sticker";
520
906
  path: string;
521
907
  name: string;
522
908
  };
523
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
+ }
524
914
  /** A poll to send; `multiple` lets a voter pick any number of answers, else one. */
525
915
  export interface WaNewPoll {
526
916
  chat: string;
@@ -529,7 +919,10 @@ export interface WaNewPoll {
529
919
  answers: string[];
530
920
  multiple: boolean;
531
921
  }
532
- /** A stored message sent again, marked forwarded: its text and its one file, by the keys the store holds. */
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
+ */
533
926
  export interface WaForward {
534
927
  chat: string;
535
928
  id: string;
@@ -548,6 +941,13 @@ export interface WaKey {
548
941
  /** Who sent it; in a group, required for someone else's message. */
549
942
  sender: string | null;
550
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
+ };
551
951
  /** The most messages one `older` request asks the phone for, as WhatsApp's own clients ask. */
552
952
  export declare const OLDER_MAX = 50;
553
953
  /** A stored message the phone counts back from: WhatsApp needs its id, whether it is the account's own, and its time. */
@@ -561,14 +961,18 @@ export interface WaAnchor extends WaKey {
561
961
  export declare class EngineError extends Error {
562
962
  readonly code: EngineErrorCode;
563
963
  readonly reason?: WaReason | undefined;
564
- constructor(code: EngineErrorCode, message: string, 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);
565
969
  }
566
970
  /**
567
971
  * The engine as the adapter sees it. `GoEngine` runs whatsmeow in a child process; `FakeEngine` serves tests.
568
972
  * An event nobody listens for yet is kept and handed to the first listener of its kind, so a history push that
569
973
  * comes right after connecting is not lost to a `feed` that started a moment after `watch`.
570
974
  */
571
- export interface WhatsAppEngine extends GroupEngine {
975
+ export interface WhatsAppEngine extends GroupEngine, PrivacyEngine, SettingsEngine, ChannelEngine {
572
976
  /**
573
977
  * The linked account, from the engine's own store: no request. `null` before a login. Always the user JID in LID
574
978
  * form with no device part (`…@lid`, not `…:12@s.whatsapp.net`): the store keys the account by it, so a change of
@@ -592,12 +996,28 @@ export interface WhatsAppEngine extends GroupEngine {
592
996
  markRead(key: WaKey): Promise<void>;
593
997
  /** Uploads the file, then sends it; a failed upload sent nothing. */
594
998
  sendMedia(request: WaSendMedia): Promise<WaMessage>;
595
- /** Writes a stored file to `path`, which must not exist yet; the engine creates it readable by this user alone. */
596
- download(attachment: WaAttachment, path: string): Promise<void>;
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>;
597
1010
  forward(request: WaForward): Promise<WaMessage>;
598
1011
  createPoll(request: WaNewPoll): Promise<WaMessage>;
599
1012
  /** The account's vote in a poll, by the answers' texts; none takes it back. Everyone in the chat sees it. */
600
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>;
601
1021
  /**
602
1022
  * Asks the phone for up to `count` of the chat's messages sent before `anchor`, and waits for its answer. WhatsApp
603
1023
  * keeps no history on its servers: the phone answers only while it is online, and a phone that does not answer in
@@ -610,6 +1030,18 @@ export interface WhatsAppEngine extends GroupEngine {
610
1030
  */
611
1031
  link(request: WaLink, onCode: (code: LoginCode) => void): Promise<WaAccount>;
612
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>;
613
1045
  /** Events of the given kinds until the returned function is called. */
614
1046
  listen(kinds: readonly EngineEvent["event"][], onEvent: (event: EngineEvent) => void): () => void;
615
1047
  close(): Promise<void>;