wa-multi-mongodb 3.10.2 → 3.10.3

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 (82) hide show
  1. package/dist/Defaults/index.js +4 -9
  2. package/dist/Error/index.js +1 -5
  3. package/dist/Messaging/index.d.ts +1 -1
  4. package/dist/Messaging/index.js +123 -137
  5. package/dist/Profile/index.d.ts +1 -1
  6. package/dist/Profile/index.js +6 -10
  7. package/dist/Socket/index.d.ts +1 -1
  8. package/dist/Socket/index.d.ts.map +1 -1
  9. package/dist/Socket/index.js +134 -200
  10. package/dist/Types/index.js +1 -2
  11. package/dist/Types/profile.js +1 -2
  12. package/dist/Utils/create-delay.js +2 -7
  13. package/dist/Utils/error.js +1 -4
  14. package/dist/Utils/group-cache.js +8 -15
  15. package/dist/Utils/index.d.ts +5 -5
  16. package/dist/Utils/index.js +5 -21
  17. package/dist/Utils/is-exist.d.ts +1 -1
  18. package/dist/Utils/is-exist.js +7 -10
  19. package/dist/Utils/lid-utils.js +13 -20
  20. package/dist/Utils/message-status.d.ts +1 -1
  21. package/dist/Utils/message-status.js +7 -11
  22. package/dist/Utils/mongo-auth-state.js +10 -13
  23. package/dist/Utils/phone-to-jid.js +6 -14
  24. package/dist/Utils/save-media.d.ts +1 -1
  25. package/dist/Utils/save-media.js +16 -26
  26. package/dist/cjs/Defaults/index.d.ts +21 -0
  27. package/dist/cjs/Defaults/index.d.ts.map +1 -0
  28. package/dist/cjs/Defaults/index.js +31 -0
  29. package/dist/cjs/Error/index.d.ts +5 -0
  30. package/dist/cjs/Error/index.d.ts.map +1 -0
  31. package/dist/cjs/Error/index.js +14 -0
  32. package/dist/cjs/Messaging/index.d.ts +45 -0
  33. package/dist/cjs/Messaging/index.d.ts.map +1 -0
  34. package/dist/cjs/Messaging/index.js +784 -0
  35. package/dist/cjs/Profile/index.d.ts +9 -0
  36. package/dist/cjs/Profile/index.d.ts.map +1 -0
  37. package/dist/cjs/Profile/index.js +34 -0
  38. package/dist/cjs/Socket/index.d.ts +105 -0
  39. package/dist/cjs/Socket/index.d.ts.map +1 -0
  40. package/dist/cjs/Socket/index.js +875 -0
  41. package/dist/cjs/Types/index.d.ts +74 -0
  42. package/dist/cjs/Types/index.d.ts.map +1 -0
  43. package/dist/cjs/Types/index.js +2 -0
  44. package/dist/cjs/Types/profile.d.ts +5 -0
  45. package/dist/cjs/Types/profile.d.ts.map +1 -0
  46. package/dist/cjs/Types/profile.js +2 -0
  47. package/dist/cjs/Utils/create-delay.d.ts +17 -0
  48. package/dist/cjs/Utils/create-delay.d.ts.map +1 -0
  49. package/dist/cjs/Utils/create-delay.js +38 -0
  50. package/dist/cjs/Utils/error.d.ts +4 -0
  51. package/dist/cjs/Utils/error.d.ts.map +1 -0
  52. package/dist/cjs/Utils/error.js +8 -0
  53. package/dist/cjs/Utils/group-cache.d.ts +23 -0
  54. package/dist/cjs/Utils/group-cache.d.ts.map +1 -0
  55. package/dist/cjs/Utils/group-cache.js +176 -0
  56. package/dist/cjs/Utils/index.d.ts +6 -0
  57. package/dist/cjs/Utils/index.d.ts.map +1 -0
  58. package/dist/cjs/Utils/index.js +23 -0
  59. package/dist/cjs/Utils/is-exist.d.ts +6 -0
  60. package/dist/cjs/Utils/is-exist.d.ts.map +1 -0
  61. package/dist/cjs/Utils/is-exist.js +53 -0
  62. package/dist/cjs/Utils/lid-utils.d.ts +26 -0
  63. package/dist/cjs/Utils/lid-utils.d.ts.map +1 -0
  64. package/dist/cjs/Utils/lid-utils.js +81 -0
  65. package/dist/cjs/Utils/message-status.d.ts +4 -0
  66. package/dist/cjs/Utils/message-status.d.ts.map +1 -0
  67. package/dist/cjs/Utils/message-status.js +18 -0
  68. package/dist/cjs/Utils/mongo-auth-state.d.ts +15 -0
  69. package/dist/cjs/Utils/mongo-auth-state.d.ts.map +1 -0
  70. package/dist/cjs/Utils/mongo-auth-state.js +109 -0
  71. package/dist/cjs/Utils/phone-to-jid.d.ts +17 -0
  72. package/dist/cjs/Utils/phone-to-jid.d.ts.map +1 -0
  73. package/dist/cjs/Utils/phone-to-jid.js +51 -0
  74. package/dist/cjs/Utils/save-media.d.ts +6 -0
  75. package/dist/cjs/Utils/save-media.d.ts.map +1 -0
  76. package/dist/cjs/Utils/save-media.js +55 -0
  77. package/dist/cjs/index.d.ts +8 -0
  78. package/dist/cjs/index.d.ts.map +1 -0
  79. package/dist/cjs/index.js +46 -0
  80. package/dist/index.d.ts +6 -6
  81. package/dist/index.js +7 -46
  82. package/package.json +57 -42
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.useMongoAuthState = useMongoAuthState;
13
+ const WAProto_1 = require("baileys/WAProto");
14
+ const crypto_1 = require("baileys/lib/Utils/crypto");
15
+ const generics_1 = require("baileys/lib/Utils/generics");
16
+ const BufferJSON = {
17
+ replacer: (_, value) => {
18
+ if (Buffer.isBuffer(value) || value instanceof Uint8Array || (value === null || value === void 0 ? void 0 : value.type) === "Buffer") {
19
+ return { type: "Buffer", data: Buffer.from((value === null || value === void 0 ? void 0 : value.data) || value).toString("base64") };
20
+ }
21
+ return value;
22
+ },
23
+ reviver: (_, value) => {
24
+ if (typeof value === "object" && value !== null && (value.buffer === true || value.type === "Buffer")) {
25
+ const val = value.data || value.value;
26
+ return typeof val === "string" ? Buffer.from(val, "base64") : Buffer.from(val || []);
27
+ }
28
+ return value;
29
+ },
30
+ };
31
+ const initAuthCreds = () => {
32
+ const identityKey = crypto_1.Curve.generateKeyPair();
33
+ return {
34
+ noiseKey: crypto_1.Curve.generateKeyPair(),
35
+ pairingEphemeralKeyPair: crypto_1.Curve.generateKeyPair(),
36
+ signedIdentityKey: identityKey,
37
+ signedPreKey: (0, crypto_1.signedKeyPair)(identityKey, 1),
38
+ registrationId: (0, generics_1.generateRegistrationId)(),
39
+ advSecretKey: Buffer.from(Array(32)).toString("base64"),
40
+ processedHistoryMessages: [],
41
+ nextPreKeyId: 1,
42
+ firstUnuploadedPreKeyId: 1,
43
+ accountSettings: { unarchiveChats: false },
44
+ accountSyncCounter: 0,
45
+ registered: false,
46
+ pairingCode: undefined,
47
+ lastPropHash: undefined,
48
+ routingInfo: undefined,
49
+ };
50
+ };
51
+ function useMongoAuthState(sessionId, collection) {
52
+ return __awaiter(this, void 0, void 0, function* () {
53
+ const readState = () => __awaiter(this, void 0, void 0, function* () {
54
+ const doc = yield collection.findOne({ sessionId });
55
+ return (doc === null || doc === void 0 ? void 0 : doc.state)
56
+ ? JSON.parse(JSON.stringify(doc.state), BufferJSON.reviver)
57
+ : null;
58
+ });
59
+ const writeState = (state) => __awaiter(this, void 0, void 0, function* () {
60
+ yield collection.updateOne({ sessionId }, { $set: { state: JSON.parse(JSON.stringify(state, BufferJSON.replacer)) } }, { upsert: true });
61
+ });
62
+ const removeKey = (key) => __awaiter(this, void 0, void 0, function* () {
63
+ yield collection.updateOne({ sessionId }, { $unset: { [`state.keys.${key}`]: "" } });
64
+ });
65
+ const savedState = (yield readState()) || {};
66
+ const creds = savedState.creds || initAuthCreds();
67
+ const keys = savedState.keys || {};
68
+ const saveFullState = () => __awaiter(this, void 0, void 0, function* () {
69
+ yield writeState({ creds, keys });
70
+ });
71
+ return {
72
+ state: {
73
+ creds,
74
+ keys: {
75
+ get: (type, ids) => __awaiter(this, void 0, void 0, function* () {
76
+ const result = {};
77
+ for (const id of ids) {
78
+ let data = keys === null || keys === void 0 ? void 0 : keys[`${type}-${id}`];
79
+ if (type === "app-state-sync-key" && data) {
80
+ data = WAProto_1.proto.Message.AppStateSyncKeyData.fromObject(data);
81
+ }
82
+ result[id] = data;
83
+ }
84
+ return result;
85
+ }),
86
+ set: (newData) => __awaiter(this, void 0, void 0, function* () {
87
+ for (const category of Object.keys(newData)) {
88
+ for (const id of Object.keys(newData[category])) {
89
+ const value = newData[category][id];
90
+ const key = `${category}-${id}`;
91
+ if (value) {
92
+ keys[key] = value;
93
+ }
94
+ else {
95
+ delete keys[key];
96
+ yield removeKey(key);
97
+ }
98
+ }
99
+ }
100
+ yield saveFullState();
101
+ }),
102
+ },
103
+ },
104
+ saveCreds: () => __awaiter(this, void 0, void 0, function* () {
105
+ yield saveFullState();
106
+ }),
107
+ };
108
+ });
109
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Fungsi untuk mendeteksi apakah sebuah JID menggunakan format LID (@lid)
3
+ * @param jid JID yang akan dicek
4
+ * @returns true jika JID menggunakan format LID
5
+ */
6
+ export declare const isLidJid: (jid: string) => boolean;
7
+ /**
8
+ * Fungsi untuk normalisasi JID, mendukung format @s.whatsapp.net dan @lid
9
+ * @param to Nomor telepon atau JID tujuan
10
+ * @param isGroup Apakah ini adalah grup
11
+ * @returns JID yang sudah dinormalisasi
12
+ */
13
+ export declare const phoneToJid: ({ to, isGroup, }: {
14
+ to: string | number;
15
+ isGroup?: boolean;
16
+ }) => string;
17
+ //# sourceMappingURL=phone-to-jid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phone-to-jid.d.ts","sourceRoot":"","sources":["../../../src/Utils/phone-to-jid.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,eAAO,MAAM,QAAQ,GAAI,KAAK,MAAM,KAAG,OAEtC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,kBAGxB;IACD,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,KAAG,MAoBH,CAAC"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.phoneToJid = exports.isLidJid = void 0;
7
+ const Error_1 = require("../Error");
8
+ const baileys_1 = __importDefault(require("baileys"));
9
+ const isPhoneNumberValidCountry = (phone) => {
10
+ return Object.keys(baileys_1.default).some((key) => {
11
+ return phone.startsWith(key);
12
+ });
13
+ };
14
+ /**
15
+ * Fungsi untuk mendeteksi apakah sebuah JID menggunakan format LID (@lid)
16
+ * @param jid JID yang akan dicek
17
+ * @returns true jika JID menggunakan format LID
18
+ */
19
+ const isLidJid = (jid) => {
20
+ return jid.includes("@lid");
21
+ };
22
+ exports.isLidJid = isLidJid;
23
+ /**
24
+ * Fungsi untuk normalisasi JID, mendukung format @s.whatsapp.net dan @lid
25
+ * @param to Nomor telepon atau JID tujuan
26
+ * @param isGroup Apakah ini adalah grup
27
+ * @returns JID yang sudah dinormalisasi
28
+ */
29
+ const phoneToJid = ({ to, isGroup = false, }) => {
30
+ if (!to)
31
+ throw new Error_1.WhatsappError('parameter "to" is required');
32
+ let number = to.toString();
33
+ if (isGroup) {
34
+ number = number.replace(/\s|[+]|[-]/gim, "");
35
+ if (!number.includes("@g.us"))
36
+ number = number + "@g.us";
37
+ }
38
+ else {
39
+ number = number.replace(/\s|[+]|[-]/gim, "");
40
+ // Jika sudah dalam format @lid atau @s.whatsapp.net, gunakan apa adanya
41
+ if (number.includes("@lid") || number.includes("@s.whatsapp.net")) {
42
+ // Jangan tambahkan suffix lagi
43
+ }
44
+ else {
45
+ // Default ke format @s.whatsapp.net untuk kompatibilitas
46
+ number = number + "@s.whatsapp.net";
47
+ }
48
+ }
49
+ return number;
50
+ };
51
+ exports.phoneToJid = phoneToJid;
@@ -0,0 +1,6 @@
1
+ import { MessageReceived } from "../Types";
2
+ export declare const saveImageHandler: (msg: MessageReceived, path: string) => Promise<void>;
3
+ export declare const saveVideoHandler: (msg: MessageReceived, path: string) => Promise<void>;
4
+ export declare const saveDocumentHandler: (msg: MessageReceived, path: string) => Promise<void>;
5
+ export declare const saveAudioHandler: (msg: MessageReceived, path: string) => Promise<void>;
6
+ //# sourceMappingURL=save-media.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"save-media.d.ts","sourceRoot":"","sources":["../../../src/Utils/save-media.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAQ3C,eAAO,MAAM,gBAAgB,GAAU,KAAK,eAAe,EAAE,MAAM,MAAM,kBAOxE,CAAC;AACF,eAAO,MAAM,gBAAgB,GAAU,KAAK,eAAe,EAAE,MAAM,MAAM,kBAOxE,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,KAAK,eAAe,EACpB,MAAM,MAAM,kBAUb,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAU,KAAK,eAAe,EAAE,MAAM,MAAM,kBAOxE,CAAC"}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.saveAudioHandler = exports.saveDocumentHandler = exports.saveVideoHandler = exports.saveImageHandler = void 0;
16
+ const baileys_1 = require("baileys");
17
+ const error_1 = __importDefault(require("./error"));
18
+ const promises_1 = __importDefault(require("fs/promises"));
19
+ const saveMedia = (path, data) => __awaiter(void 0, void 0, void 0, function* () {
20
+ yield promises_1.default.writeFile(path, data.toString("base64"), "base64");
21
+ });
22
+ const saveImageHandler = (msg, path) => __awaiter(void 0, void 0, void 0, function* () {
23
+ var _a;
24
+ if (!((_a = msg.message) === null || _a === void 0 ? void 0 : _a.imageMessage))
25
+ throw new error_1.default("Message is not contain Image");
26
+ const buf = yield (0, baileys_1.downloadMediaMessage)(msg, "buffer", {});
27
+ return saveMedia(path, buf);
28
+ });
29
+ exports.saveImageHandler = saveImageHandler;
30
+ const saveVideoHandler = (msg, path) => __awaiter(void 0, void 0, void 0, function* () {
31
+ var _a;
32
+ if (!((_a = msg.message) === null || _a === void 0 ? void 0 : _a.videoMessage))
33
+ throw new error_1.default("Message is not contain Video");
34
+ const buf = yield (0, baileys_1.downloadMediaMessage)(msg, "buffer", {});
35
+ return saveMedia(path, buf);
36
+ });
37
+ exports.saveVideoHandler = saveVideoHandler;
38
+ const saveDocumentHandler = (msg, path) => __awaiter(void 0, void 0, void 0, function* () {
39
+ var _a, _b;
40
+ if (!((_a = msg.message) === null || _a === void 0 ? void 0 : _a.documentMessage))
41
+ throw new error_1.default("Message is not contain Document");
42
+ const buf = yield (0, baileys_1.downloadMediaMessage)(msg, "buffer", {});
43
+ const ext = (_b = msg.message.documentMessage.fileName) === null || _b === void 0 ? void 0 : _b.split(".").pop();
44
+ path += "." + ext;
45
+ return saveMedia(path, buf);
46
+ });
47
+ exports.saveDocumentHandler = saveDocumentHandler;
48
+ const saveAudioHandler = (msg, path) => __awaiter(void 0, void 0, void 0, function* () {
49
+ var _a;
50
+ if (!((_a = msg.message) === null || _a === void 0 ? void 0 : _a.audioMessage))
51
+ throw new error_1.default("Message is not contain Audio");
52
+ const buf = yield (0, baileys_1.downloadMediaMessage)(msg, "buffer", {});
53
+ return saveMedia(path, buf);
54
+ });
55
+ exports.saveAudioHandler = saveAudioHandler;
@@ -0,0 +1,8 @@
1
+ export * from "./Socket";
2
+ export * from "./Messaging";
3
+ export * from "./Utils";
4
+ export * from "./Types";
5
+ export * from "./Profile";
6
+ export * from "./Error";
7
+ export * as baileys from "baileys";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AAExB,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC"}
@@ -0,0 +1,46 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
+ };
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.baileys = void 0;
40
+ __exportStar(require("./Socket"), exports);
41
+ __exportStar(require("./Messaging"), exports);
42
+ __exportStar(require("./Utils"), exports);
43
+ __exportStar(require("./Types"), exports);
44
+ __exportStar(require("./Profile"), exports);
45
+ __exportStar(require("./Error"), exports);
46
+ exports.baileys = __importStar(require("baileys"));
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- export * from "./Socket";
2
- export * from "./Messaging";
3
- export * from "./Utils";
4
- export * from "./Types";
5
- export * from "./Profile";
6
- export * from "./Error";
1
+ export * from "./Socket/index.js";
2
+ export * from "./Messaging/index.js";
3
+ export * from "./Utils/index.js";
4
+ export * from "./Types/index.js";
5
+ export * from "./Profile/index.js";
6
+ export * from "./Error/index.js";
7
7
  export * as baileys from "baileys";
