jagproject 5.8.2 → 5.8.5

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 (107) hide show
  1. package/lib/Defaults/index.js +47 -35
  2. package/lib/Socket/business.d.ts +2 -2
  3. package/lib/Socket/chats.d.ts +2 -2
  4. package/lib/Socket/groups.d.ts +2 -2
  5. package/lib/Socket/index.d.ts +2 -2
  6. package/lib/Socket/messages-recv.d.ts +2 -2
  7. package/lib/Socket/messages-recv.js +1 -1
  8. package/lib/Socket/messages-send.d.ts +2 -2
  9. package/lib/Socket/messages-send.js +10 -29
  10. package/lib/Socket/newsletter.d.ts +2 -2
  11. package/lib/Socket/socket.d.ts +2 -2
  12. package/lib/Socket/usync.d.ts +2 -2
  13. package/lib/Store/make-in-memory-store.d.ts +4 -4
  14. package/lib/Store/make-in-memory-store.js +1 -1
  15. package/lib/Types/Events.d.ts +7 -7
  16. package/lib/Types/Socket.d.ts +3 -3
  17. package/lib/Types/index.d.ts +1 -1
  18. package/lib/Utils/browser-utils.js +35 -0
  19. package/lib/Utils/chat-utils.d.ts +2 -2
  20. package/lib/Utils/event-buffer.d.ts +6 -6
  21. package/lib/Utils/event-buffer.js +2 -2
  22. package/lib/Utils/generics.d.ts +7 -7
  23. package/lib/Utils/generics.js +43 -7
  24. package/lib/Utils/index.d.ts +1 -1
  25. package/lib/Utils/index.js +3 -1
  26. package/lib/Utils/message-retry-manager.js +128 -0
  27. package/lib/Utils/messages-media.js +1 -2
  28. package/lib/Utils/process-message.d.ts +2 -2
  29. package/lib/Utils/use-multi-file-auth-state.js +1 -1
  30. package/lib/Utils/validate-connection.js +77 -21
  31. package/lib/Utils/{baileys-event-stream.d.ts → wileys-event-stream.d.ts} +4 -4
  32. package/lib/Utils/{baileys-event-stream.js → wileys-event-stream.js} +1 -1
  33. package/lib/index.js +1 -0
  34. package/package.json +1 -1
  35. package/WAProto/index.d.ts +0 -55057
  36. package/WAProto/index.ts.ts +0 -53473
  37. package/lib/Defaults/index.d.ts +0 -51
  38. package/lib/Signal/Group/ciphertext-message.d.ts +0 -9
  39. package/lib/Signal/Group/group-session-builder.d.ts +0 -14
  40. package/lib/Signal/Group/group_cipher.d.ts +0 -17
  41. package/lib/Signal/Group/index.d.ts +0 -11
  42. package/lib/Signal/Group/keyhelper.d.ts +0 -10
  43. package/lib/Signal/Group/queue-job.d.ts +0 -1
  44. package/lib/Signal/Group/sender-chain-key.d.ts +0 -13
  45. package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -16
  46. package/lib/Signal/Group/sender-key-message.d.ts +0 -18
  47. package/lib/Signal/Group/sender-key-name.d.ts +0 -17
  48. package/lib/Signal/Group/sender-key-record.d.ts +0 -30
  49. package/lib/Signal/Group/sender-key-state.d.ts +0 -38
  50. package/lib/Signal/Group/sender-message-key.d.ts +0 -11
  51. package/lib/Signal/libsignal.d.ts +0 -3
  52. package/lib/Socket/Client/index.d.ts +0 -2
  53. package/lib/Socket/Client/types.d.ts +0 -16
  54. package/lib/Socket/Client/websocket.d.ts +0 -13
  55. package/lib/Store/index.d.ts +0 -2
  56. package/lib/Store/make-ordered-dictionary.d.ts +0 -13
  57. package/lib/Store/object-repository.d.ts +0 -10
  58. package/lib/Types/Auth.d.ts +0 -103
  59. package/lib/Types/Call.d.ts +0 -13
  60. package/lib/Types/Chat.d.ts +0 -109
  61. package/lib/Types/Contact.d.ts +0 -23
  62. package/lib/Types/GroupMetadata.d.ts +0 -64
  63. package/lib/Types/Label.d.ts +0 -35
  64. package/lib/Types/LabelAssociation.d.ts +0 -29
  65. package/lib/Types/Message.d.ts +0 -400
  66. package/lib/Types/Newsletter.d.ts +0 -79
  67. package/lib/Types/Product.d.ts +0 -78
  68. package/lib/Types/Signal.d.ts +0 -57
  69. package/lib/Types/State.d.ts +0 -27
  70. package/lib/Types/USync.d.ts +0 -25
  71. package/lib/Utils/auth-utils.d.ts +0 -18
  72. package/lib/Utils/business.d.ts +0 -22
  73. package/lib/Utils/crypto.d.ts +0 -40
  74. package/lib/Utils/decode-wa-message.d.ts +0 -35
  75. package/lib/Utils/history.d.ts +0 -19
  76. package/lib/Utils/link-preview.d.ts +0 -21
  77. package/lib/Utils/logger.d.ts +0 -11
  78. package/lib/Utils/lt-hash.d.ts +0 -12
  79. package/lib/Utils/make-mutex.d.ts +0 -7
  80. package/lib/Utils/messages-media.d.ts +0 -120
  81. package/lib/Utils/messages.d.ts +0 -80
  82. package/lib/Utils/noise-handler.d.ts +0 -19
  83. package/lib/Utils/signal.d.ts +0 -33
  84. package/lib/Utils/use-multi-file-auth-state.d.ts +0 -12
  85. package/lib/Utils/validate-connection.d.ts +0 -10
  86. package/lib/WABinary/constants.d.ts +0 -27
  87. package/lib/WABinary/decode.d.ts +0 -6
  88. package/lib/WABinary/encode.d.ts +0 -2
  89. package/lib/WABinary/generic-utils.d.ts +0 -14
  90. package/lib/WABinary/index.d.ts +0 -5
  91. package/lib/WABinary/jid-utils.d.ts +0 -37
  92. package/lib/WABinary/types.d.ts +0 -18
  93. package/lib/WAM/BinaryInfo.d.ts +0 -8
  94. package/lib/WAM/constants.d.ts +0 -38
  95. package/lib/WAM/encode.d.ts +0 -2
  96. package/lib/WAM/index.d.ts +0 -3
  97. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -9
  98. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -22
  99. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -12
  100. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -12
  101. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +0 -25
  102. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +0 -8
  103. package/lib/WAUSync/Protocols/index.d.ts +0 -4
  104. package/lib/WAUSync/USyncQuery.d.ts +0 -28
  105. package/lib/WAUSync/USyncUser.d.ts +0 -12
  106. package/lib/WAUSync/index.d.ts +0 -3
  107. package/lib/index.d.ts +0 -16
