@queenanya/baileys 8.3.8 → 8.4.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.
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": [2, 3000, 1023888953]
2
+ "version": [2, 3000, 1025005758]
3
3
  }
@@ -23,7 +23,7 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
23
23
  toJid: string;
24
24
  isVideo: boolean;
25
25
  }>;
26
- fetchMessageHistory: (count: number, oldestMsgKey: import("../Types").WAMessageKey, oldestMsgTimestamp: number | Long) => Promise<string>;
26
+ fetchMessageHistory: (count: number, oldestMsgKey: import("../Types").WAMessageKey, oldestMsgTimestamp: number | import("long").default) => Promise<string>;
27
27
  requestPlaceholderResend: (messageKey: import("../Types").WAMessageKey) => Promise<string | undefined>;
28
28
  getPrivacyTokens: (jids: string[]) => Promise<any>;
29
29
  assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
@@ -131,6 +131,8 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
131
131
  resyncAppState: (collections: readonly ("critical_unblock_low" | "regular_high" | "regular_low" | "critical_block" | "regular")[], isInitialSync: boolean) => Promise<void>;
132
132
  chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
133
133
  cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
134
+ addOrEditContact: (jid: string, contact: import("../Types").WAProto.SyncActionValue.IContactAction) => Promise<void>;
135
+ removeContact: (jid: string) => Promise<void>;
134
136
  addChatLabel: (jid: string, labelId: string) => Promise<void>;
135
137
  removeChatLabel: (jid: string, labelId: string) => Promise<void>;
136
138
  addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
@@ -1,4 +1,5 @@
1
1
  import { Boom } from '@hapi/boom';
2
+ import { proto } from '../../WAProto';
2
3
  import { BotListInfo, ChatModification, MessageUpsertType, SocketConfig, WABusinessProfile, WAMediaUpload, WAMessage, WAPatchCreate, WAPresence, WAPrivacyCallValue, WAPrivacyGroupAddValue, WAPrivacyMessagesValue, WAPrivacyOnlineValue, WAPrivacyValue, WAReadReceiptsValue } from '../Types';
3
4
  import { BinaryNode } from '../WABinary';
4
5
  import { USyncQuery } from '../WAUSync';
@@ -41,6 +42,8 @@ export declare const makeChatsSocket: (config: SocketConfig) => {
41
42
  resyncAppState: (collections: readonly ("critical_unblock_low" | "regular_high" | "regular_low" | "critical_block" | "regular")[], isInitialSync: boolean) => Promise<void>;
42
43
  chatModify: (mod: ChatModification, jid: string) => Promise<void>;
43
44
  cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
45
+ addOrEditContact: (jid: string, contact: proto.SyncActionValue.IContactAction) => Promise<void>;
46
+ removeContact: (jid: string) => Promise<void>;
44
47
  addChatLabel: (jid: string, labelId: string) => Promise<void>;
45
48
  removeChatLabel: (jid: string, labelId: string) => Promise<void>;
46
49
  addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
@@ -674,6 +674,22 @@ const makeChatsSocket = (config) => {
674
674
  }
675
675
  }, jid);
676
676
  };
677
+ /**
678
+ * Add or Edit Contact
679
+ */
680
+ const addOrEditContact = (jid, contact) => {
681
+ return chatModify({
682
+ contact
683
+ }, jid);
684
+ };
685
+ /**
686
+ * Remove Contact
687
+ */
688
+ const removeContact = (jid) => {
689
+ return chatModify({
690
+ contact: null
691
+ }, jid);
692
+ };
677
693
  /**
678
694
  * Adds label for the chats
679
695
  */
@@ -861,6 +877,8 @@ const makeChatsSocket = (config) => {
861
877
  resyncAppState,
862
878
  chatModify,
863
879
  cleanDirtyBits,
880
+ addOrEditContact,
881
+ removeContact,
864
882
  addChatLabel,
865
883
  removeChatLabel,
866
884
  addMessageLabel,
@@ -82,6 +82,8 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
82
82
  resyncAppState: (collections: readonly ("critical_unblock_low" | "regular_high" | "regular_low" | "critical_block" | "regular")[], isInitialSync: boolean) => Promise<void>;
83
83
  chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
84
84
  cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
85
+ addOrEditContact: (jid: string, contact: proto.SyncActionValue.IContactAction) => Promise<void>;
86
+ removeContact: (jid: string) => Promise<void>;
85
87
  addChatLabel: (jid: string, labelId: string) => Promise<void>;
86
88
  removeChatLabel: (jid: string, labelId: string) => Promise<void>;
87
89
  addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
@@ -22,7 +22,7 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
22
22
  toJid: string;
23
23
  isVideo: boolean;
24
24
  }>;