8
8
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,46 +1,7 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
- };
21
- var __importStar = (this && this.__importStar) || (function () {
22
- var ownKeys = function(o) {
23
- ownKeys = Object.getOwnPropertyNames || function (o) {
24
- var ar = [];
25
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
- return ar;
27
- };
28
- return ownKeys(o);
29
- };
30
- return function (mod) {
31
- if (mod && mod.__esModule) return mod;
32
- var result = {};
33
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
- __setModuleDefault(result, mod);
35
- return result;
36
- };
37
- })();
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.baileys = void 0;
40
- __exportStar(require("./Socket"), exports);
41
- __exportStar(require("./Messaging"), exports);
42
- __exportStar(require("./Utils"), exports);
43
- __exportStar(require("./Types"), exports);
44
- __exportStar(require("./Profile"), exports);
45
- __exportStar(require("./Error"), exports);
46
- exports.baileys = __importStar(require("baileys"));
1
+ export * from "./Socket/index.js";
2
+ export * from "./Messaging/index.js";
3
+ export * from "./Utils/index.js";
4
+ export * from "./Types/index.js";
5
+ export * from "./Profile/index.js";
6
+ export * from "./Error/index.js";
7
+ export * as baileys from "baileys";
package/package.json CHANGED
@@ -1,42 +1,57 @@
1
- {
2
- "name": "wa-multi-mongodb",
3
- "version": "3.10.2",
4
- "description": "Multi Session Whatsapp Library with MongoDB Integration",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "files": [
8
- "dist/**/*"
9
- ],
10
- "scripts": {
11
- "build": "tsc",
12
- "start": "tsc && node ./dist/index.js",
13
- "test": "echo \"Error: no test specified\" && exit 1"
14
- },
15
- "author": "wahdalo",
16
- "license": "ISC",
17
- "dependencies": {
18
- "@adiwajshing/keyed-db": "^0.2.4",
19
- "@hapi/boom": "^10.0.1",
20
- "@types/node-cache": "^4.1.3",
21
- "@types/qrcode": "^1.5.5",
22
- "aws4": "^1.13.2",
23
- "baileys": "^7.0.0-rc.6",
24
- "dotenv": "^16.5.0",
25
- "link-preview-js": "^3.0.14",
26
- "mime": "^3.0.0",
27
- "mongodb": "^5.7.0",
28
- "node-cache": "^5.1.2",
29
- "pino": "^9.5.0",
30
- "qrcode": "^1.5.4",
31
- "qrcode-terminal": "^0.12.0"
32
- },
33
- "repository": {
34
- "type": "git",
35
- "url": "git+https://github.com/wahdalo/wa-multi-mongodb.git"
36
- },
37
- "devDependencies": {
38
- "@types/mime": "^3.0.1",
39
- "@types/mongodb": "^4.0.6",
40
- "typescript": "^5.7.2"
41
- }
42
- }
1
+ {
2
+ "name": "wa-multi-mongodb",
3
+ "version": "3.10.3",
4
+ "description": "Multi Session Whatsapp Library with MongoDB Integration",
5
+ "main": "dist/cjs/index.js",
6
+ "module": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "require": "./dist/cjs/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist/**/*"
17
+ ],
18
+ "scripts": {
19
+ "prebuild": "rimraf dist",
20
+ "build": "npm run build:esm && npm run build:cjs",
21
+ "build:esm": "tsc && tsc-esm-fix --source=dist --target=dist",
22
+ "build:cjs": "tsc -p tsconfig.cjs.json",
23
+ "start": "npm run build && node ./dist/index.js",
24
+ "test": "echo \"Error: no test specified\" && exit 1"
25
+ },
26
+ "author": "wahdalo",
27
+ "license": "ISC",
28
+ "dependencies": {
29
+ "@adiwajshing/keyed-db": "^0.2.4",
30
+ "@hapi/boom": "^10.0.1",
31
+ "@types/node-cache": "^4.1.3",
32
+ "@types/qrcode": "^1.5.5",
33
+ "aws4": "^1.13.2",
34
+ "baileys": "^7.0.0-rc.6",
35
+ "dotenv": "^16.5.0",
36
+ "link-preview-js": "^3.0.14",
37
+ "mime": "^3.0.0",
38
+ "mongodb": "^5.7.0",
39
+ "node-cache": "^5.1.2",
40
+ "pino": "^9.5.0",
41
+ "qrcode": "^1.5.4",
42
+ "qrcode-terminal": "^0.12.0"
43
+ },
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "git+https://github.com/wahdalo/wa-multi-mongodb.git"
47
+ },
48
+ "devDependencies": {
49
+ "@types/mime": "^3.0.1",
50
+ "@types/mongodb": "^4.0.6",
51
+ "@types/node": "^24.10.1",
52
+ "rimraf": "^6.1.0",
53
+ "tsc-esm-fix": "^3.1.2",
54
+ "tslib": "^2.8.1",
55
+ "typescript": "^5.7.2"
56
+ }
57
+ }