@@ -3,61 +3,69 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.DEFAULT_CACHE_TTLS = exports.INITIAL_PREKEY_COUNT = exports.MIN_PREKEY_COUNT = exports.MEDIA_KEYS = exports.MEDIA_HKDF_KEY_MAPPING = exports.MEDIA_PATH_MAP = exports.DEFAULT_CONNECTION_CONFIG = exports.PROCESSABLE_HISTORY_TYPES = exports.WA_CERT_DETAILS = exports.URL_REGEX = exports.NOISE_WA_HEADER = exports.KEY_BUNDLE_TYPE = exports.DICT_VERSION = exports.NOISE_MODE = exports.WA_DEFAULT_EPHEMERAL = exports.PHONE_CONNECTION_CB = exports.DEF_TAG_PREFIX = exports.DEF_CALLBACK_PREFIX = exports.DEFAULT_ORIGIN = exports.UNAUTHORIZED_CODES = void 0;
6
+ exports.DEFAULT_CACHE_TTLS = exports.MIN_UPLOAD_INTERVAL = exports.UPLOAD_TIMEOUT = exports.INITIAL_PREKEY_COUNT = exports.MIN_PREKEY_COUNT = exports.MEDIA_KEYS = exports.MEDIA_HKDF_KEY_MAPPING = exports.MEDIA_PATH_MAP = exports.DEFAULT_CONNECTION_CONFIG = exports.PROCESSABLE_HISTORY_TYPES = exports.WA_CERT_DETAILS = exports.URL_REGEX = exports.NOISE_WA_HEADER = exports.KEY_BUNDLE_TYPE = exports.DICT_VERSION = exports.NOISE_MODE = exports.WA_DEFAULT_EPHEMERAL = exports.WA_ADV_HOSTED_DEVICE_SIG_PREFIX = exports.WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX = exports.WA_ADV_DEVICE_SIG_PREFIX = exports.WA_ADV_ACCOUNT_SIG_PREFIX = exports.UNAUTHORIZED_CODES = exports.version = void 0;
7
7
  const WAProto_1 = require("../../WAProto");
8
8
  const libsignal_1 = require("../Signal/libsignal");
9
- const Utils_1 = require("../Utils");
9
+ const browser_utils_1 = require("../Utils/browser-utils");
10
10
  const logger_1 = __importDefault(require("../Utils/logger"));
11
- const baileys_version_json_1 = require("./wileys-version.json");
11
+ exports.version = [2, 3000, 1027934701];
12
12
  exports.UNAUTHORIZED_CODES = [401, 403, 419];
13
13
  exports.DEFAULT_ORIGIN = 'https://web.whatsapp.com';
14
+ exports.CALL_VIDEO_PREFIX = 'https://call.whatsapp.com/video/';
15
+ exports.CALL_AUDIO_PREFIX = 'https://call.whatsapp.com/voice/';
14
16
  exports.DEF_CALLBACK_PREFIX = 'CB:';
15
17
  exports.DEF_TAG_PREFIX = 'TAG:';
16
18
  exports.PHONE_CONNECTION_CB = 'CB:Pong';
19
+ exports.WA_ADV_ACCOUNT_SIG_PREFIX = Buffer.from([6, 0]);
20
+ exports.WA_ADV_DEVICE_SIG_PREFIX = Buffer.from([6, 1]);
21
+ exports.WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX = Buffer.from([6, 5]);
22
+ exports.WA_ADV_HOSTED_DEVICE_SIG_PREFIX = Buffer.from([6, 6]);
17
23
  exports.WA_DEFAULT_EPHEMERAL = 7 * 24 * 60 * 60;
18
24
  exports.NOISE_MODE = 'Noise_XX_25519_AESGCM_SHA256\0\0\0\0';
