@yemo-dev/yebail 1.0.0 → 1.0.1

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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # yebail
1
+ # @yemo-dev/yebail
2
2
 
3
- **yebails** is a high-performance, WebSocket-based WhatsApp Web API library. It is a specialized distribution of Baileys, optimized for stability and automated version tracking.
3
+ **@yemo-dev/yebail** is a high-performance, WebSocket-based WhatsApp Web API library. It is a specialized distribution of Baileys, optimized for stability and automated version tracking.
4
4
 
5
5
  > [!TIP]
6
6
  > This version is maintained with an **Auto-Update** system that tracks the latest WhatsApp Web revisions to ensure continuous compatibility.
@@ -18,7 +18,7 @@ This project is not affiliated with WhatsApp. Do not spam or use the library in
18
18
  From npm:
19
19
 
20
20
  ```bash
21
- npm install yebails
21
+ npm install @yemo-dev/yebail
22
22
  ```
23
23
 
24
24
  From GitHub:
@@ -29,12 +29,16 @@ npm install github:yemo-dev/baileys
29
29
 
30
30
  ## Import
31
31
 
32
- After installing from GitHub, const {
33
- default: makeWASocket,
32
+ After installing from npm, the module name is `@yemo-dev/yebail`:
33
+
34
+ ```js
35
+ const {
36
+ default: makeWASocket,
37
+ useMultiFileAuthState,
34
38
  DisconnectReason,
35
- useMultiFileAuthState,
36
- fetchLatestWaWebVersion
39
+ fetchLatestWaWebVersion
37
40
  } = require('@yemo-dev/yebail')
41
+ ```
38
42
 
39
43
  From a local clone:
40
44
 
@@ -44,98 +48,53 @@ const makeWASocket = require('./lib').default
44
48
 
45
49
  TypeScript / ESM depends on your bundler.
46
50
 
47
- ## Complete send-message examples per feature
48
-
49
- See **[EXAMPLES.md](./EXAMPLES.md)** — text, buttons, list, templates, **interactive** (quick reply, URL, copy, call, catalog, **PIX `payment_info`**, **`review_and_pay`**, single select, webview), media, polls, location, contacts, orders/products, payments, pin/keep, and more.
51
+ ## Usage
50
52
 
51
- ## Quick start
53
+ Check the `Example/` directory for full implementations.
52
54
 
53
- ```ts
54
- import makeWASocket from 'yebail'
55
+ ### Basic Connection
55
56
 
56
- const sock = makeWASocket({
57
- printQRInTerminal: true
58
- })
59
-
60
- sock.ev.on('creds.update', () => {
61
- /* persist auth */
62
- })
57
+ ```js
58
+ const { default: makeWASocket, useMultiFileAuthState } = require('@yemo-dev/yebail')
59
+
60
+ async function connectToWhatsApp () {
61
+ const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys')
62
+ const sock = makeWASocket({
63
+ printQRInTerminal: true,
64
+ auth: state
65
+ })
66
+
67
+ sock.ev.on('creds.update', saveCreds)
68
+ sock.ev.on('connection.update', (update) => {
69
+ const { connection, lastDisconnect } = update
70
+ if(connection === 'close') {
71
+ const shouldReconnect = lastDisconnect.error?.output?.statusCode !== DisconnectReason.loggedOut
72
+ if(shouldReconnect) connectToWhatsApp()
73
+ } else if(connection === 'open') {
74
+ console.log('opened connection')
75
+ }
76
+ })
77
+ }
78
+
79
+ connectToWhatsApp()
63
80
  ```
64
81
 
65
82
  ### Authentication storage (filesystem, SQLite, cloud DB)
66
83
 
67
- yebails does **not** mandate where session data lives. Credentials and Signal keys are exposed as JSON via the same `state` / `saveCreds` API whether you use files, SQLite, or a remote database.
84
+ **@yemo-dev/yebail** does **not** mandate where session data lives. Credentials and Signal keys are exposed as JSON via the same `state` / `saveCreds` API whether you use files, SQLite, or a remote database.
68
85
 
69
86
  | API | Use case |
70
87
  | --- | --- |
71
- | `useMultiFileAuthState(folder)` | Default: one JSON file per key on local disk (same as classic Baileys). |
72
- | `useSqliteAuthState(pathToDb)` | Single local `.db` file (requires optional `better-sqlite3`). |
73
- | `useCustomAuthState(adapter)` | **Any** backend: implement `get` / `set` / `remove` for string keys and JSON string values — Redis, MongoDB, Postgres, Supabase, Firebase, your own HTTP API, etc. |
74
-
75
- `useCustomAuthState` keys match logical filenames (`creds.json`, `session-….json`, …); `fixAuthStorageKey` applies the same `/` → `__` and `:` → `-` normalization as the file backend.
76
-
77
- For **cloud** storage, encrypt sensitive payloads at rest and restrict access to the credential namespace. Longer examples (Redis, HTTP, SQLite install) are in **[EXAMPLES.md](./EXAMPLES.md#authentication--database-persistence)**.
78
-
79
- ## Index
80
-
81
- - [Code examples](./EXAMPLES.md)
82
- - [Authentication storage (filesystem, SQLite, cloud DB)](#authentication-storage-filesystem-sqlite-cloud-db)
83
- - [Country code and MCC](#country-code-and-mcc-mobile-country-code)
84
- - [LID and addressing](#lid-and-addressing)
85
- - [Import](#import)
86
- - [Events](#events)
87
- - [Sending messages](#sending-messages)
88
- - [Modify messages](#modify-messages)
89
- - [Newsletter](#newsletter)
90
- - [Communities](#communities)
91
-
92
- ### Country code and MCC (mobile country code)
93
-
94
- `DEFAULT_CONNECTION_CONFIG` includes `countryCode` (ISO 3166-1 alpha-2, default `US`). The client `UserAgent` `mcc` field is filled using the bundled `phonenumber-mcc.json` mapping: the international calling code is resolved with `libphonenumber-js` (`getCountryCallingCode`), then the MCC is read from `PHONENUMBER_MCC`.
95
-
96
- Override explicitly with socket config `mcc` (string or number, digits only normalized to 3 characters). Export `PHONENUMBER_MCC` and `getMccForCountryIso2(iso2)` from the package defaults for custom use.
97
-
98
- ### LID and addressing
99
-
100
- Message keys expose LID-related fields for bots and middleware:
101
-
102
- | Field | Role |
103
- | --- | --- |
104
- | `key.senderLid` | Sender LID from stanza when present |
105
- | `key.participantLid` | Group participant LID when present |
106
- | `key.lid` | Alias: `senderLid \|\| participantLid` |
107
- | `key.addressingMode` | `lid` or `pn` derived from stanza |
108
- | `key.remoteJidAlt` | Alternate JID for 1:1 (e.g. PN when chat is LID-addressed) |
109
- | `key.participantAlt` | Alternate JID for groups (mapped PN/LID context) |
110
-
111
- Decryption uses `signalRepository.lidMapping` when available: PN/LID pairs from envelopes and `LID_MIGRATION_MAPPING_SYNC` are stored, sessions can migrate PN to LID, and the event `lid-mapping.update` is emitted with `{ lid, pn }` after migration sync.
112
-
113
- Hosted identifiers (`@hosted`, `@hosted.lid`) are recognized in JID utilities and binary decoding.
114
-
115
- ### Events
116
-
117
- Common `sock.ev` events:
118
-
119
- - `messages.upsert`, `messages.update`, `messages.reaction`
120
- - `groups.update`, `group-participants.update`
121
- - `creds.update`, `call`
122
- - `lid-mapping.update`
123
- - `messaging-history.set`, `chats.phoneNumberShare`
124
-
125
- Placeholder resend (unavailable messages) caches metadata by message id, merges PDO responses without a delayed duplicate `messages.upsert`, and avoids the previous `PEER_DATA` / `MESSAGE_EDIT` switch fall-through bug.
126
-
127
- ### Sending messages
128
-
129
- Use `sock.sendMessage(jid, content, options)`. Details and per-payload examples are in **[EXAMPLES.md](./EXAMPLES.md)**.
130
-
131
- ### Modify messages
88
+ | `useMultiFileAuthState` | Standard filesystem storage (best for local use) |
89
+ | `useSqliteAuthState` | Single file SQLite database (best for shared environments) |
90
+ | `useCustomAuthState` | Your own implementation (Redis, MongoDB, etc.) |
132
91
 
133
- Send payload keys: `delete`, `edit`, `pin`, `keep`.
92
+ ---
134
93
 
135
- ### Newsletter
94
+ ## Contributing
136
95
 
137
- Socket methods include: `subscribeNewsletterUpdates`, `newsletterReactionMode`, `newsletterUpdateDescription`, `newsletterUpdateName`, `newsletterUpdatePicture`, `newsletterRemovePicture`, `newsletterFollow`, `newsletterUnfollow`, `newsletterMute`, `newsletterUnmute`, `newsletterCreate`, `newsletterMetadata`, `newsletterAdminCount`, `newsletterChangeOwner`, `newsletterDemote`, `newsletterDelete`, `newsletterReactMessage`, `newsletterFetchMessages`, `newsletterFetchUpdates`.
96
+ Contributions are welcome. Please ensure you follow the coding standards and provide tests for new features.
138
97
 
139
- ### Communities
98
+ ## License
140
99
 
141
- Socket methods include: `communityMetadata`, `communityCreate`, `communityCreateGroup`, `communityLeave`, `communityUpdateSubject`, `communityLinkGroup`, `communityUnlinkGroup`, `communityFetchLinkedGroups`, `communityRequestParticipantsList`, `communityRequestParticipantsUpdate`, `communityParticipantsUpdate`, `communityUpdateDescription`, `communityInviteCode`, `communityRevokeInvite`, `communityAcceptInvite`, `communityRevokeInviteV4`, `communityAcceptInviteV4`, `communityGetInviteInfo`, `communityToggleEphemeral`, `communitySettingUpdate`, `communityMemberAddMode`, `communityJoinApprovalMode`.
100
+ MIT
@@ -9,7 +9,7 @@ const WAProto_1 = require("../../WAProto");
9
9
  const libsignal_1 = require("../Signal/libsignal");
10
10
  const browser_utils_1 = require("../Utils/browser-utils");
11
11
  const logger_1 = __importDefault(require("../Utils/logger"));
12
- exports.version = [2, 3000, 1036148065];
12
+ exports.version = [2, 3000, 1036155891];
13
13
  exports.PHONENUMBER_MCC = require("./phonenumber-mcc.json");
14
14
  const getMccForCountryIso2 = (iso3166Alpha2) => {
15
15
  const alpha = (iso3166Alpha2 || 'US').toString().toUpperCase();
@@ -2,6 +2,6 @@
2
2
  "version": [
3
3
  2,
4
4
  3000,
5
- 1036148065
5
+ 1015901307
6
6
  ]
7
7
  }
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": [
3
+ 2,
4
+ 3000,
5
+ 1036155891
6
+ ]
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yemo-dev/yebail",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -111,4 +111,4 @@
111
111
  "engines": {
112
112
  "node": ">=20.0.0"
113
113
  }
114
- }
114
+ }