@vinikjkkj/wa-appstate 0.1.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 (4) hide show
  1. package/README.md +173 -0
  2. package/index.d.ts +152 -0
  3. package/index.js +720 -0
  4. package/package.json +51 -0
package/README.md ADDED
@@ -0,0 +1,173 @@
1
+ # @vinikjkkj/wa-appstate
2
+
3
+ WhatsApp Web AppState (Syncd) action schemas — wire names, collections,
4
+ versions, value fields, and index shapes for every multi-device sync action.
5
+
6
+ ```sh
7
+ npm i @vinikjkkj/wa-appstate
8
+ ```
9
+
10
+ ```ts
11
+ import { WA_APPSTATE_SCHEMAS, WA_APPSTATE_COLLECTIONS } from '@vinikjkkj/wa-appstate'
12
+ import type {
13
+ WaAppstateSchema,
14
+ WaAppstateActionKey,
15
+ WaAppstateCollection,
16
+ WaAppstateScope,
17
+ WaAppstateIndexValueOf,
18
+ WaAppstateIndexArgs
19
+ } from '@vinikjkkj/wa-appstate'
20
+
21
+ WA_APPSTATE_SCHEMAS.Mute
22
+ // → {
23
+ // name: 'mute',
24
+ // collection: 'regular_high',
25
+ // version: 2,
26
+ // scope: 'chat',
27
+ // valueField: 'muteAction',
28
+ // indexParts: [
29
+ // { type: 'literal', value: 'mute' },
30
+ // { type: 'wid', name: 'chatJid' }
31
+ // ]
32
+ // }
33
+ ```
34
+
35
+ ## Derived helpers — typed encoders/decoders
36
+
37
+ `indexParts` is a discriminated-union tuple, so `type` narrows the shape
38
+ (`literal` carries `value`, every other variant carries `name`). Two
39
+ helpers turn that tuple into the types you actually want to use:
40
+
41
+ ```ts
42
+ // Wire-level value tuple: what you'd serialise on the index
43
+ type MuteWire = WaAppstateIndexValueOf<typeof WA_APPSTATE_SCHEMAS.Mute>
44
+ // → readonly ['mute', string]
45
+
46
+ type StarWire = WaAppstateIndexValueOf<typeof WA_APPSTATE_SCHEMAS.Star>
47
+ // → readonly ['star', string, string, 'true' | 'false', string]
48
+
49
+ // Named args object: what a typed builder would accept
50
+ type MuteArgs = WaAppstateIndexArgs<'Mute'>
51
+ // → { readonly chatJid: string }
52
+
53
+ type StarArgs = WaAppstateIndexArgs<'Star'>
54
+ // → { readonly remote: string; readonly id: string; readonly fromMe: boolean; readonly participant: string }
55
+ ```
56
+
57
+ So a fully typed index builder is one declaration:
58
+
59
+ ```ts
60
+ function buildIndex<K extends WaAppstateActionKey>(
61
+ key: K,
62
+ args: WaAppstateIndexArgs<K>
63
+ ): WaAppstateIndexValueOf<typeof WA_APPSTATE_SCHEMAS[K]> {
64
+ // ...your encoder here
65
+ }
66
+
67
+ buildIndex('Mute', { chatJid: '5511@c.us' }) // ✓
68
+ buildIndex('Mute', { chatJld: '5511@c.us' }) // ✗ typo caught
69
+ buildIndex('Star', { remote: 'r', id: 'i', fromMe: true, participant: 'p' }) // ✓
70
+ ```
71
+
72
+ ## What's in here
73
+
74
+ WhatsApp Web's *AppState* (server-side: *Syncd*) is the multi-device
75
+ CRDT-style protocol that syncs small per-account mutations — mute, pin,
76
+ archive, contact, star, label, settings, etc. — across the primary
77
+ device and every linked client.
78
+
79
+ Each mutation on the wire is:
80
+
81
+ - an **action wire name** (`mute`, `pin_v1`, `setting_pushName`, …) — the
82
+ server keys mutations by this
83
+ - a **collection** (one of `regular`, `regular_low`, `regular_high`,
84
+ `critical_block`, `critical_unblock_low`) — controls sync priority and
85
+ whether the client must catch up before usable state
86
+ - a **version** — bumped when the collection's *index shape* changes;
87
+ receivers reject older versions
88
+ - an **index tuple** — `[name, ...]`. Rest depends on scope (e.g.
89
+ `[name, chatJid]` for chat-scoped actions, `[name, remote, id, fromMe,
90
+ participant]` for message-scoped)
91
+ - a **value** carried inside a `SyncActionValue` oneOf field (e.g.
92
+ `muteAction: MuteAction`) — the protobuf payload lives in
93
+ [`@vinikjkkj/wa-proto`](https://www.npmjs.com/package/@vinikjkkj/wa-proto)
94
+
95
+ This package gives you the static metadata for all 65+ action handlers,
96
+ so you can build wire-level encoders/decoders or replay mutations without
97
+ manually transcribing the client's handler registry.
98
+
99
+ ## What's published
100
+
101
+ | File | Format | Use case |
102
+ |---|---|---|
103
+ | `index.js` | CommonJS | Runtime `WA_APPSTATE_SCHEMAS` + `WA_APPSTATE_COLLECTIONS` frozen tables |
104
+ | `index.d.ts` | TS declarations | Per-action literal-typed schemas + the umbrella maps |
105
+
106
+ A raw IR file (`index.json`) is also produced by the extractor — see the
107
+ repo's [`packages/appstate/index.json`](https://github.com/vinikjkkj/wa-spec/blob/master/packages/appstate/index.json)
108
+ for non-TS consumers (diff tools, codegen, other languages).
109
+
110
+ `index.json` shape:
111
+
112
+ ```jsonc
113
+ {
114
+ "waVersion": "2.3000.xxxxx",
115
+ "collections": ["regular", "regular_low", "regular_high", "critical_block", "critical_unblock_low"],
116
+ "actions": {
117
+ "Mute": {
118
+ "module": "WAWebMuteChatSync",
119
+ "name": "mute",
120
+ "collection": "regular_high",
121
+ "version": 2,
122
+ "scope": "chat",
123
+ "baseClass": "ChatSyncdActionBase",
124
+ "valueField": "muteAction",
125
+ "chatJidIndex": 1,
126
+ "indexParts": [
127
+ { "type": "literal", "value": "mute" },
128
+ { "type": "wid", "name": "chatJid" }
129
+ ]
130
+ }
131
+ }
132
+ }
133
+ ```
134
+
135
+ ## Scopes
136
+
137
+ Each handler extends one of five base classes from `WAWebSyncdAction`,
138
+ which dictates the index shape:
139
+
140
+ | Scope | Index shape | Examples |
141
+ |---|---|---|
142
+ | `account` | `[name]` or `[name, opaqueId]` | `setting_pushName`, `time_format`, `label_edit`, `deviceAgent` |
143
+ | `chat` | `[name, chatJid]` | `mute`, `pin_v1`, `clearChat`, `lock` |
144
+ | `chatOrContact` | `[name, ...]` — typically `[name, labelId, chatJid]` | `label_jid` |
145
+ | `message` | `[name, remote, id, fromMe, participant]` | `star`, `deleteMessageForMe` |
146
+ | `chatMessageRange` | `[name, chatJid]` (message range carried in `value`) | `archive`, `markChatAsRead` |
147
+
148
+ ## Generate locally
149
+
150
+ ```sh
151
+ npx wa-fetcher --out dump/ # download bundles
152
+ npx wa-appstate apply --bundles dump/raw/<version>/
153
+ ```
154
+
155
+ ## Caveats
156
+
157
+ - **`valueField: null` means the handler doesn't read from the protobuf
158
+ value.** A handful of actions (e.g. `ai_thread_delete`, `shareOwnPn`,
159
+ `marketingMessageBroadcast`) ignore the value entirely — the wire
160
+ mutation is index-only. The `SyncActionValue` oneOf field may still
161
+ exist in the protobuf; check [`@vinikjkkj/wa-proto`](https://www.npmjs.com/package/@vinikjkkj/wa-proto)
162
+ if you need the encoder/decoder.
163
+ - **Slot names beyond `action` / `chatJid` / message-key tuples are
164
+ generic (`key1`, `key2`, …).** The minified handler doesn't carry
165
+ human-readable parameter names; we tag what we can recognise from the
166
+ scope's base class and fall back to positional names. The encoded
167
+ value is still correct — only the *label* is generic.
168
+ - **Slot 0 is always the action wire name itself** — the client prepends
169
+ it to the indexArgs array before computing the index hash.
170
+ - **The handler registry is `WAWebCollectionHandlerActions`.** Anything
171
+ added or removed in WA Web shows up here on the next daily extract.
172
+
173
+ Daily-extracted by [wa-spec](https://github.com/vinikjkkj/wa-spec).
package/index.d.ts ADDED
@@ -0,0 +1,152 @@
1
+ // AUTO-GENERATED — do not edit. Regenerated daily by wa-spec.
2
+ // WhatsApp Version: 2.3000.1040072419
3
+
4
+ export type WaAppstateCollection = 'regular' | 'regular_low' | 'regular_high' | 'critical_block' | 'critical_unblock_low'
5
+
6
+ export type WaAppstateScope =
7
+ | 'account'
8
+ | 'chat'
9
+ | 'chatOrContact'
10
+ | 'message'
11
+ | 'chatMessageRange'
12
+
13
+ // Discriminated union — `type` narrows the shape:
14
+ // - 'literal' carries a fixed `value` (the action wire name, position 0)
15
+ // - everything else carries a `name` (the role of the slot)
16
+ export type WaAppstateIndexPart =
17
+ | { readonly type: 'literal'; readonly value: string }
18
+ | { readonly type: 'wid'; readonly name: string }
19
+ | { readonly type: 'jid'; readonly name: string }
20
+ | { readonly type: 'string'; readonly name: string }
21
+ | { readonly type: 'boolString'; readonly name: string }
22
+ | { readonly type: 'unknown'; readonly name: string }
23
+
24
+ export interface WaAppstateSchema<
25
+ Name extends string = string,
26
+ Collection extends WaAppstateCollection = WaAppstateCollection,
27
+ Scope extends WaAppstateScope = WaAppstateScope,
28
+ ValueField extends string | null = string | null,
29
+ IndexParts extends ReadonlyArray<WaAppstateIndexPart> = ReadonlyArray<WaAppstateIndexPart>
30
+ > {
31
+ readonly name: Name
32
+ readonly collection: Collection
33
+ readonly version: number
34
+ readonly scope: Scope
35
+ readonly valueField: ValueField
36
+ readonly indexParts: IndexParts
37
+ }
38
+
39
+ export declare const WA_APPSTATE_COLLECTIONS: ReadonlyArray<WaAppstateCollection>
40
+
41
+ export declare const WA_APPSTATE_SCHEMAS: {
42
+ readonly AdsCtwaPerCustomerDataSharing: WaAppstateSchema<'ctwaPerCustomerDataSharing', 'regular_high', 'account', 'ctwaPerCustomerDataSharingAction', readonly [{ readonly type: 'literal'; readonly value: 'ctwaPerCustomerDataSharing' }, { readonly type: 'string'; readonly name: 'key1' }]>
43
+ readonly Agent: WaAppstateSchema<'deviceAgent', 'regular', 'account', 'agentAction', readonly [{ readonly type: 'literal'; readonly value: 'deviceAgent' }, { readonly type: 'string'; readonly name: 'key1' }]>
44
+ readonly AiThreadDelete: WaAppstateSchema<'ai_thread_delete', 'regular_high', 'chat', null, readonly [{ readonly type: 'literal'; readonly value: 'ai_thread_delete' }, { readonly type: 'wid'; readonly name: 'chatJid' }, { readonly type: 'string'; readonly name: 'key2' }]>
45
+ readonly AiThreadPin: WaAppstateSchema<'thread_pin', 'regular_low', 'chat', 'threadPinAction', readonly [{ readonly type: 'literal'; readonly value: 'thread_pin' }, { readonly type: 'wid'; readonly name: 'chatJid' }, { readonly type: 'string'; readonly name: 'key2' }]>
46
+ readonly AiThreadRename: WaAppstateSchema<'ai_thread_rename', 'regular_low', 'chat', 'aiThreadRenameAction', readonly [{ readonly type: 'literal'; readonly value: 'ai_thread_rename' }, { readonly type: 'wid'; readonly name: 'chatJid' }, { readonly type: 'string'; readonly name: 'key2' }]>
47
+ readonly AndroidUnsupportedActions: WaAppstateSchema<'android_unsupported_actions', 'regular_low', 'account', 'androidUnsupportedActions', readonly [{ readonly type: 'literal'; readonly value: 'android_unsupported_actions' }]>
48
+ readonly Archive: WaAppstateSchema<'archive', 'regular_low', 'chatMessageRange', 'archiveChatAction', readonly [{ readonly type: 'literal'; readonly value: 'archive' }, { readonly type: 'wid'; readonly name: 'chatJid' }]>
49
+ readonly AvatarUpdated: WaAppstateSchema<'avatar_updated_action', 'regular', 'account', 'avatarUpdatedAction', readonly [{ readonly type: 'literal'; readonly value: 'avatar_updated_action' }]>
50
+ readonly BizAiSettingsNudge: WaAppstateSchema<'biz_ai_settings_nudge', 'regular_high', 'account', 'bizAiSettingsNudgeAction', readonly [{ readonly type: 'literal'; readonly value: 'biz_ai_settings_nudge' }]>
51
+ readonly BotWelcomeRequest: WaAppstateSchema<'bot_welcome_request', 'regular_low', 'chat', 'botWelcomeRequestAction', readonly [{ readonly type: 'literal'; readonly value: 'bot_welcome_request' }, { readonly type: 'wid'; readonly name: 'chatJid' }]>
52
+ readonly BusinessBroadcastCampaign: WaAppstateSchema<'business_broadcast_campaign', 'regular', 'account', 'businessBroadcastCampaignAction', readonly [{ readonly type: 'literal'; readonly value: 'business_broadcast_campaign' }, { readonly type: 'string'; readonly name: 'key1' }]>
53
+ readonly BusinessBroadcastInsights: WaAppstateSchema<'business_broadcast_insights_sync', 'regular', 'account', 'businessBroadcastInsightsAction', readonly [{ readonly type: 'literal'; readonly value: 'business_broadcast_insights_sync' }, { readonly type: 'string'; readonly name: 'key1' }]>
54
+ readonly BusinessBroadcastList: WaAppstateSchema<'business_broadcast_list', 'regular', 'account', 'businessBroadcastListAction', readonly [{ readonly type: 'literal'; readonly value: 'business_broadcast_list' }, { readonly type: 'string'; readonly name: 'key1' }]>
55
+ readonly CallLog: WaAppstateSchema<'call_log', 'regular', 'account', 'callLogAction', readonly [{ readonly type: 'literal'; readonly value: 'call_log' }]>
56
+ readonly ChatAssignment: WaAppstateSchema<'agentChatAssignment', 'regular', 'chat', 'chatAssignment', readonly [{ readonly type: 'literal'; readonly value: 'agentChatAssignment' }, { readonly type: 'wid'; readonly name: 'chatJid' }]>
57
+ readonly ChatAssignmentOpenedStatus: WaAppstateSchema<'agentChatAssignmentOpenedStatus', 'regular', 'chat', 'chatAssignmentOpenedStatus', readonly [{ readonly type: 'literal'; readonly value: 'agentChatAssignmentOpenedStatus' }, { readonly type: 'wid'; readonly name: 'chatJid' }, { readonly type: 'string'; readonly name: 'key2' }]>
58
+ readonly ChatLockSettings: WaAppstateSchema<'setting_chatLock', 'regular_low', 'account', 'chatLockSettings', readonly [{ readonly type: 'literal'; readonly value: 'setting_chatLock' }]>
59
+ readonly ClearChat: WaAppstateSchema<'clearChat', 'regular_high', 'chatMessageRange', 'clearChatAction', readonly [{ readonly type: 'literal'; readonly value: 'clearChat' }, { readonly type: 'wid'; readonly name: 'chatJid' }, { readonly type: 'string'; readonly name: 'key2' }, { readonly type: 'string'; readonly name: 'key3' }]>
60
+ readonly Contact: WaAppstateSchema<'contact', 'critical_unblock_low', 'account', 'contactAction', readonly [{ readonly type: 'literal'; readonly value: 'contact' }, { readonly type: 'string'; readonly name: 'key1' }]>
61
+ readonly CustomPaymentMethods: WaAppstateSchema<'custom_payment_methods', 'regular_low', 'account', 'customPaymentMethodsAction', readonly [{ readonly type: 'literal'; readonly value: 'custom_payment_methods' }]>
62
+ readonly CustomerData: WaAppstateSchema<'customer_data', 'regular_low', 'account', 'customerDataAction', readonly [{ readonly type: 'literal'; readonly value: 'customer_data' }, { readonly type: 'string'; readonly name: 'key1' }]>
63
+ readonly DeleteChat: WaAppstateSchema<'deleteChat', 'regular_high', 'chatMessageRange', 'deleteChatAction', readonly [{ readonly type: 'literal'; readonly value: 'deleteChat' }, { readonly type: 'wid'; readonly name: 'chatJid' }, { readonly type: 'string'; readonly name: 'key2' }]>
64
+ readonly DeleteMessageForMe: WaAppstateSchema<'deleteMessageForMe', 'regular_high', 'message', 'deleteMessageForMeAction', readonly [{ readonly type: 'literal'; readonly value: 'deleteMessageForMe' }, { readonly type: 'wid'; readonly name: 'remote' }, { readonly type: 'string'; readonly name: 'id' }, { readonly type: 'boolString'; readonly name: 'fromMe' }, { readonly type: 'jid'; readonly name: 'participant' }]>
65
+ readonly DetectedOutcomeStatus: WaAppstateSchema<'detected_outcomes_status_action', 'regular', 'account', 'map', readonly [{ readonly type: 'literal'; readonly value: 'detected_outcomes_status_action' }]>
66
+ readonly DeviceCapabilities: WaAppstateSchema<'device_capabilities', 'regular_low', 'account', 'deviceCapabilities', readonly [{ readonly type: 'literal'; readonly value: 'device_capabilities' }]>
67
+ readonly DisableLinkPreviews: WaAppstateSchema<'setting_disableLinkPreviews', 'regular', 'account', 'privacySettingDisableLinkPreviewsAction', readonly [{ readonly type: 'literal'; readonly value: 'setting_disableLinkPreviews' }]>
68
+ readonly ExternalWebBeta: WaAppstateSchema<'external_web_beta', 'regular', 'account', 'externalWebBetaAction', readonly [{ readonly type: 'literal'; readonly value: 'external_web_beta' }]>
69
+ readonly FavoriteSticker: WaAppstateSchema<'favoriteSticker', 'regular_low', 'account', 'stickerAction', readonly [{ readonly type: 'literal'; readonly value: 'favoriteSticker' }, { readonly type: 'string'; readonly name: 'key1' }]>
70
+ readonly Favorites: WaAppstateSchema<'favorites', 'regular_high', 'account', 'favoritesAction', readonly [{ readonly type: 'literal'; readonly value: 'favorites' }]>
71
+ readonly InteractiveMessageAction: WaAppstateSchema<'interactive_message_action', 'regular_low', 'message', 'interactiveMessageAction', readonly [{ readonly type: 'literal'; readonly value: 'interactive_message_action' }, { readonly type: 'wid'; readonly name: 'remote' }, { readonly type: 'string'; readonly name: 'id' }, { readonly type: 'boolString'; readonly name: 'fromMe' }, { readonly type: 'jid'; readonly name: 'participant' }, { readonly type: 'string'; readonly name: 'arg5' }]>
72
+ readonly LabelEdit: WaAppstateSchema<'label_edit', 'regular', 'account', 'labelEditAction', readonly [{ readonly type: 'literal'; readonly value: 'label_edit' }, { readonly type: 'string'; readonly name: 'key1' }]>
73
+ readonly LabelJid: WaAppstateSchema<'label_jid', 'regular', 'chatOrContact', 'labelAssociationAction', readonly [{ readonly type: 'literal'; readonly value: 'label_jid' }, { readonly type: 'string'; readonly name: 'key1' }, { readonly type: 'wid'; readonly name: 'chatJid' }]>
74
+ readonly LabelReordering: WaAppstateSchema<'label_reordering', 'regular', 'account', 'labelReorderingAction', readonly [{ readonly type: 'literal'; readonly value: 'label_reordering' }]>
75
+ readonly LidContact: WaAppstateSchema<'lid_contact', 'critical_unblock_low', 'account', 'lidContactAction', readonly [{ readonly type: 'literal'; readonly value: 'lid_contact' }, { readonly type: 'string'; readonly name: 'key1' }]>
76
+ readonly LocaleSetting: WaAppstateSchema<'setting_locale', 'critical_block', 'account', 'localeSetting', readonly [{ readonly type: 'literal'; readonly value: 'setting_locale' }]>
77
+ readonly LockChat: WaAppstateSchema<'lock', 'regular_low', 'chat', 'lockChatAction', readonly [{ readonly type: 'literal'; readonly value: 'lock' }, { readonly type: 'wid'; readonly name: 'chatJid' }]>
78
+ readonly MarkChatAsRead: WaAppstateSchema<'markChatAsRead', 'regular_low', 'chatMessageRange', 'markChatAsReadAction', readonly [{ readonly type: 'literal'; readonly value: 'markChatAsRead' }, { readonly type: 'wid'; readonly name: 'chatJid' }]>
79
+ readonly MarketingMessage: WaAppstateSchema<'marketingMessage', 'regular', 'account', 'marketingMessageAction', readonly [{ readonly type: 'literal'; readonly value: 'marketingMessage' }, { readonly type: 'string'; readonly name: 'key1' }]>
80
+ readonly MarketingMessageBroadcast: WaAppstateSchema<'marketingMessageBroadcast', 'regular', 'account', null, readonly [{ readonly type: 'literal'; readonly value: 'marketingMessageBroadcast' }, { readonly type: 'string'; readonly name: 'key1' }, { readonly type: 'string'; readonly name: 'key2' }]>
81
+ readonly MerchantPaymentPartner: WaAppstateSchema<'merchant_payment_partner', 'regular_low', 'account', 'merchantPaymentPartnerAction', readonly [{ readonly type: 'literal'; readonly value: 'merchant_payment_partner' }]>
82
+ readonly Mute: WaAppstateSchema<'mute', 'regular_high', 'chat', 'muteAction', readonly [{ readonly type: 'literal'; readonly value: 'mute' }, { readonly type: 'wid'; readonly name: 'chatJid' }]>
83
+ readonly NctSaltSync: WaAppstateSchema<'nct_salt_sync', 'regular_high', 'account', 'map', readonly [{ readonly type: 'literal'; readonly value: 'nct_salt_sync' }]>
84
+ readonly NoteEdit: WaAppstateSchema<'note_edit', 'regular_low', 'account', 'noteEditAction', readonly [{ readonly type: 'literal'; readonly value: 'note_edit' }, { readonly type: 'string'; readonly name: 'key1' }]>
85
+ readonly Nux: WaAppstateSchema<'nux', 'regular_low', 'account', 'nuxAction', readonly [{ readonly type: 'literal'; readonly value: 'nux' }, { readonly type: 'string'; readonly name: 'key1' }]>
86
+ readonly OutContact: WaAppstateSchema<'out_contact', 'regular_low', 'account', 'outContactAction', readonly [{ readonly type: 'literal'; readonly value: 'out_contact' }, { readonly type: 'string'; readonly name: 'key1' }]>
87
+ readonly PaymentInfo: WaAppstateSchema<'payment_info', 'regular_low', 'account', 'paymentInfoAction', readonly [{ readonly type: 'literal'; readonly value: 'payment_info' }]>
88
+ readonly PaymentTos: WaAppstateSchema<'payment_tos', 'regular_low', 'account', 'paymentTosAction', readonly [{ readonly type: 'literal'; readonly value: 'payment_tos' }]>
89
+ readonly Pin: WaAppstateSchema<'pin_v1', 'regular_low', 'chat', 'pinAction', readonly [{ readonly type: 'literal'; readonly value: 'pin_v1' }, { readonly type: 'wid'; readonly name: 'chatJid' }]>
90
+ readonly PnForLidChat: WaAppstateSchema<'pnForLidChat', 'regular', 'account', 'pnForLidChatAction', readonly [{ readonly type: 'literal'; readonly value: 'pnForLidChat' }, { readonly type: 'string'; readonly name: 'key1' }]>
91
+ readonly PrimaryFeature: WaAppstateSchema<'primary_feature', 'regular', 'account', 'primaryFeature', readonly [{ readonly type: 'literal'; readonly value: 'primary_feature' }]>
92
+ readonly PrimaryVersion: WaAppstateSchema<'primary_version', 'regular_low', 'account', 'primaryVersionAction', readonly [{ readonly type: 'literal'; readonly value: 'primary_version' }, { readonly type: 'string'; readonly name: 'key1' }]>
93
+ readonly QuickReply: WaAppstateSchema<'quick_reply', 'regular', 'account', 'quickReplyAction', readonly [{ readonly type: 'literal'; readonly value: 'quick_reply' }, { readonly type: 'string'; readonly name: 'key1' }]>
94
+ readonly RemoveRecentSticker: WaAppstateSchema<'removeRecentSticker', 'regular_low', 'account', 'removeRecentStickerAction', readonly [{ readonly type: 'literal'; readonly value: 'removeRecentSticker' }, { readonly type: 'string'; readonly name: 'key1' }]>
95
+ readonly Sentinel: WaAppstateSchema<'sentinel', 'regular_low', 'account', 'keyExpiration', readonly [{ readonly type: 'literal'; readonly value: 'sentinel' }]>
96
+ readonly SettingPushName: WaAppstateSchema<'setting_pushName', 'critical_block', 'account', 'pushNameSetting', readonly [{ readonly type: 'literal'; readonly value: 'setting_pushName' }]>
97
+ readonly SettingsSync: WaAppstateSchema<'settings_sync', 'regular_low', 'account', 'settingsSyncAction', readonly [{ readonly type: 'literal'; readonly value: 'settings_sync' }, { readonly type: 'string'; readonly name: 'key1' }, { readonly type: 'string'; readonly name: 'key2' }, { readonly type: 'wid'; readonly name: 'chatJid' }]>
98
+ readonly ShareOwnPn: WaAppstateSchema<'shareOwnPn', 'regular', 'account', null, readonly [{ readonly type: 'literal'; readonly value: 'shareOwnPn' }, { readonly type: 'string'; readonly name: 'key1' }]>
99
+ readonly Star: WaAppstateSchema<'star', 'regular_high', 'message', 'starAction', readonly [{ readonly type: 'literal'; readonly value: 'star' }, { readonly type: 'wid'; readonly name: 'remote' }, { readonly type: 'string'; readonly name: 'id' }, { readonly type: 'boolString'; readonly name: 'fromMe' }, { readonly type: 'jid'; readonly name: 'participant' }]>
100
+ readonly StatusPrivacy: WaAppstateSchema<'status_privacy', 'regular_high', 'account', 'statusPrivacy', readonly [{ readonly type: 'literal'; readonly value: 'status_privacy' }]>
101
+ readonly SubscriptionsSyncV2: WaAppstateSchema<'subscriptions_sync_v2', 'regular', 'account', 'subscriptionsSyncV2Action', readonly [{ readonly type: 'literal'; readonly value: 'subscriptions_sync_v2' }]>
102
+ readonly TimeFormat: WaAppstateSchema<'time_format', 'regular_low', 'account', 'timeFormatAction', readonly [{ readonly type: 'literal'; readonly value: 'time_format' }]>
103
+ readonly UnarchiveChatsSetting: WaAppstateSchema<'setting_unarchiveChats', 'regular_low', 'account', 'unarchiveChatsSetting', readonly [{ readonly type: 'literal'; readonly value: 'setting_unarchiveChats' }]>
104
+ readonly UserStatusMute: WaAppstateSchema<'userStatusMute', 'regular_high', 'account', 'userStatusMuteAction', readonly [{ readonly type: 'literal'; readonly value: 'userStatusMute' }, { readonly type: 'string'; readonly name: 'key1' }]>
105
+ readonly VoipRelayAllCalls: WaAppstateSchema<'setting_relayAllCalls', 'regular', 'account', 'privacySettingRelayAllCalls', readonly [{ readonly type: 'literal'; readonly value: 'setting_relayAllCalls' }]>
106
+ readonly WaffleAccountLinkState: WaAppstateSchema<'waffle_account_link_state', 'regular_high', 'account', 'waffleAccountLinkStateAction', readonly [{ readonly type: 'literal'; readonly value: 'waffle_account_link_state' }]>
107
+ }
108
+
109
+ export type WaAppstateActionKey = keyof typeof WA_APPSTATE_SCHEMAS
110
+
111
+ // --- Derived helpers ------------------------------------------------------
112
+
113
+ // Turn a schema's `indexParts` tuple into the runtime value tuple — what
114
+ // you'd serialise on the wire. Literals are pinned to their constant value;
115
+ // boolString slots widen to the wire-level 'true' | 'false' string.
116
+ //
117
+ // WaAppstateIndexValueOf<typeof WA_APPSTATE_SCHEMAS.Mute>
118
+ // → readonly ['mute', string]
119
+ // WaAppstateIndexValueOf<typeof WA_APPSTATE_SCHEMAS.Star>
120
+ // → readonly ['star', string, string, 'true' | 'false', string]
121
+ export type WaAppstateIndexValueOf<S> = S extends {
122
+ indexParts: infer P extends ReadonlyArray<WaAppstateIndexPart>
123
+ }
124
+ ? {
125
+ readonly [K in keyof P]: P[K] extends { type: 'literal'; value: infer V }
126
+ ? V
127
+ : P[K] extends { type: 'boolString' }
128
+ ? 'true' | 'false'
129
+ : string
130
+ }
131
+ : never
132
+
133
+ // Turn a schema's `indexParts` tuple into the keyword args object — what
134
+ // a typed builder would accept. Literal slots are auto-filled by the
135
+ // builder and dropped from the args; non-literals contribute their `name`.
136
+ //
137
+ // WaAppstateIndexArgs<'Mute'> → { readonly chatJid: string }
138
+ // WaAppstateIndexArgs<'Star'> → {
139
+ // readonly remote: string
140
+ // readonly id: string
141
+ // readonly fromMe: boolean
142
+ // readonly participant: string
143
+ // }
144
+ export type WaAppstateIndexArgs<K extends WaAppstateActionKey> = {
145
+ readonly [Part in (typeof WA_APPSTATE_SCHEMAS)[K]['indexParts'][number] as Part extends {
146
+ type: 'literal'
147
+ }
148
+ ? never
149
+ : Part extends { name: infer N extends string }
150
+ ? N
151
+ : never]: Part extends { type: 'boolString' } ? boolean : string
152
+ }
package/index.js ADDED
@@ -0,0 +1,720 @@
1
+ // AUTO-GENERATED — do not edit. Regenerated daily by wa-spec.
2
+ // WhatsApp Version: 2.3000.1040072419
3
+ 'use strict'
4
+
5
+ const WA_APPSTATE_COLLECTIONS = Object.freeze(['regular', 'regular_low', 'regular_high', 'critical_block', 'critical_unblock_low'])
6
+
7
+ const WA_APPSTATE_SCHEMAS = Object.freeze({
8
+ AdsCtwaPerCustomerDataSharing: Object.freeze({
9
+ name: 'ctwaPerCustomerDataSharing',
10
+ collection: 'regular_high',
11
+ version: 1,
12
+ scope: 'account',
13
+ valueField: 'ctwaPerCustomerDataSharingAction',
14
+ indexParts: Object.freeze([
15
+ Object.freeze({ type: 'literal', value: 'ctwaPerCustomerDataSharing' }),
16
+ Object.freeze({ type: 'string', name: 'key1' })
17
+ ])
18
+ }),
19
+ Agent: Object.freeze({
20
+ name: 'deviceAgent',
21
+ collection: 'regular',
22
+ version: 7,
23
+ scope: 'account',
24
+ valueField: 'agentAction',
25
+ indexParts: Object.freeze([
26
+ Object.freeze({ type: 'literal', value: 'deviceAgent' }),
27
+ Object.freeze({ type: 'string', name: 'key1' })
28
+ ])
29
+ }),
30
+ AiThreadDelete: Object.freeze({
31
+ name: 'ai_thread_delete',
32
+ collection: 'regular_high',
33
+ version: 7,
34
+ scope: 'chat',
35
+ valueField: null,
36
+ indexParts: Object.freeze([
37
+ Object.freeze({ type: 'literal', value: 'ai_thread_delete' }),
38
+ Object.freeze({ type: 'wid', name: 'chatJid' }),
39
+ Object.freeze({ type: 'string', name: 'key2' })
40
+ ])
41
+ }),
42
+ AiThreadPin: Object.freeze({
43
+ name: 'thread_pin',
44
+ collection: 'regular_low',
45
+ version: 7,
46
+ scope: 'chat',
47
+ valueField: 'threadPinAction',
48
+ indexParts: Object.freeze([
49
+ Object.freeze({ type: 'literal', value: 'thread_pin' }),
50
+ Object.freeze({ type: 'wid', name: 'chatJid' }),
51
+ Object.freeze({ type: 'string', name: 'key2' })
52
+ ])
53
+ }),
54
+ AiThreadRename: Object.freeze({
55
+ name: 'ai_thread_rename',
56
+ collection: 'regular_low',
57
+ version: 7,
58
+ scope: 'chat',
59
+ valueField: 'aiThreadRenameAction',
60
+ indexParts: Object.freeze([
61
+ Object.freeze({ type: 'literal', value: 'ai_thread_rename' }),
62
+ Object.freeze({ type: 'wid', name: 'chatJid' }),
63
+ Object.freeze({ type: 'string', name: 'key2' })
64
+ ])
65
+ }),
66
+ AndroidUnsupportedActions: Object.freeze({
67
+ name: 'android_unsupported_actions',
68
+ collection: 'regular_low',
69
+ version: 4,
70
+ scope: 'account',
71
+ valueField: 'androidUnsupportedActions',
72
+ indexParts: Object.freeze([
73
+ Object.freeze({ type: 'literal', value: 'android_unsupported_actions' })
74
+ ])
75
+ }),
76
+ Archive: Object.freeze({
77
+ name: 'archive',
78
+ collection: 'regular_low',
79
+ version: 3,
80
+ scope: 'chatMessageRange',
81
+ valueField: 'archiveChatAction',
82
+ indexParts: Object.freeze([
83
+ Object.freeze({ type: 'literal', value: 'archive' }),
84
+ Object.freeze({ type: 'wid', name: 'chatJid' })
85
+ ])
86
+ }),
87
+ AvatarUpdated: Object.freeze({
88
+ name: 'avatar_updated_action',
89
+ collection: 'regular',
90
+ version: 7,
91
+ scope: 'account',
92
+ valueField: 'avatarUpdatedAction',
93
+ indexParts: Object.freeze([
94
+ Object.freeze({ type: 'literal', value: 'avatar_updated_action' })
95
+ ])
96
+ }),
97
+ BizAiSettingsNudge: Object.freeze({
98
+ name: 'biz_ai_settings_nudge',
99
+ collection: 'regular_high',
100
+ version: 1,
101
+ scope: 'account',
102
+ valueField: 'bizAiSettingsNudgeAction',
103
+ indexParts: Object.freeze([
104
+ Object.freeze({ type: 'literal', value: 'biz_ai_settings_nudge' })
105
+ ])
106
+ }),
107
+ BotWelcomeRequest: Object.freeze({
108
+ name: 'bot_welcome_request',
109
+ collection: 'regular_low',
110
+ version: 2,
111
+ scope: 'chat',
112
+ valueField: 'botWelcomeRequestAction',
113
+ indexParts: Object.freeze([
114
+ Object.freeze({ type: 'literal', value: 'bot_welcome_request' }),
115
+ Object.freeze({ type: 'wid', name: 'chatJid' })
116
+ ])
117
+ }),
118
+ BusinessBroadcastCampaign: Object.freeze({
119
+ name: 'business_broadcast_campaign',
120
+ collection: 'regular',
121
+ version: 1,
122
+ scope: 'account',
123
+ valueField: 'businessBroadcastCampaignAction',
124
+ indexParts: Object.freeze([
125
+ Object.freeze({ type: 'literal', value: 'business_broadcast_campaign' }),
126
+ Object.freeze({ type: 'string', name: 'key1' })
127
+ ])
128
+ }),
129
+ BusinessBroadcastInsights: Object.freeze({
130
+ name: 'business_broadcast_insights_sync',
131
+ collection: 'regular',
132
+ version: 1,
133
+ scope: 'account',
134
+ valueField: 'businessBroadcastInsightsAction',
135
+ indexParts: Object.freeze([
136
+ Object.freeze({ type: 'literal', value: 'business_broadcast_insights_sync' }),
137
+ Object.freeze({ type: 'string', name: 'key1' })
138
+ ])
139
+ }),
140
+ BusinessBroadcastList: Object.freeze({
141
+ name: 'business_broadcast_list',
142
+ collection: 'regular',
143
+ version: 1,
144
+ scope: 'account',
145
+ valueField: 'businessBroadcastListAction',
146
+ indexParts: Object.freeze([
147
+ Object.freeze({ type: 'literal', value: 'business_broadcast_list' }),
148
+ Object.freeze({ type: 'string', name: 'key1' })
149
+ ])
150
+ }),
151
+ CallLog: Object.freeze({
152
+ name: 'call_log',
153
+ collection: 'regular',
154
+ version: 1,
155
+ scope: 'account',
156
+ valueField: 'callLogAction',
157
+ indexParts: Object.freeze([
158
+ Object.freeze({ type: 'literal', value: 'call_log' })
159
+ ])
160
+ }),
161
+ ChatAssignment: Object.freeze({
162
+ name: 'agentChatAssignment',
163
+ collection: 'regular',
164
+ version: 7,
165
+ scope: 'chat',
166
+ valueField: 'chatAssignment',
167
+ indexParts: Object.freeze([
168
+ Object.freeze({ type: 'literal', value: 'agentChatAssignment' }),
169
+ Object.freeze({ type: 'wid', name: 'chatJid' })
170
+ ])
171
+ }),
172
+ ChatAssignmentOpenedStatus: Object.freeze({
173
+ name: 'agentChatAssignmentOpenedStatus',
174
+ collection: 'regular',
175
+ version: 7,
176
+ scope: 'chat',
177
+ valueField: 'chatAssignmentOpenedStatus',
178
+ indexParts: Object.freeze([
179
+ Object.freeze({ type: 'literal', value: 'agentChatAssignmentOpenedStatus' }),
180
+ Object.freeze({ type: 'wid', name: 'chatJid' }),
181
+ Object.freeze({ type: 'string', name: 'key2' })
182
+ ])
183
+ }),
184
+ ChatLockSettings: Object.freeze({
185
+ name: 'setting_chatLock',
186
+ collection: 'regular_low',
187
+ version: 7,
188
+ scope: 'account',
189
+ valueField: 'chatLockSettings',
190
+ indexParts: Object.freeze([
191
+ Object.freeze({ type: 'literal', value: 'setting_chatLock' })
192
+ ])
193
+ }),
194
+ ClearChat: Object.freeze({
195
+ name: 'clearChat',
196
+ collection: 'regular_high',
197
+ version: 6,
198
+ scope: 'chatMessageRange',
199
+ valueField: 'clearChatAction',
200
+ indexParts: Object.freeze([
201
+ Object.freeze({ type: 'literal', value: 'clearChat' }),
202
+ Object.freeze({ type: 'wid', name: 'chatJid' }),
203
+ Object.freeze({ type: 'string', name: 'key2' }),
204
+ Object.freeze({ type: 'string', name: 'key3' })
205
+ ])
206
+ }),
207
+ Contact: Object.freeze({
208
+ name: 'contact',
209
+ collection: 'critical_unblock_low',
210
+ version: 2,
211
+ scope: 'account',
212
+ valueField: 'contactAction',
213
+ indexParts: Object.freeze([
214
+ Object.freeze({ type: 'literal', value: 'contact' }),
215
+ Object.freeze({ type: 'string', name: 'key1' })
216
+ ])
217
+ }),
218
+ CustomPaymentMethods: Object.freeze({
219
+ name: 'custom_payment_methods',
220
+ collection: 'regular_low',
221
+ version: 7,
222
+ scope: 'account',
223
+ valueField: 'customPaymentMethodsAction',
224
+ indexParts: Object.freeze([
225
+ Object.freeze({ type: 'literal', value: 'custom_payment_methods' })
226
+ ])
227
+ }),
228
+ CustomerData: Object.freeze({
229
+ name: 'customer_data',
230
+ collection: 'regular_low',
231
+ version: 1,
232
+ scope: 'account',
233
+ valueField: 'customerDataAction',
234
+ indexParts: Object.freeze([
235
+ Object.freeze({ type: 'literal', value: 'customer_data' }),
236
+ Object.freeze({ type: 'string', name: 'key1' })
237
+ ])
238
+ }),
239
+ DeleteChat: Object.freeze({
240
+ name: 'deleteChat',
241
+ collection: 'regular_high',
242
+ version: 6,
243
+ scope: 'chatMessageRange',
244
+ valueField: 'deleteChatAction',
245
+ indexParts: Object.freeze([
246
+ Object.freeze({ type: 'literal', value: 'deleteChat' }),
247
+ Object.freeze({ type: 'wid', name: 'chatJid' }),
248
+ Object.freeze({ type: 'string', name: 'key2' })
249
+ ])
250
+ }),
251
+ DeleteMessageForMe: Object.freeze({
252
+ name: 'deleteMessageForMe',
253
+ collection: 'regular_high',
254
+ version: 3,
255
+ scope: 'message',
256
+ valueField: 'deleteMessageForMeAction',
257
+ indexParts: Object.freeze([
258
+ Object.freeze({ type: 'literal', value: 'deleteMessageForMe' }),
259
+ Object.freeze({ type: 'wid', name: 'remote' }),
260
+ Object.freeze({ type: 'string', name: 'id' }),
261
+ Object.freeze({ type: 'boolString', name: 'fromMe' }),
262
+ Object.freeze({ type: 'jid', name: 'participant' })
263
+ ])
264
+ }),
265
+ DetectedOutcomeStatus: Object.freeze({
266
+ name: 'detected_outcomes_status_action',
267
+ collection: 'regular',
268
+ version: 1,
269
+ scope: 'account',
270
+ valueField: 'map',
271
+ indexParts: Object.freeze([
272
+ Object.freeze({ type: 'literal', value: 'detected_outcomes_status_action' })
273
+ ])
274
+ }),
275
+ DeviceCapabilities: Object.freeze({
276
+ name: 'device_capabilities',
277
+ collection: 'regular_low',
278
+ version: 7,
279
+ scope: 'account',
280
+ valueField: 'deviceCapabilities',
281
+ indexParts: Object.freeze([
282
+ Object.freeze({ type: 'literal', value: 'device_capabilities' })
283
+ ])
284
+ }),
285
+ DisableLinkPreviews: Object.freeze({
286
+ name: 'setting_disableLinkPreviews',
287
+ collection: 'regular',
288
+ version: 8,
289
+ scope: 'account',
290
+ valueField: 'privacySettingDisableLinkPreviewsAction',
291
+ indexParts: Object.freeze([
292
+ Object.freeze({ type: 'literal', value: 'setting_disableLinkPreviews' })
293
+ ])
294
+ }),
295
+ ExternalWebBeta: Object.freeze({
296
+ name: 'external_web_beta',
297
+ collection: 'regular',
298
+ version: 3,
299
+ scope: 'account',
300
+ valueField: 'externalWebBetaAction',
301
+ indexParts: Object.freeze([
302
+ Object.freeze({ type: 'literal', value: 'external_web_beta' })
303
+ ])
304
+ }),
305
+ FavoriteSticker: Object.freeze({
306
+ name: 'favoriteSticker',
307
+ collection: 'regular_low',
308
+ version: 7,
309
+ scope: 'account',
310
+ valueField: 'stickerAction',
311
+ indexParts: Object.freeze([
312
+ Object.freeze({ type: 'literal', value: 'favoriteSticker' }),
313
+ Object.freeze({ type: 'string', name: 'key1' })
314
+ ])
315
+ }),
316
+ Favorites: Object.freeze({
317
+ name: 'favorites',
318
+ collection: 'regular_high',
319
+ version: 1,
320
+ scope: 'account',
321
+ valueField: 'favoritesAction',
322
+ indexParts: Object.freeze([
323
+ Object.freeze({ type: 'literal', value: 'favorites' })
324
+ ])
325
+ }),
326
+ InteractiveMessageAction: Object.freeze({
327
+ name: 'interactive_message_action',
328
+ collection: 'regular_low',
329
+ version: 1,
330
+ scope: 'message',
331
+ valueField: 'interactiveMessageAction',
332
+ indexParts: Object.freeze([
333
+ Object.freeze({ type: 'literal', value: 'interactive_message_action' }),
334
+ Object.freeze({ type: 'wid', name: 'remote' }),
335
+ Object.freeze({ type: 'string', name: 'id' }),
336
+ Object.freeze({ type: 'boolString', name: 'fromMe' }),
337
+ Object.freeze({ type: 'jid', name: 'participant' }),
338
+ Object.freeze({ type: 'string', name: 'arg5' })
339
+ ])
340
+ }),
341
+ LabelEdit: Object.freeze({
342
+ name: 'label_edit',
343
+ collection: 'regular',
344
+ version: 3,
345
+ scope: 'account',
346
+ valueField: 'labelEditAction',
347
+ indexParts: Object.freeze([
348
+ Object.freeze({ type: 'literal', value: 'label_edit' }),
349
+ Object.freeze({ type: 'string', name: 'key1' })
350
+ ])
351
+ }),
352
+ LabelJid: Object.freeze({
353
+ name: 'label_jid',
354
+ collection: 'regular',
355
+ version: 3,
356
+ scope: 'chatOrContact',
357
+ valueField: 'labelAssociationAction',
358
+ indexParts: Object.freeze([
359
+ Object.freeze({ type: 'literal', value: 'label_jid' }),
360
+ Object.freeze({ type: 'string', name: 'key1' }),
361
+ Object.freeze({ type: 'wid', name: 'chatJid' })
362
+ ])
363
+ }),
364
+ LabelReordering: Object.freeze({
365
+ name: 'label_reordering',
366
+ collection: 'regular',
367
+ version: 3,
368
+ scope: 'account',
369
+ valueField: 'labelReorderingAction',
370
+ indexParts: Object.freeze([
371
+ Object.freeze({ type: 'literal', value: 'label_reordering' })
372
+ ])
373
+ }),
374
+ LidContact: Object.freeze({
375
+ name: 'lid_contact',
376
+ collection: 'critical_unblock_low',
377
+ version: 1,
378
+ scope: 'account',
379
+ valueField: 'lidContactAction',
380
+ indexParts: Object.freeze([
381
+ Object.freeze({ type: 'literal', value: 'lid_contact' }),
382
+ Object.freeze({ type: 'string', name: 'key1' })
383
+ ])
384
+ }),
385
+ LocaleSetting: Object.freeze({
386
+ name: 'setting_locale',
387
+ collection: 'critical_block',
388
+ version: 3,
389
+ scope: 'account',
390
+ valueField: 'localeSetting',
391
+ indexParts: Object.freeze([
392
+ Object.freeze({ type: 'literal', value: 'setting_locale' })
393
+ ])
394
+ }),
395
+ LockChat: Object.freeze({
396
+ name: 'lock',
397
+ collection: 'regular_low',
398
+ version: 7,
399
+ scope: 'chat',
400
+ valueField: 'lockChatAction',
401
+ indexParts: Object.freeze([
402
+ Object.freeze({ type: 'literal', value: 'lock' }),
403
+ Object.freeze({ type: 'wid', name: 'chatJid' })
404
+ ])
405
+ }),
406
+ MarkChatAsRead: Object.freeze({
407
+ name: 'markChatAsRead',
408
+ collection: 'regular_low',
409
+ version: 3,
410
+ scope: 'chatMessageRange',
411
+ valueField: 'markChatAsReadAction',
412
+ indexParts: Object.freeze([
413
+ Object.freeze({ type: 'literal', value: 'markChatAsRead' }),
414
+ Object.freeze({ type: 'wid', name: 'chatJid' })
415
+ ])
416
+ }),
417
+ MarketingMessage: Object.freeze({
418
+ name: 'marketingMessage',
419
+ collection: 'regular',
420
+ version: 7,
421
+ scope: 'account',
422
+ valueField: 'marketingMessageAction',
423
+ indexParts: Object.freeze([
424
+ Object.freeze({ type: 'literal', value: 'marketingMessage' }),
425
+ Object.freeze({ type: 'string', name: 'key1' })
426
+ ])
427
+ }),
428
+ MarketingMessageBroadcast: Object.freeze({
429
+ name: 'marketingMessageBroadcast',
430
+ collection: 'regular',
431
+ version: 7,
432
+ scope: 'account',
433
+ valueField: null,
434
+ indexParts: Object.freeze([
435
+ Object.freeze({ type: 'literal', value: 'marketingMessageBroadcast' }),
436
+ Object.freeze({ type: 'string', name: 'key1' }),
437
+ Object.freeze({ type: 'string', name: 'key2' })
438
+ ])
439
+ }),
440
+ MerchantPaymentPartner: Object.freeze({
441
+ name: 'merchant_payment_partner',
442
+ collection: 'regular_low',
443
+ version: 7,
444
+ scope: 'account',
445
+ valueField: 'merchantPaymentPartnerAction',
446
+ indexParts: Object.freeze([
447
+ Object.freeze({ type: 'literal', value: 'merchant_payment_partner' })
448
+ ])
449
+ }),
450
+ Mute: Object.freeze({
451
+ name: 'mute',
452
+ collection: 'regular_high',
453
+ version: 2,
454
+ scope: 'chat',
455
+ valueField: 'muteAction',
456
+ indexParts: Object.freeze([
457
+ Object.freeze({ type: 'literal', value: 'mute' }),
458
+ Object.freeze({ type: 'wid', name: 'chatJid' })
459
+ ])
460
+ }),
461
+ NctSaltSync: Object.freeze({
462
+ name: 'nct_salt_sync',
463
+ collection: 'regular_high',
464
+ version: 1,
465
+ scope: 'account',
466
+ valueField: 'map',
467
+ indexParts: Object.freeze([
468
+ Object.freeze({ type: 'literal', value: 'nct_salt_sync' })
469
+ ])
470
+ }),
471
+ NoteEdit: Object.freeze({
472
+ name: 'note_edit',
473
+ collection: 'regular_low',
474
+ version: 7,
475
+ scope: 'account',
476
+ valueField: 'noteEditAction',
477
+ indexParts: Object.freeze([
478
+ Object.freeze({ type: 'literal', value: 'note_edit' }),
479
+ Object.freeze({ type: 'string', name: 'key1' })
480
+ ])
481
+ }),
482
+ Nux: Object.freeze({
483
+ name: 'nux',
484
+ collection: 'regular_low',
485
+ version: 7,
486
+ scope: 'account',
487
+ valueField: 'nuxAction',
488
+ indexParts: Object.freeze([
489
+ Object.freeze({ type: 'literal', value: 'nux' }),
490
+ Object.freeze({ type: 'string', name: 'key1' })
491
+ ])
492
+ }),
493
+ OutContact: Object.freeze({
494
+ name: 'out_contact',
495
+ collection: 'regular_low',
496
+ version: 1,
497
+ scope: 'account',
498
+ valueField: 'outContactAction',
499
+ indexParts: Object.freeze([
500
+ Object.freeze({ type: 'literal', value: 'out_contact' }),
501
+ Object.freeze({ type: 'string', name: 'key1' })
502
+ ])
503
+ }),
504
+ PaymentInfo: Object.freeze({
505
+ name: 'payment_info',
506
+ collection: 'regular_low',
507
+ version: 7,
508
+ scope: 'account',
509
+ valueField: 'paymentInfoAction',
510
+ indexParts: Object.freeze([
511
+ Object.freeze({ type: 'literal', value: 'payment_info' })
512
+ ])
513
+ }),
514
+ PaymentTos: Object.freeze({
515
+ name: 'payment_tos',
516
+ collection: 'regular_low',
517
+ version: 7,
518
+ scope: 'account',
519
+ valueField: 'paymentTosAction',
520
+ indexParts: Object.freeze([
521
+ Object.freeze({ type: 'literal', value: 'payment_tos' })
522
+ ])
523
+ }),
524
+ Pin: Object.freeze({
525
+ name: 'pin_v1',
526
+ collection: 'regular_low',
527
+ version: 5,
528
+ scope: 'chat',
529
+ valueField: 'pinAction',
530
+ indexParts: Object.freeze([
531
+ Object.freeze({ type: 'literal', value: 'pin_v1' }),
532
+ Object.freeze({ type: 'wid', name: 'chatJid' })
533
+ ])
534
+ }),
535
+ PnForLidChat: Object.freeze({
536
+ name: 'pnForLidChat',
537
+ collection: 'regular',
538
+ version: 8,
539
+ scope: 'account',
540
+ valueField: 'pnForLidChatAction',
541
+ indexParts: Object.freeze([
542
+ Object.freeze({ type: 'literal', value: 'pnForLidChat' }),
543
+ Object.freeze({ type: 'string', name: 'key1' })
544
+ ])
545
+ }),
546
+ PrimaryFeature: Object.freeze({
547
+ name: 'primary_feature',
548
+ collection: 'regular',
549
+ version: 7,
550
+ scope: 'account',
551
+ valueField: 'primaryFeature',
552
+ indexParts: Object.freeze([
553
+ Object.freeze({ type: 'literal', value: 'primary_feature' })
554
+ ])
555
+ }),
556
+ PrimaryVersion: Object.freeze({
557
+ name: 'primary_version',
558
+ collection: 'regular_low',
559
+ version: 7,
560
+ scope: 'account',
561
+ valueField: 'primaryVersionAction',
562
+ indexParts: Object.freeze([
563
+ Object.freeze({ type: 'literal', value: 'primary_version' }),
564
+ Object.freeze({ type: 'string', name: 'key1' })
565
+ ])
566
+ }),
567
+ QuickReply: Object.freeze({
568
+ name: 'quick_reply',
569
+ collection: 'regular',
570
+ version: 2,
571
+ scope: 'account',
572
+ valueField: 'quickReplyAction',
573
+ indexParts: Object.freeze([
574
+ Object.freeze({ type: 'literal', value: 'quick_reply' }),
575
+ Object.freeze({ type: 'string', name: 'key1' })
576
+ ])
577
+ }),
578
+ RemoveRecentSticker: Object.freeze({
579
+ name: 'removeRecentSticker',
580
+ collection: 'regular_low',
581
+ version: 7,
582
+ scope: 'account',
583
+ valueField: 'removeRecentStickerAction',
584
+ indexParts: Object.freeze([
585
+ Object.freeze({ type: 'literal', value: 'removeRecentSticker' }),
586
+ Object.freeze({ type: 'string', name: 'key1' })
587
+ ])
588
+ }),
589
+ Sentinel: Object.freeze({
590
+ name: 'sentinel',
591
+ collection: 'regular_low',
592
+ version: 3,
593
+ scope: 'account',
594
+ valueField: 'keyExpiration',
595
+ indexParts: Object.freeze([
596
+ Object.freeze({ type: 'literal', value: 'sentinel' })
597
+ ])
598
+ }),
599
+ SettingPushName: Object.freeze({
600
+ name: 'setting_pushName',
601
+ collection: 'critical_block',
602
+ version: 1,
603
+ scope: 'account',
604
+ valueField: 'pushNameSetting',
605
+ indexParts: Object.freeze([
606
+ Object.freeze({ type: 'literal', value: 'setting_pushName' })
607
+ ])
608
+ }),
609
+ SettingsSync: Object.freeze({
610
+ name: 'settings_sync',
611
+ collection: 'regular_low',
612
+ version: 1,
613
+ scope: 'account',
614
+ valueField: 'settingsSyncAction',
615
+ indexParts: Object.freeze([
616
+ Object.freeze({ type: 'literal', value: 'settings_sync' }),
617
+ Object.freeze({ type: 'string', name: 'key1' }),
618
+ Object.freeze({ type: 'string', name: 'key2' }),
619
+ Object.freeze({ type: 'wid', name: 'chatJid' })
620
+ ])
621
+ }),
622
+ ShareOwnPn: Object.freeze({
623
+ name: 'shareOwnPn',
624
+ collection: 'regular',
625
+ version: 8,
626
+ scope: 'account',
627
+ valueField: null,
628
+ indexParts: Object.freeze([
629
+ Object.freeze({ type: 'literal', value: 'shareOwnPn' }),
630
+ Object.freeze({ type: 'string', name: 'key1' })
631
+ ])
632
+ }),
633
+ Star: Object.freeze({
634
+ name: 'star',
635
+ collection: 'regular_high',
636
+ version: 2,
637
+ scope: 'message',
638
+ valueField: 'starAction',
639
+ indexParts: Object.freeze([
640
+ Object.freeze({ type: 'literal', value: 'star' }),
641
+ Object.freeze({ type: 'wid', name: 'remote' }),
642
+ Object.freeze({ type: 'string', name: 'id' }),
643
+ Object.freeze({ type: 'boolString', name: 'fromMe' }),
644
+ Object.freeze({ type: 'jid', name: 'participant' })
645
+ ])
646
+ }),
647
+ StatusPrivacy: Object.freeze({
648
+ name: 'status_privacy',
649
+ collection: 'regular_high',
650
+ version: 7,
651
+ scope: 'account',
652
+ valueField: 'statusPrivacy',
653
+ indexParts: Object.freeze([
654
+ Object.freeze({ type: 'literal', value: 'status_privacy' })
655
+ ])
656
+ }),
657
+ SubscriptionsSyncV2: Object.freeze({
658
+ name: 'subscriptions_sync_v2',
659
+ collection: 'regular',
660
+ version: 1,
661
+ scope: 'account',
662
+ valueField: 'subscriptionsSyncV2Action',
663
+ indexParts: Object.freeze([
664
+ Object.freeze({ type: 'literal', value: 'subscriptions_sync_v2' })
665
+ ])
666
+ }),
667
+ TimeFormat: Object.freeze({
668
+ name: 'time_format',
669
+ collection: 'regular_low',
670
+ version: 7,
671
+ scope: 'account',
672
+ valueField: 'timeFormatAction',
673
+ indexParts: Object.freeze([
674
+ Object.freeze({ type: 'literal', value: 'time_format' })
675
+ ])
676
+ }),
677
+ UnarchiveChatsSetting: Object.freeze({
678
+ name: 'setting_unarchiveChats',
679
+ collection: 'regular_low',
680
+ version: 4,
681
+ scope: 'account',
682
+ valueField: 'unarchiveChatsSetting',
683
+ indexParts: Object.freeze([
684
+ Object.freeze({ type: 'literal', value: 'setting_unarchiveChats' })
685
+ ])
686
+ }),
687
+ UserStatusMute: Object.freeze({
688
+ name: 'userStatusMute',
689
+ collection: 'regular_high',
690
+ version: 7,
691
+ scope: 'account',
692
+ valueField: 'userStatusMuteAction',
693
+ indexParts: Object.freeze([
694
+ Object.freeze({ type: 'literal', value: 'userStatusMute' }),
695
+ Object.freeze({ type: 'string', name: 'key1' })
696
+ ])
697
+ }),
698
+ VoipRelayAllCalls: Object.freeze({
699
+ name: 'setting_relayAllCalls',
700
+ collection: 'regular',
701
+ version: 1,
702
+ scope: 'account',
703
+ valueField: 'privacySettingRelayAllCalls',
704
+ indexParts: Object.freeze([
705
+ Object.freeze({ type: 'literal', value: 'setting_relayAllCalls' })
706
+ ])
707
+ }),
708
+ WaffleAccountLinkState: Object.freeze({
709
+ name: 'waffle_account_link_state',
710
+ collection: 'regular_high',
711
+ version: 1,
712
+ scope: 'account',
713
+ valueField: 'waffleAccountLinkStateAction',
714
+ indexParts: Object.freeze([
715
+ Object.freeze({ type: 'literal', value: 'waffle_account_link_state' })
716
+ ])
717
+ })
718
+ })
719
+
720
+ module.exports = { WA_APPSTATE_COLLECTIONS, WA_APPSTATE_SCHEMAS }
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@vinikjkkj/wa-appstate",
3
+ "version": "0.1.0",
4
+ "description": "WhatsApp Web AppState (Syncd) action schemas — wire names, collections, versions, value fields, index shapes (daily-extracted).",
5
+ "keywords": [
6
+ "whatsapp",
7
+ "whatsapp-web",
8
+ "appstate",
9
+ "syncd",
10
+ "sync-action",
11
+ "multi-device",
12
+ "wa-spec"
13
+ ],
14
+ "license": "MIT",
15
+ "author": {
16
+ "name": "vinikjkkj",
17
+ "url": "https://github.com/vinikjkkj"
18
+ },
19
+ "homepage": "https://github.com/vinikjkkj/wa-spec/tree/main/packages/appstate#readme",
20
+ "bugs": {
21
+ "url": "https://github.com/vinikjkkj/wa-spec/issues"
22
+ },
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/vinikjkkj/wa-spec.git",
26
+ "directory": "packages/appstate"
27
+ },
28
+ "funding": [
29
+ {
30
+ "type": "github",
31
+ "url": "https://github.com/sponsors/vinikjkkj"
32
+ }
33
+ ],
34
+ "main": "index.js",
35
+ "types": "index.d.ts",
36
+ "sideEffects": false,
37
+ "files": [
38
+ "index.js",
39
+ "index.d.ts",
40
+ "README.md"
41
+ ],
42
+ "scripts": {
43
+ "apply": "node ./scripts/apply.cjs"
44
+ },
45
+ "engines": {
46
+ "node": ">=20.9.0"
47
+ },
48
+ "publishConfig": {
49
+ "access": "public"
50
+ }
51
+ }