19
25
  exports.DICT_VERSION = 3;
20
26
  exports.KEY_BUNDLE_TYPE = Buffer.from([5]);
21
- exports.NOISE_WA_HEADER = Buffer.from([87, 65, 6, exports.DICT_VERSION]); // last is "DICT_VERSION"
22
- /** from: https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url */
27
+ exports.NOISE_WA_HEADER = Buffer.from([87, 65, 6, exports.DICT_VERSION]);
23
28
  exports.URL_REGEX = /https:\/\/(?![^:@\/\s]+:[^:@\/\s]+@)[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}(:\d+)?(\/[^\s]*)?/g;
24
29
  exports.WA_CERT_DETAILS = {
25
- SERIAL: 0,
30
+ SERIAL: 0
26
31
  };
27
32
  exports.PROCESSABLE_HISTORY_TYPES = [
28
- WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.INITIAL_BOOTSTRAP,
29
- WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.PUSH_NAME,
30
- WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.RECENT,
31
- WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.FULL,
32
- WAProto_1.proto.Message.HistorySyncNotification.HistorySyncType.ON_DEMAND,
33
+ WAProto_1.proto.HistorySync.HistorySyncType.INITIAL_BOOTSTRAP,
34
+ WAProto_1.proto.HistorySync.HistorySyncType.PUSH_NAME,
35
+ WAProto_1.proto.HistorySync.HistorySyncType.RECENT,
36
+ WAProto_1.proto.HistorySync.HistorySyncType.FULL,
37
+ WAProto_1.proto.HistorySync.HistorySyncType.ON_DEMAND,
38
+ WAProto_1.proto.HistorySync.HistorySyncType.NON_BLOCKING_DATA,
39
+ WAProto_1.proto.HistorySync.HistorySyncType.INITIAL_STATUS_V3,
33
40
  ];
