@vinikjkkj/wa-mex 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 +68 -0
  2. package/index.d.ts +4148 -0
  3. package/index.js +261 -0
  4. package/package.json +53 -0
package/README.md ADDED
@@ -0,0 +1,68 @@
1
+ # @vinikjkkj/wa-mex
2
+
3
+ Typed WhatsApp Web Mex GraphQL bindings — persist IDs, variable shapes, and response shapes.
4
+
5
+ ```sh
6
+ npm i @vinikjkkj/wa-mex
7
+ ```
8
+
9
+ ```ts
10
+ import { WA_MEX_PERSIST_IDS, WA_MEX_OPERATION_SCHEMAS } from '@vinikjkkj/wa-mex'
11
+ import type {
12
+ WaMexPersistId,
13
+ WaMexOperationVariables,
14
+ WaMexOperationResponses,
15
+ WaMexFetchNewsletterVariables,
16
+ WaMexFetchNewsletterResponse
17
+ } from '@vinikjkkj/wa-mex'
18
+
19
+ // Use the persist ID + schema to build your own Mex IQ
20
+ const { docId, clientDocId } = WA_MEX_PERSIST_IDS.FetchNewsletter
21
+ const { operationKind, variables } = WA_MEX_OPERATION_SCHEMAS.FetchNewsletter
22
+ ```
23
+
24
+ ## What's published
25
+
26
+ | File | Format | Use case |
27
+ |---|---|---|
28
+ | `index.js` | CommonJS | Runtime `WA_MEX_PERSIST_IDS` + `WA_MEX_OPERATION_SCHEMAS` frozen tables |
29
+ | `index.d.ts` | TS declarations | Per-op `WaMex<Key>Variables` + `WaMex<Key>Response` types + the umbrella maps |
30
+ | `index.json` | Raw IR | Programmatic access (non-TS consumers, diff tools, code generators in other languages) |
31
+
32
+ `index.json` shape:
33
+
34
+ ```jsonc
35
+ {
36
+ "waVersion": "2.3000.xxxxx",
37
+ "operations": {
38
+ "FetchNewsletter": {
39
+ "originalName": "WAWebMexFetchNewsletterJobQuery",
40
+ "docId": "35452404184358876",
41
+ "operationKind": "query",
42
+ "variables": ["input", "fetch_viewer_metadata", ...],
43
+ "variablesShape": { "input": { "key": null, "type": null, ... }, ... },
44
+ "response": { "xwa2_newsletter": { ... } }
45
+ }
46
+ }
47
+ }
48
+ ```
49
+
50
+ ## Generate locally
51
+
52
+ ```sh
53
+ npx wa-fetcher --out dump/ # download bundles
54
+ npx wa-mex apply --bundles dump/raw/<version>/
55
+ ```
56
+
57
+ ## Caveats
58
+
59
+ - **Leaf types are always `unknown`** — Relay's compiled output strips
60
+ GraphQL scalar types. Recoverable only via schema introspection (not available
61
+ on Meta's prod endpoint).
62
+ - **Names use a short-key transformation** — `WAWebMexFetchNewsletterJobQuery`
63
+ → `FetchNewsletter`. Collisions abort the generator.
64
+ - **Biz/Ad/AI ops are filtered out** by the upstream extractor (newsletter,
65
+ group, profile, username, status — i.e. the surface a generic client cares
66
+ about — are kept).
67
+
68
+ Daily-extracted by [wa-spec](https://github.com/vinikjkkj/wa-spec).