25
- fetchMessageHistory: (count: number, oldestMsgKey: import("../Types").WAMessageKey, oldestMsgTimestamp: number | Long) => Promise<string>;
25
+ fetchMessageHistory: (count: number, oldestMsgKey: import("../Types").WAMessageKey, oldestMsgTimestamp: number | import("long").default) => Promise<string>;
26
26
  requestPlaceholderResend: (messageKey: import("../Types").WAMessageKey) => Promise<string | undefined>;
27
27
  getPrivacyTokens: (jids: string[]) => Promise<any>;
28
28
  assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
@@ -130,6 +130,8 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
130
130
  resyncAppState: (collections: readonly ("critical_unblock_low" | "regular_high" | "regular_low" | "critical_block" | "regular")[], isInitialSync: boolean) => Promise<void>;
131
131
  chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
132
132
  cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
133
+ addOrEditContact: (jid: string, contact: import("../Types").WAProto.SyncActionValue.IContactAction) => Promise<void>;
134
+ removeContact: (jid: string) => Promise<void>;
133
135
  addChatLabel: (jid: string, labelId: string) => Promise<void>;
134
136
  removeChatLabel: (jid: string, labelId: string) => Promise<void>;
135
137
  addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
@@ -120,6 +120,8 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
120
120
  resyncAppState: (collections: readonly ("critical_unblock_low" | "regular_high" | "regular_low" | "critical_block" | "regular")[], isInitialSync: boolean) => Promise<void>;
121
121
  chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
122
122
  cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
123
+ addOrEditContact: (jid: string, contact: proto.SyncActionValue.IContactAction) => Promise<void>;
124
+ removeContact: (jid: string) => Promise<void>;
123
125
  addChatLabel: (jid: string, labelId: string) => Promise<void>;
124
126
  removeChatLabel: (jid: string, labelId: string) => Promise<void>;
125
127
  addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