34
41
  exports.DEFAULT_CONNECTION_CONFIG = {
35
- version: baileys_version_json_1.version,
36
- browser: Utils_1.Browsers.ubuntu('Chrome'),
42
+ version: exports.version,
43
+ browser: (0, browser_utils_1.Browsers)('Chrome'),
37
44
  waWebSocketUrl: 'wss://web.whatsapp.com/ws/chat',
38
- connectTimeoutMs: 20000,
39
- keepAliveIntervalMs: 30000,
45
+ connectTimeoutMs: 20_000,
46
+ keepAliveIntervalMs: 30_000,
40
47
  logger: logger_1.default.child({ class: 'baileys' }),
41
- printQRInTerminal: false,
42
48
  emitOwnEvents: true,
43
- defaultQueryTimeoutMs: 60000,
49
+ defaultQueryTimeoutMs: 60_000,
44
50
  customUploadHosts: [],
45
51
  retryRequestDelayMs: 250,
46
52
  maxMsgRetryCount: 5,
47
53
  fireInitQueries: true,
48
54
  auth: undefined,
49
55
  markOnlineOnConnect: true,
50
- syncFullHistory: false,
56
+ syncFullHistory: true,
51
57
  patchMessageBeforeSending: msg => msg,
52
58
  shouldSyncHistoryMessage: () => true,
53
59
  shouldIgnoreJid: () => false,
54
60
  linkPreviewImageThumbnailWidth: 192,
55
61
  transactionOpts: { maxCommitRetries: 10, delayBetweenTriesMs: 3000 },
56
62
  generateHighQualityLinkPreview: false,
63
+ enableAutoSessionRecreation: true,
64
+ enableRecentMessageCache: true,
57
65
  options: {},
58
66
  appStateMacVerification: {
59
67
  patch: false,
60
- snapshot: false,
68
+ snapshot: false
61
69
  },
62
70
  countryCode: 'US',
63
71
  getMessage: async () => undefined,
@@ -74,17 +82,18 @@ exports.MEDIA_PATH_MAP = {
74
82
  'product-catalog-image': '/product/image',
75
83
  'md-app-state': '',
76
84
  'md-msg-hist': '/mms/md-app-state',
85
+ 'biz-cover-photo': '/pps/biz-cover-photo'
77
86
  };
78
87
  exports.MEDIA_HKDF_KEY_MAPPING = {
79
- 'audio': 'Audio',
80
- 'document': 'Document',
81
- 'gif': 'Video',
82
- 'image': 'Image',
83
- 'ppic': '',
84
- 'product': 'Image',
85
- 'ptt': 'Audio',
86
- 'sticker': 'Image',
87
- 'video': 'Video',
88
+ audio: 'Audio',
89
+ document: 'Document',
90
+ gif: 'Video',
91
+ image: 'Image',
92
+ ppic: '',
93
+ product: 'Image',
94
+ ptt: 'Audio',
95
+ sticker: 'Image',
96
+ video: 'Video',
88
97
  'thumbnail-document': 'Document Thumbnail',
89
98
  'thumbnail-image': 'Image Thumbnail',
90
99
  'thumbnail-video': 'Video Thumbnail',
@@ -93,14 +102,17 @@ exports.MEDIA_HKDF_KEY_MAPPING = {
93
102
  'md-app-state': 'App State',
94
103
  'product-catalog-image': '',
95
104
  'payment-bg-image': 'Payment Background',
96
- 'ptv': 'Video'
105
+ ptv: 'Video',
106
+ 'biz-cover-photo': 'Image'
97
107
  };
98
108
  exports.MEDIA_KEYS = Object.keys(exports.MEDIA_PATH_MAP);
99
109
  exports.MIN_PREKEY_COUNT = 5;
100
- exports.INITIAL_PREKEY_COUNT = 30;
110
+ exports.INITIAL_PREKEY_COUNT = 812;
111
+ exports.UPLOAD_TIMEOUT = 30000;
112
+ exports.MIN_UPLOAD_INTERVAL = 5000;
101
113
  exports.DEFAULT_CACHE_TTLS = {
102
- SIGNAL_STORE: 5 * 60, // 5 minutes
103
- MSG_RETRY: 60 * 60, // 1 hour
104
- CALL_OFFER: 5 * 60, // 5 minutes
105
- USER_DEVICES: 5 * 60, // 5 minutes
106
- };
114
+ SIGNAL_STORE: 5 * 60,
115
+ MSG_RETRY: 60 * 60,
116
+ CALL_OFFER: 5 * 60,
117
+ USER_DEVICES: 5 * 60
118
+ };
@@ -142,8 +142,8 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
142
142
  executeUSyncQuery: (usyncQuery: import("..").USyncQuery) => Promise<import("..").USyncQueryResult | undefined>;
143
143
  type: "md";
144
144
  ws: import("./Client").WebSocketClient;
145
- ev: import("../Types").BaileysEventEmitter & {
146
- process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
145
+ ev: import("../Types").WileysEventEmitter & {
146
+ process(handler: (events: Partial<import("../Types").WileysEventMap>) => void | Promise<void>): (() => void);
147
147
  buffer(): void;
148
148
  createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
149
149
  flush(force?: boolean): boolean;
@@ -52,8 +52,8 @@ export declare const makeChatsSocket: (config: SocketConfig) => {
52
52
  executeUSyncQuery: (usyncQuery: USyncQuery) => Promise<import("../WAUSync").USyncQueryResult | undefined>;
53
53
  type: "md";
54
54
  ws: import("./Client").WebSocketClient;
55
- ev: import("../Types").BaileysEventEmitter & {
56
- process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
55
+ ev: import("../Types").WileysEventEmitter & {
56
+ process(handler: (events: Partial<import("../Types").WileysEventMap>) => void | Promise<void>): (() => void);
57
57
  buffer(): void;
58
58
  createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
59
59
  flush(force?: boolean): boolean;
@@ -93,8 +93,8 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
93
93
  executeUSyncQuery: (usyncQuery: import("..").USyncQuery) => Promise<import("..").USyncQueryResult | undefined>;
94
94
  type: "md";
95
95
  ws: import("./Client").WebSocketClient;
96
- ev: import("../Types").BaileysEventEmitter & {
97
- process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
96
+ ev: import("../Types").WileysEventEmitter & {
97
+ process(handler: (events: Partial<import("../Types").WileysEventMap>) => void | Promise<void>): (() => void);
98
98
  buffer(): void;
99
99
  createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
100
100
  flush(force?: boolean): boolean;
@@ -141,8 +141,8 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
141
141
  executeUSyncQuery: (usyncQuery: import("..").USyncQuery) => Promise<import("..").USyncQueryResult | undefined>;
142
142
  type: "md";
143
143
  ws: import("./Client").WebSocketClient;
144
- ev: import("../Types").BaileysEventEmitter & {
145
- process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
144
+ ev: import("../Types").WileysEventEmitter & {
145
+ process(handler: (events: Partial<import("../Types").WileysEventMap>) => void | Promise<void>): (() => void);
146
146
  buffer(): void;
147
147
  createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
148
148
  flush(force?: boolean): boolean;
@@ -131,8 +131,8 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
131
131
  executeUSyncQuery: (usyncQuery: import("..").USyncQuery) => Promise<import("..").USyncQueryResult | undefined>;
132
132
  type: "md";
133
133
  ws: import("./Client").WebSocketClient;
134
- ev: import("../Types").BaileysEventEmitter & {
135
- process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
134
+ ev: import("../Types").WileysEventEmitter & {
135
+ process(handler: (events: Partial<import("../Types").WileysEventMap>) => void | Promise<void>): (() => void);
136
136
  buffer(): void;
137
137
  createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
138
138
  flush(force?: boolean): boolean;
@@ -332,7 +332,7 @@ const makeMessagesRecvSocket = (config) => {
332
332
  break;
333
333
  break;
334
334
  default:
335
- // console.log("BAILEYS-DEBUG:", JSON.stringify({ ...child, content: Buffer.isBuffer(child.content) ? child.content.toString() : child.content, participant }, null, 2))
335
+ // console.log("WILEYS-DEBUG:", JSON.stringify({ ...child, content: Buffer.isBuffer(child.content) ? child.content.toString() : child.content, participant }, null, 2))
336
336
  }
337
337
  };
338
338
  const handleNewsletterNotification = (id, node) => {
@@ -121,8 +121,8 @@ export declare const makeMessagesSocket: (config: SocketConfig) => {
121
121
  executeUSyncQuery: (usyncQuery: USyncQuery) => Promise<import("../WAUSync").USyncQueryResult | undefined>;
122
122
  type: "md";
123
123
  ws: import("./Client").WebSocketClient;
124
- ev: import("../Types").BaileysEventEmitter & {
125
- process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
124
+ ev: import("../Types").WileysEventEmitter & {
125
+ process(handler: (events: Partial<import("../Types").WileysEventMap>) => void | Promise<void>): (() => void);
126
126
  buffer(): void;
127
127
  createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
128
128
  flush(force?: boolean): boolean;
@@ -687,28 +687,16 @@ const makeMessagesSocket = (config) => {
687
687
  return message;
688
688
  },
689
689
 
690
- /**
691
- * === PATCH: upswgc ===
692
- * Fungsi untuk mengirim group status message / story grup
693
- * Contoh:
694
- * await sock.upswgc(jid, { text: "Hello World" })
695
- */
696
- /**
697
- * === PATCH: upswgc (Final Combo) ===
698
- * Support teks + semua media (image, video, doc, audio)
699
- */
690
+ // === PATCH: upswgc ===
700
691
  upswgc: async (jid, storyContent = {}) => {
701
692
  try {
702
693
  const userJid = authState?.creds?.me?.id || sock?.user?.id;
703
694
  let waMsgContent;
704
-
705
- // Deteksi apakah konten punya media
706
695
  const hasMedia = storyContent.image || storyContent.video || storyContent.document || storyContent.audio;
707
696
 
708
697
  if (storyContent.message) {
709
698
  waMsgContent = storyContent;
710
699
  } else if (hasMedia) {
711
- // Untuk media
712
700
  if (typeof Utils_1.generateWAMessageContent === "function") {
713
701
  waMsgContent = await Utils_1.generateWAMessageContent(storyContent, {
714
702
  upload: waUploadToServer
@@ -721,19 +709,14 @@ upswgc: async (jid, storyContent = {}) => {
721
709
  waMsgContent = storyContent;
722
710
  }
723
711
  } else if (storyContent.text) {
724
- // Untuk teks biasa
725
- waMsgContent = {
726
- conversation: storyContent.text
727
- };
712
+ waMsgContent = { conversation: storyContent.text };
728
713
  } else {
729
714
  waMsgContent = storyContent;
730
715
  }
731
716
 
732
717
  const msg = {
733
718
  message: {
734
- groupStatusMessageV2: {
735
- message: waMsgContent.message || waMsgContent
736
- }
719
+ groupStatusMessageV2: { message: waMsgContent.message || waMsgContent }
737
720
  }
738
721
  };
739
722
 
@@ -742,7 +725,6 @@ upswgc: async (jid, storyContent = {}) => {
742
725
  : Utils_1.generateMessageID();
743
726
 
744
727
  await relayMessage(jid, msg.message, { messageId });
745
-
746
728
  console.log("upswgc success:", jid);
747
729
  return msg;
748
730
  } catch (err) {
@@ -752,11 +734,12 @@ upswgc: async (jid, storyContent = {}) => {
752
734
  },
753
735
 
754
736
 
755
-
756
- sendMessage: async (jid, content, options = {}) => {
757
- var _a, _b, _c;
758
737
 
759
- // === AUTO WAVEFORM PATCH START ===
738
+ sendMessage: async (jid, content, options = {}) => {
739
+ var _a, _b, _c;
740
+
741
+
742
+ // === AUTO WAVEFORM PATCH START ===
760
743
  try {
761
744
  const { getAudioWaveform } = require('../Utils/messages-media');
762
745
  const fs = require('fs');
@@ -781,6 +764,8 @@ upswgc: async (jid, storyContent = {}) => {
781
764
  console.log('[WILEYSS PATCH] Gagal generate waveform otomatis:', err.message);
782
765
  }
783
766
  // === AUTO WAVEFORM PATCH END ===
767
+
768
+
784
769
  const userJid = authState.creds.me.id;
785
770
  if (!options.ephemeralExpiration) {
786
771
  if ((0, WABinary_1.isJidGroup)(jid)) {
@@ -872,10 +857,6 @@ upswgc: async (jid, storyContent = {}) => {
872
857
  }
873
858
  else {
874
859
  let mediaHandle;
875
- if (content.waveform) {
876
- console.log('[VN PATCH] waveform attached len =', content.waveform.length);
877
- }
878
-
879
860
  const fullMsg = await (0, Utils_1.generateWAMessage)(jid, content, {
880
861
  logger,
881
862
  userJid,
@@ -105,8 +105,8 @@ export declare const makeNewsletterSocket: (config: SocketConfig) => {
105
105
  executeUSyncQuery: (usyncQuery: import("..").USyncQuery) => Promise<import("..").USyncQueryResult | undefined>;
106
106
  type: "md";
107
107
  ws: import("./Client").WebSocketClient;
108
- ev: import("../Types").BaileysEventEmitter & {
109
- process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
108
+ ev: import("../Types").WileysEventEmitter & {
109
+ process(handler: (events: Partial<import("../Types").WileysEventMap>) => void | Promise<void>): (() => void);
110
110
  buffer(): void;
111
111
  createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
112
112
  flush(force?: boolean): boolean;
@@ -11,8 +11,8 @@ import { WebSocketClient } from './Client';
11
11
  export declare const makeSocket: (config: SocketConfig) => {
12
12
  type: "md";
13
13
  ws: WebSocketClient;
14
- ev: import("../Types").BaileysEventEmitter & {
15
- process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
14
+ ev: import("../Types").WileysEventEmitter & {
15
+ process(handler: (events: Partial<import("../Types").WileysEventMap>) => void | Promise<void>): (() => void);
16
16
  buffer(): void;
17
17
  createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
18
18
  flush(force?: boolean): boolean;
@@ -6,8 +6,8 @@ export declare const makeUSyncSocket: (config: SocketConfig) => {
6
6
  executeUSyncQuery: (usyncQuery: USyncQuery) => Promise<import("../WAUSync").USyncQueryResult | undefined>;
7
7
  type: "md";
8
8
  ws: import("./Client").WebSocketClient;
9
- ev: import("../Types").BaileysEventEmitter & {
10
- process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
9
+ ev: import("../Types").WileysEventEmitter & {
10
+ process(handler: (events: Partial<import("../Types").WileysEventMap>) => void | Promise<void>): (() => void);
11
11
  buffer(): void;
12
12
  createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
13
13
  flush(force?: boolean): boolean;
@@ -2,7 +2,7 @@ import type KeyedDB from '@adiwajshing/keyed-db';
2
2
  import type { Comparable } from '@adiwajshing/keyed-db/lib/Types';
3
3
  import { proto } from '../../WAProto';
4
4
  import type makeMDSocket from '../Socket';
5
- import type { BaileysEventEmitter, Chat, ConnectionState, Contact, GroupMetadata, PresenceData, WAMessage, WAMessageCursor, WAMessageKey } from '../Types';
5
+ import type { WileysEventEmitter, Chat, ConnectionState, Contact, GroupMetadata, PresenceData, WAMessage, WAMessageCursor, WAMessageKey } from '../Types';
6
6
  import { Label } from '../Types/Label';
7
7
  import { LabelAssociation } from '../Types/LabelAssociation';
8
8
  import { ILogger } from '../Utils/logger';
@@ -14,13 +14,13 @@ export declare const waChatKey: (pin: boolean) => {
14
14
  };
15
15
  export declare const waMessageID: (m: WAMessage) => string;
16
16
  export declare const waLabelAssociationKey: Comparable<LabelAssociation, string>;
17
- export type BaileysInMemoryStoreConfig = {
17
+ export type WileysInMemoryStoreConfig = {
18
18
  chatKey?: Comparable<Chat, string>;
19
19
  labelAssociationKey?: Comparable<LabelAssociation, string>;
20
20
  logger?: ILogger;
21
21
  socket?: WASocket;
22
22
  };
23
- declare const _default: (config: BaileysInMemoryStoreConfig) => {
23
+ declare const _default: (config: WileysInMemoryStoreConfig) => {
24
24
  chats: KeyedDB<Chat, string>;
25
25
  contacts: {
26
26
  [_: string]: Contact;
@@ -50,7 +50,7 @@ declare const _default: (config: BaileysInMemoryStoreConfig) => {
50
50
  };
51
51
  labels: ObjectRepository<Label>;
52
52
  labelAssociations: KeyedDB<LabelAssociation, string>;
53
- bind: (ev: BaileysEventEmitter) => void;
53
+ bind: (ev: WileysEventEmitter) => void;
54
54
  /** loads messages from the store, if not found -- uses the legacy connection */
55
55
  loadMessages: (jid: string, count: number, cursor: WAMessageCursor) => Promise<WAMessage[]>;
56
56
  /**
@@ -65,7 +65,7 @@ exports.default = (config) => {
65
65
  return Object.keys(contacts);
66
66
  };
67
67
  /**
68
- * binds to a BaileysEventEmitter.
68
+ * binds to a WileysEventEmitter.
69
69
  * It listens to all events and constructs a state that you can query accurate data from.
70
70
  * Eg. can use the store to fetch chats, contacts, messages etc.
71
71
  * @param ev typically the event emitter from the socket connection
@@ -10,7 +10,7 @@ import { LabelAssociation } from './LabelAssociation';
10
10
  import { MessageUpsertType, MessageUserReceiptUpdate, WAMessage, WAMessageKey, WAMessageUpdate } from './Message';
11
11
  import { ConnectionState } from './State';
12
12
  import { NewsletterSettingsUpdate, SubscriberAction, NewsletterViewRole } from './Newsletter';
13
- export type BaileysEventMap = {
13
+ export type WileysEventMap = {
14
14
  /** connection state has been updated -- WS closed, opened, connecting etc. */
15
15
  'connection.update': Partial<ConnectionState>;
16
16
  /** credentials updated -- some metadata, keys or something */
@@ -190,10 +190,10 @@ export type BufferedEventData = {
190
190
  [jid: string]: Partial<GroupMetadata>;
191
191
  };
192
192
  };
193
- export type BaileysEvent = keyof BaileysEventMap;
194
- export interface BaileysEventEmitter {
195
- on<T extends keyof BaileysEventMap>(event: T, listener: (arg: BaileysEventMap[T]) => void): void;
196
- off<T extends keyof BaileysEventMap>(event: T, listener: (arg: BaileysEventMap[T]) => void): void;
197
- removeAllListeners<T extends keyof BaileysEventMap>(event: T): void;
198
- emit<T extends keyof BaileysEventMap>(event: T, arg: BaileysEventMap[T]): boolean;
193
+ export type WileysEvent = keyof WileysEventMap;
194
+ export interface WileysEventEmitter {
195
+ on<T extends keyof WileysEventMap>(event: T, listener: (arg: WileysEventMap[T]) => void): void;
196
+ off<T extends keyof WileysEventMap>(event: T, listener: (arg: WileysEventMap[T]) => void): void;
197
+ removeAllListeners<T extends keyof WileysEventMap>(event: T): void;
198
+ emit<T extends keyof WileysEventMap>(event: T, arg: WileysEventMap[T]): boolean;
199
199
  }
@@ -31,7 +31,7 @@ export type SocketConfig = {
31
31
  defaultQueryTimeoutMs: number | undefined;
32
32
  /** ping-pong interval for WS connection */
33
33
  keepAliveIntervalMs: number;
34
- /** should baileys use the mobile api instead of the multi device api
34
+ /** should wileys use the mobile api instead of the multi device api
35
35
  * @deprecated This feature has been removed
36
36
  */
37
37
  mobile?: boolean;
@@ -81,9 +81,9 @@ export type SocketConfig = {
81
81
  placeholderResendCache?: CacheStore;
82
82
  /** width for link preview images */
83
83
  linkPreviewImageThumbnailWidth: number;
84
- /** Should Baileys ask the phone for full history, will be received async */
84
+ /** Should Wileys ask the phone for full history, will be received async */
85
85
  syncFullHistory: boolean;
86
- /** Should baileys fire init queries automatically, default true */
86
+ /** Should wileys fire init queries automatically, default true */
87
87
  fireInitQueries: boolean;
88
88
  /**
89
89
  * generate a high quality link preview,
@@ -18,7 +18,7 @@ export type UserFacingSocketConfig = Partial<SocketConfig> & {
18
18
  export type BrowsersMap = {
19
19
  ubuntu(browser: string): [string, string, string];
20
20
  macOS(browser: string): [string, string, string];
21
- baileys(browser: string): [string, string, string];
21
+ wileys(browser: string): [string, string, string];
22
22
  windows(browser: string): [string, string, string];
23
23
  appropriate(browser: string): [string, string, string];
24
24
  };
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPlatformId = exports.Browsers = void 0;
4
+
5
+ const os = require("os");
6
+ const { proto } = require("../../WAProto/index.js");
7
+
8
+ const PLATFORM_MAP = {
9
+ 'aix': 'AIX',
10
+ 'darwin': 'Mac OS',
11
+ 'win32': 'Windows',
12
+ 'android': 'Android',
13
+ 'freebsd': 'FreeBSD',
14
+ 'openbsd': 'OpenBSD',
15
+ 'sunos': 'Solaris',
16
+ 'linux': undefined, // Default ke Ubuntu untuk Linux
17
+ 'haiku': undefined,
18
+ 'cygwin': undefined,
19
+ 'netbsd': undefined
20
+ };
21
+
22
+ // Fixed: Browsers sekarang fungsi yang return array [platform, browser, version]
23
+ // Ini kompatibel dengan pemanggilan Browsers('Chrome') di Defaults/index.js
24
+ exports.Browsers = (browser) => {
25
+ const osName = PLATFORM_MAP[os.platform()] || 'Ubuntu'; // Default Ubuntu kalau undefined
26
+ const osRelease = os.release(); // Ambil versi OS real-time
27
+ return [osName, browser, osRelease];
28
+ };
29
+
30
+ const getPlatformId = (browser) => {
31
+ const platformType = proto.DeviceProps.PlatformType[browser.toUpperCase()];
32
+ return platformType ? platformType.toString() : '1'; // Default Chrome
33
+ };
34
+
35
+ exports.getPlatformId = getPlatformId;
@@ -1,6 +1,6 @@
1
1
  import { AxiosRequestConfig } from 'axios';
2
2
  import { proto } from '../../WAProto';
3
- import { BaileysEventEmitter, ChatModification, ChatMutation, Contact, InitialAppStateSyncOptions, LTHashState, WAPatchCreate, WAPatchName } from '../Types';
3
+ import { WileysEventEmitter, ChatModification, ChatMutation, Contact, InitialAppStateSyncOptions, LTHashState, WAPatchCreate, WAPatchName } from '../Types';
4
4
  import { BinaryNode } from '../WABinary';
5
5
  import { ILogger } from './logger';
6
6
  type FetchAppStateSyncKey = (keyId: string) => Promise<proto.Message.IAppStateSyncKeyData | null | undefined>;
@@ -66,5 +66,5 @@ export declare const decodePatches: (name: WAPatchName, syncds: proto.ISyncdPatc
66
66
  mutationMap: ChatMutationMap;
67
67
  }>;
68
68
  export declare const chatModificationToAppPatch: (mod: ChatModification, jid: string) => WAPatchCreate;
69
- export declare const processSyncAction: (syncAction: ChatMutation, ev: BaileysEventEmitter, me: Contact, initialSyncOpts?: InitialAppStateSyncOptions, logger?: ILogger) => void;
69
+ export declare const processSyncAction: (syncAction: ChatMutation, ev: WileysEventEmitter, me: Contact, initialSyncOpts?: InitialAppStateSyncOptions, logger?: ILogger) => void;
70
70
  export {};
@@ -1,4 +1,4 @@
1
- import { BaileysEventEmitter, BaileysEventMap } from '../Types';
1
+ import { WileysEventEmitter, WileysEventMap } from '../Types';
2
2
  import { ILogger } from './logger';
3
3
  /**
4
4
  * A map that contains a list of all events that have been triggered
@@ -7,10 +7,10 @@ import { ILogger } from './logger';
7
7
  * this can make processing events extremely efficient -- since everything
8
8
  * can be done in a single transaction
9
9
  */
10
- type BaileysEventData = Partial<BaileysEventMap>;
11
- type BaileysBufferableEventEmitter = BaileysEventEmitter & {
10
+ type WileysEventData = Partial<WileysEventMap>;
11
+ type WileysBufferableEventEmitter = WileysEventEmitter & {
12
12
  /** Use to process events in a batch */
13
- process(handler: (events: BaileysEventData) => void | Promise<void>): (() => void);
13
+ process(handler: (events: WileysEventData) => void | Promise<void>): (() => void);
14
14
  /**
15
15
  * starts buffering events, call flush() to release them
16
16
  * */
@@ -29,7 +29,7 @@ type BaileysBufferableEventEmitter = BaileysEventEmitter & {
29
29
  /**
30
30
  * The event buffer logically consolidates different events into a single event
31
31
  * making the data processing more efficient.
32
- * @param ev the baileys event emitter
32
+ * @param ev the wileys event emitter
33
33
  */
34
- export declare const makeEventBuffer: (logger: ILogger) => BaileysBufferableEventEmitter;
34
+ export declare const makeEventBuffer: (logger: ILogger) => WileysBufferableEventEmitter;
35
35
  export {};
@@ -27,14 +27,14 @@ const BUFFERABLE_EVENT_SET = new Set(BUFFERABLE_EVENT);
27
27
  /**
28
28
  * The event buffer logically consolidates different events into a single event
29
29
  * making the data processing more efficient.
30
- * @param ev the baileys event emitter
30
+ * @param ev the wileys event emitter
31
31
  */
32
32
  const makeEventBuffer = (logger) => {
33
33
  const ev = new events_1.default();
34
34
  const historyCache = new Set();
35
35
  let data = makeBufferData();
36
36
  let buffersInProgress = 0;
37
- // take the generic event and fire it as a baileys event
37
+ // take the generic event and fire it as a wileys event
38
38
  ev.on('event', (map) => {
39
39
  for (const event in map) {
40
40
  ev.emit(event, map[event]);
@@ -1,7 +1,7 @@
1
1
  import { AxiosRequestConfig } from 'axios';
2
2
  import { ILogger } from './logger';
3
3
  import { proto } from '../../WAProto';
4
- import { BaileysEventEmitter, BaileysEventMap, BrowsersMap, WACallUpdateType, WAVersion } from '../Types';
4
+ import { WileysEventEmitter, WileysEventMap, BrowsersMap, WACallUpdateType, WAVersion } from '../Types';
5
5
  import { BinaryNode } from '../WABinary';
6
6
  export declare const Browsers: BrowsersMap;
7
7
  export declare const getPlatformId: (browser: string) => any;
@@ -34,14 +34,14 @@ export declare const delayCancellable: (ms: number) => {
34
34
  export declare function promiseTimeout<T>(ms: number | undefined, promise: (resolve: (v: T) => void, reject: (error: any) => void) => void): Promise<T>;
35
35
  export declare const generateMessageIDV2: (userId?: string) => string;
36
36
  export declare const generateMessageID: () => string;
37
- export declare function bindWaitForEvent<T extends keyof BaileysEventMap>(ev: BaileysEventEmitter, event: T): (check: (u: BaileysEventMap[T]) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
38
- export declare const bindWaitForConnectionUpdate: (ev: BaileysEventEmitter) => (check: (u: Partial<import("../Types").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
39
- export declare const printQRIfNecessaryListener: (ev: BaileysEventEmitter, logger: ILogger) => void;
37
+ export declare function bindWaitForEvent<T extends keyof WileysEventMap>(ev: WileysEventEmitter, event: T): (check: (u: WileysEventMap[T]) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
38
+ export declare const bindWaitForConnectionUpdate: (ev: WileysEventEmitter) => (check: (u: Partial<import("../Types").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
39
+ export declare const printQRIfNecessaryListener: (ev: WileysEventEmitter, logger: ILogger) => void;
40
40
  /**
41
- * utility that fetches latest baileys version from the master branch.
41
+ * utility that fetches latest wileys version from the master branch.
42
42
  * Use to ensure your WA connection is always on the latest version
43
43
  */
44
- export declare const fetchLatestBaileysVersion: (options?: AxiosRequestConfig<any>) => Promise<{
44
+ export declare const fetchLatestWileysVersion: (options?: AxiosRequestConfig<any>) => Promise<{
45
45
  version: WAVersion;
46
46
  isLatest: boolean;
47
47
  error?: undefined;
@@ -71,7 +71,7 @@ export declare const generateMdTagPrefix: () => string;
71
71
  */
72
72
  export declare const getStatusFromReceiptType: (type: string | undefined) => proto.WebMessageInfo.Status;
73
73
  /**
74
- * Stream errors generally provide a reason, map that to a baileys DisconnectReason
74
+ * Stream errors generally provide a reason, map that to a wileys DisconnectReason
75
75
  * @param reason the string reason given, eg. "conflict"
76
76
  */
77
77
  export declare const getErrorCodeFromStreamError: (node: BinaryNode) => {