@@ -110,6 +110,8 @@ export declare const makeMessagesSocket: (config: SocketConfig) => {
110
110
  resyncAppState: (collections: readonly ("critical_unblock_low" | "regular_high" | "regular_low" | "critical_block" | "regular")[], isInitialSync: boolean) => Promise<void>;
111
111
  chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
112
112
  cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
113
+ addOrEditContact: (jid: string, contact: proto.SyncActionValue.IContactAction) => Promise<void>;
114
+ removeContact: (jid: string) => Promise<void>;
113
115
  addChatLabel: (jid: string, labelId: string) => Promise<void>;
114
116
  removeChatLabel: (jid: string, labelId: string) => Promise<void>;
115
117
  addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
@@ -94,6 +94,8 @@ export declare const makeNewsletterSocket: (config: SocketConfig) => {
94
94
  resyncAppState: (collections: readonly ("critical_unblock_low" | "regular_high" | "regular_low" | "critical_block" | "regular")[], isInitialSync: boolean) => Promise<void>;
95
95
  chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
96
96
  cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
97
+ addOrEditContact: (jid: string, contact: import("../Types").WAProto.SyncActionValue.IContactAction) => Promise<void>;
98
+ removeContact: (jid: string) => Promise<void>;
97
99
  addChatLabel: (jid: string, labelId: string) => Promise<void>;
98
100
  removeChatLabel: (jid: string, labelId: string) => Promise<void>;
99
101
  addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
@@ -88,6 +88,8 @@ export type ChatModification = {
88
88
  } | {
89
89
  delete: true;
90
90
  lastMessages: LastMessageList;
91
+ } | {
92
+ contact: proto.SyncActionValue.IContactAction | null;
91
93
  } | {
92
94
  addChatLabel: ChatLabelAssociationActionBody;
93
95
  } | {
@@ -459,6 +459,17 @@ const chatModificationToAppPatch = (mod, jid) => {
459
459
  operation: OP.SET
460
460
  };
461
461
  }
462
+ else if ('contact' in mod) {
463
+ patch = {
464
+ syncAction: {
465
+ contactAction: mod.contact || {}
466
+ },
467
+ index: ['contact', jid],
468
+ type: 'critical_unblock_low',
469
+ apiVersion: 2,
470
+ operation: mod.contact ? OP.SET : OP.REMOVE
471
+ };
472
+ }
462
473
  else if ('star' in mod) {
463
474
  const key = mod.star.messages[0];
464
475
  patch = {
@@ -65,6 +65,15 @@ export declare const fetchLatestBaileysVersion: (options?: AxiosRequestConfig<an
65
65
  isLatest: boolean;
66
66
  error: any;
67
67
  }>;
68
+ export declare const fetchLatestBaileysVersion2: (options?: AxiosRequestConfig<any>) => Promise<{
69
+ version: WAVersion;
70
+ isLatest: boolean;
71
+ error?: undefined;
72
+ } | {
73
+ version: WAVersion;
74
+ isLatest: boolean;
75
+ error: any;
76
+ }>;
68
77
  /**
69
78
  * utility that fetches latest baileys version from the main branch.
70
79
  * Use to ensure your WA connection is always on the latest version
@@ -82,7 +91,7 @@ export declare const fetchLatestBaileysVersion3: (options?: AxiosRequestConfig<a
82
91
  * utility that fetches latest baileys version from the master branch.
83
92
  * Use to ensure your WA connection is always on the latest version
84
93
  */
85
- export declare const fetchLatestBaileysVersion2: (options?: AxiosRequestConfig<any>) => Promise<{
94
+ export declare const fetchLatestBaileysVersion4: (options?: AxiosRequestConfig<any>) => Promise<{
86
95
  version: WAVersion;
87
96
  isLatest: boolean;
88
97
  error?: undefined;
@@ -36,7 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.isWABusinessPlatform = exports.getCodeFromWSError = exports.getCallStatusFromNode = exports.getErrorCodeFromStreamError = exports.getStatusFromReceiptType = exports.generateMdTagPrefix = exports.fetchLatestWaWebVersion = exports.fetchLatestBaileysVersion2 = exports.fetchLatestBaileysVersion3 = exports.fetchLatestBaileysVersion = exports.printQRIfNecessaryListener = exports.bindWaitForConnectionUpdate = exports.generateMessageID = exports.generateMessageIDV2 = exports.delayCancellable = exports.delay = exports.debouncedTimeout = exports.unixTimestampSeconds = exports.toNumber = exports.encodeBigEndian = exports.generateRegistrationId = exports.encodeNewsletterMessage = exports.encodeWAMessage = exports.unpadRandomMax16 = exports.writeRandomPadMax16 = exports.getKeyAuthor = exports.BufferJSON = exports.getPlatformId = exports.Browserrs = exports.Browsers = void 0;
39
+ exports.isWABusinessPlatform = exports.getCodeFromWSError = exports.getCallStatusFromNode = exports.getErrorCodeFromStreamError = exports.getStatusFromReceiptType = exports.generateMdTagPrefix = exports.fetchLatestWaWebVersion = exports.fetchLatestBaileysVersion4 = exports.fetchLatestBaileysVersion3 = exports.fetchLatestBaileysVersion2 = exports.fetchLatestBaileysVersion = exports.printQRIfNecessaryListener = exports.bindWaitForConnectionUpdate = exports.generateMessageID = exports.generateMessageIDV2 = exports.delayCancellable = exports.delay = exports.debouncedTimeout = exports.unixTimestampSeconds = exports.toNumber = exports.encodeBigEndian = exports.generateRegistrationId = exports.encodeNewsletterMessage = exports.encodeWAMessage = exports.unpadRandomMax16 = exports.writeRandomPadMax16 = exports.getKeyAuthor = exports.BufferJSON = exports.getPlatformId = exports.Browserrs = exports.Browsers = void 0;
40
40
  exports.promiseTimeout = promiseTimeout;
41
41
  exports.bindWaitForEvent = bindWaitForEvent;
42
42
  exports.trimUndefined = trimUndefined;
@@ -351,7 +351,7 @@ exports.printQRIfNecessaryListener = printQRIfNecessaryListener;
351
351
  * Use to ensure your WA connection is always on the latest version
352
352
  */
353
353
  const fetchLatestBaileysVersion = async (options = {}) => {
354
- const URL = 'https://raw.githubusercontent.com/nstar-y/bail/master/src/Defaults/baileys-version.json';
354
+ const URL = 'https://raw.githubusercontent.com/QueenAnya/Bail/master/src/Defaults/baileys-version.json';
355
355
  try {
356
356
  const result = await axios_1.default.get(URL, {
357
357
  ...options,
@@ -371,6 +371,27 @@ const fetchLatestBaileysVersion = async (options = {}) => {
371
371
  }
372
372
  };
373
373
  exports.fetchLatestBaileysVersion = fetchLatestBaileysVersion;
374
+ const fetchLatestBaileysVersion2 = async (options = {}) => {
375
+ const URL = 'https://raw.githubusercontent.com/nstar-y/bail/master/src/Defaults/baileys-version.json';
376
+ try {
377
+ const result = await axios_1.default.get(URL, {
378
+ ...options,
379
+ responseType: 'json'
380
+ });
381
+ return {
382
+ version: result.data.version,
383
+ isLatest: true
384
+ };
385
+ }
386
+ catch (error) {
387
+ return {
388
+ version: baileys_version_json_1.version,
389
+ isLatest: false,
390
+ error
391
+ };
392
+ }
393
+ };
394
+ exports.fetchLatestBaileysVersion2 = fetchLatestBaileysVersion2;
374
395
  /**
375
396
  * utility that fetches latest baileys version from the main branch.
376
397
  * Use to ensure your WA connection is always on the latest version
@@ -401,7 +422,7 @@ exports.fetchLatestBaileysVersion3 = fetchLatestBaileysVersion3;
401
422
  * utility that fetches latest baileys version from the master branch.
402
423
  * Use to ensure your WA connection is always on the latest version
403
424
  */
404
- const fetchLatestBaileysVersion2 = async (options = {}) => {
425
+ const fetchLatestBaileysVersion4 = async (options = {}) => {
405
426
  const URL = 'https://raw.githubusercontent.com/WhiskeySockets/Baileys/master/src/Defaults/baileys-version.json';
406
427
  try {
407
428
  const result = await axios_1.default.get(URL, {
@@ -421,7 +442,7 @@ const fetchLatestBaileysVersion2 = async (options = {}) => {
421
442
  };
422
443
  }
423
444
  };
424
- exports.fetchLatestBaileysVersion2 = fetchLatestBaileysVersion2;
445
+ exports.fetchLatestBaileysVersion4 = fetchLatestBaileysVersion4;
425
446
  /**
426
447
  * A utility that fetches the latest web version of whatsapp.
427
448
  * Use to ensure your WA connection is always on the latest version
@@ -1,5 +1,7 @@
1
1
  export * from './generics';
2
2
  export * from './decode-wa-message';
3
+ export * from './media-messages';
4
+ export * from './media-set';
3
5
  export * from './messages';
4
6
  export * from './messages-media';
5
7
  export * from './validate-connection';
@@ -16,6 +16,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./generics"), exports);
18
18
  __exportStar(require("./decode-wa-message"), exports);
19
+ __exportStar(require("./media-messages"), exports);
20
+ __exportStar(require("./media-set"), exports);
19
21
  __exportStar(require("./messages"), exports);
20
22
  __exportStar(require("./messages-media"), exports);
21
23
  __exportStar(require("./validate-connection"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@queenanya/baileys",
3
- "version": "8.3.8",
3
+ "version": "8.4.0",
4
4
  "description": "Custom Baileys WhatsApp API",
5
5
  "keywords": [
6
6
  "baileys",
@@ -29,6 +29,23 @@
29
29
  "WASignalGroup/*.js",
30
30
  "engine-requirements.js"
31
31
  ],
32
+ "scripts": {
33
+ "build:all": "tsc && typedoc",
34
+ "build:docs": "typedoc",
35
+ "build:tsc": "tsc",
36
+ "changelog:last": "conventional-changelog -p angular -r 2",
37
+ "changelog:preview": "conventional-changelog -p angular -u",
38
+ "changelog:update": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
39
+ "example": "node --inspect -r ts-node/register Example/example.ts",
40
+ "gen:protobuf": "sh WAProto/GenerateStatics.sh",
41
+ "lint": "eslint src --ext .js,.ts",
42
+ "lint:fix": "yarn lint --fix",
43
+ "prepack": "tsc",
44
+ "prepare": "tsc",
45
+ "preinstall": "node ./engine-requirements.js",
46
+ "release": "release-it",
47
+ "test": "jest"
48
+ },
32
49
  "dependencies": {
33
50
  "@adiwajshing/keyed-db": "^0.2.4",
34
51
  "@cacheable/node-cache": "^1.4.0",
@@ -93,20 +110,5 @@
93
110
  "sharp": {
94
111
  "optional": true
95
112
  }
96
- },
97
- "scripts": {
98
- "build:all": "tsc && typedoc",
99
- "build:docs": "typedoc",
100
- "build:tsc": "tsc",
101
- "changelog:last": "conventional-changelog -p angular -r 2",
102
- "changelog:preview": "conventional-changelog -p angular -u",
103
- "changelog:update": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
104
- "example": "node --inspect -r ts-node/register Example/example.ts",
105
- "gen:protobuf": "sh WAProto/GenerateStatics.sh",
106
- "lint": "eslint src --ext .js,.ts",
107
- "lint:fix": "yarn lint --fix",
108
- "preinstall": "node ./engine-requirements.js",
109
- "release": "release-it",
110
- "test": "jest"
111
113
  }
112
- }
114
+ }
@@ -1,2 +0,0 @@
1
- export * from './media-messages';
2
- export * from './media-set';
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./media-messages"), exports);
18
- __exportStar(require("./media-set"), exports);
File without changes
File without changes
File without changes
File without changes