@pontalabs/baileys 1.0.11 → 1.1.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.
Files changed (119) hide show
  1. package/README.md +96 -85
  2. package/lib/Defaults/connection.js +39 -0
  3. package/lib/Defaults/constants.js +50 -0
  4. package/lib/Defaults/history.js +13 -0
  5. package/lib/Defaults/index.js +36 -151
  6. package/lib/Defaults/media.js +43 -0
  7. package/lib/Defaults/phonenumber-mcc.json +221 -221
  8. package/lib/Defaults/prefix.js +12 -0
  9. package/lib/Defaults/vialeys-version.json +7 -0
  10. package/lib/Signal/Group/ciphertext-message.js +10 -15
  11. package/lib/Signal/Group/group-session-builder.js +34 -60
  12. package/lib/Signal/Group/group_cipher.js +69 -76
  13. package/lib/Signal/Group/index.js +41 -60
  14. package/lib/Signal/Group/keyhelper.js +12 -57
  15. package/lib/Signal/Group/sender-chain-key.js +20 -33
  16. package/lib/Signal/Group/sender-key-distribution-message.js +43 -48
  17. package/lib/Signal/Group/sender-key-message.js +58 -53
  18. package/lib/Signal/Group/sender-key-name.js +21 -31
  19. package/lib/Signal/Group/sender-key-record.js +21 -34
  20. package/lib/Signal/Group/sender-key-state.js +59 -106
  21. package/lib/Signal/Group/sender-message-key.js +16 -21
  22. package/lib/Signal/libsignal.js +282 -203
  23. package/lib/Signal/lid-mapping.js +164 -184
  24. package/lib/Socket/Client/index.js +31 -22
  25. package/lib/Socket/Client/types.js +9 -15
  26. package/lib/Socket/Client/websocket.js +42 -37
  27. package/lib/Socket/business.js +212 -336
  28. package/lib/Socket/chats.js +696 -940
  29. package/lib/Socket/community.js +454 -369
  30. package/lib/Socket/groups.js +278 -280
  31. package/lib/Socket/index.js +9 -21
  32. package/lib/Socket/messages-recv.js +1027 -1570
  33. package/lib/Socket/messages-send.js +1180 -1136
  34. package/lib/Socket/mex.js +59 -0
  35. package/lib/Socket/newsletter.js +193 -251
  36. package/lib/Socket/socket.js +758 -898
  37. package/lib/Store/index.js +35 -24
  38. package/lib/Store/make-cache-manager-store.js +53 -66
  39. package/lib/Store/make-in-memory-store.js +319 -325
  40. package/lib/Store/make-ordered-dictionary.js +49 -57
  41. package/lib/Store/object-repository.js +10 -15
  42. package/lib/Types/Auth.js +2 -3
  43. package/lib/Types/Bussines.js +2 -3
  44. package/lib/Types/Call.js +2 -3
  45. package/lib/Types/Chat.js +10 -9
  46. package/lib/Types/Contact.js +2 -3
  47. package/lib/Types/Events.js +2 -3
  48. package/lib/Types/GroupMetadata.js +2 -3
  49. package/lib/Types/Label.js +6 -12
  50. package/lib/Types/LabelAssociation.js +4 -13
  51. package/lib/Types/Message.js +10 -18
  52. package/lib/Types/MexUpdates.js +15 -18
  53. package/lib/Types/Newsletter.js +26 -34
  54. package/lib/Types/Product.js +2 -3
  55. package/lib/Types/Signal.js +2 -3
  56. package/lib/Types/Socket.js +2 -3
  57. package/lib/Types/State.js +8 -13
  58. package/lib/Types/USync.js +2 -3
  59. package/lib/Types/index.js +49 -40
  60. package/lib/Utils/auth-utils.js +190 -495
  61. package/lib/Utils/browser-utils.js +29 -0
  62. package/lib/Utils/business.js +177 -199
  63. package/lib/Utils/chat-utils.js +711 -624
  64. package/lib/Utils/crypto.js +116 -161
  65. package/lib/Utils/decode-wa-message.js +225 -321
  66. package/lib/Utils/event-buffer.js +363 -405
  67. package/lib/Utils/generics.js +318 -472
  68. package/lib/Utils/history.js +72 -76
  69. package/lib/Utils/index.js +49 -41
  70. package/lib/Utils/link-preview.js +59 -103
  71. package/lib/Utils/logger.js +4 -7
  72. package/lib/Utils/lt-hash.js +29 -42
  73. package/lib/Utils/make-mutex.js +26 -42
  74. package/lib/Utils/message-retry-manager.js +134 -160
  75. package/lib/Utils/messages-media.js +665 -731
  76. package/lib/Utils/messages.js +518 -1
  77. package/lib/Utils/noise-handler.js +127 -125
  78. package/lib/Utils/pre-key-manager.js +86 -0
  79. package/lib/Utils/process-message.js +739 -351
  80. package/lib/Utils/signal.js +146 -129
  81. package/lib/Utils/use-multi-file-auth-state.js +68 -135
  82. package/lib/Utils/validate-connection.js +183 -142
  83. package/lib/Utils/vialeys-event-stream.js +41 -0
  84. package/lib/WABinary/constants.js +1281 -1289
  85. package/lib/WABinary/decode.js +145 -200
  86. package/lib/WABinary/encode.js +149 -202
  87. package/lib/WABinary/generic-utils.js +79 -97
  88. package/lib/WABinary/index.js +36 -25
  89. package/lib/WABinary/jid-utils.js +91 -123
  90. package/lib/WABinary/types.js +2 -3
  91. package/lib/WAM/BinaryInfo.js +8 -13
  92. package/lib/WAM/constants.js +16584 -11464
  93. package/lib/WAM/encode.js +117 -133
  94. package/lib/WAM/index.js +34 -23
  95. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +62 -69
  96. package/lib/WAUSync/Protocols/USyncContactProtocol.js +11 -25
  97. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +32 -44
  98. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +13 -23
  99. package/lib/WAUSync/Protocols/USyncLIDProtocol.js +24 -38
  100. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +17 -31
  101. package/lib/WAUSync/Protocols/index.js +37 -26
  102. package/lib/WAUSync/USyncQuery.js +66 -66
  103. package/lib/WAUSync/USyncUser.js +13 -18
  104. package/lib/WAUSync/index.js +34 -23
  105. package/lib/index.js +95 -28
  106. package/package.json +2 -1
  107. package/lib/Defaults/baileys-version.json +0 -3
  108. package/lib/Signal/Group/queue-job.d.ts +0 -1
  109. package/lib/Signal/Group/queue-job.js +0 -57
  110. package/lib/Socket/usync.d.ts +0 -37
  111. package/lib/Socket/usync.js +0 -83
  112. package/lib/Utils/baileys-event-stream.d.ts +0 -18
  113. package/lib/Utils/baileys-event-stream.js +0 -70
  114. package/lib/Utils/signal-housekeeping.d.ts +0 -19
  115. package/lib/Utils/signal-housekeeping.js +0 -73
  116. package/lib/Utils/use-mongo-file-auth-state.d.ts +0 -6
  117. package/lib/Utils/use-mongo-file-auth-state.js +0 -84
  118. package/lib/Utils/use-single-file-auth-state.d.ts +0 -13
  119. package/lib/Utils/use-single-file-auth-state.js +0 -80
@@ -1,35 +1,25 @@
1
- "use strict"
2
-
3
- Object.defineProperty(exports, "__esModule", { value: true })
4
-
5
- const WABinary_1 = require("../../WABinary")
6
-
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const { assertNodeErrorFree: assertNodeErrorFree } = require("../../WABinary");
7
4
  class USyncDisappearingModeProtocol {
8
5
  constructor() {
9
- this.name = 'disappearing_mode'
6
+ this.name = "disappearing_mode";
10
7
  }
11
8
  getQueryElement() {
12
- return {
13
- tag: 'disappearing_mode',
14
- attrs: {},
15
- }
9
+ return { tag: "disappearing_mode", attrs: {} };
16
10
  }
17
11
  getUserElement() {
18
- return null
12
+ return null;
19
13
  }
20
14
  parser(node) {
21
- if (node.tag === 'disappearing_mode') {
22
- WABinary_1.assertNodeErrorFree(node)
23
- const duration = +node?.attrs?.duration
24
- const setAt = new Date(+(node?.attrs?.t || 0) * 1000)
25
- return {
26
- duration,
27
- setAt,
28
- }
15
+ if (node.tag === "disappearing_mode") {
16
+ assertNodeErrorFree(node);
17
+ const duration = +node?.attrs?.duration;
18
+ const setAt = new Date(+(node?.attrs?.t || 0) * 1e3);
19
+ return { duration: duration, setAt: setAt };
29
20
  }
30
21
  }
31
22
  }
32
-
33
23
  module.exports = {
34
- USyncDisappearingModeProtocol
35
- }
24
+ USyncDisappearingModeProtocol: USyncDisappearingModeProtocol,
25
+ };
@@ -1,38 +1,24 @@
1
- "use strict"
2
-
3
- Object.defineProperty(exports, "__esModule", { value: true })
4
-
5
- const WABinary_1 = require("../../WABinary")
6
-
7
- class USyncLIDProtocol {
8
- constructor() {
9
- this.name = 'lid'
10
- }
11
- getQueryElement() {
12
- return {
13
- tag: 'lid',
14
- attrs: {}
15
- }
16
- }
17
- getUserElement(user) {
18
- if (user.lid) {
19
- return {
20
- tag: 'lid',
21
- attrs: { jid: user.lid }
22
- }
23
- }
24
- else {
25
- return null
26
- }
27
- }
28
- parser(node) {
29
- if (node.tag === 'lid') {
30
- return node.attrs.val
31
- }
32
- return null
33
- }
34
- }
35
-
36
- module.exports = {
37
- USyncLIDProtocol
38
- }
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class USyncLIDProtocol {
4
+ constructor() {
5
+ this.name = "lid";
6
+ }
7
+ getQueryElement() {
8
+ return { tag: "lid", attrs: {} };
9
+ }
10
+ getUserElement(user) {
11
+ if (user.lid) {
12
+ return { tag: "lid", attrs: { jid: user.lid } };
13
+ } else {
14
+ return null;
15
+ }
16
+ }
17
+ parser(node) {
18
+ if (node.tag === "lid") {
19
+ return node.attrs.val;
20
+ }
21
+ return null;
22
+ }
23
+ }
24
+ module.exports = { USyncLIDProtocol: USyncLIDProtocol };
@@ -1,46 +1,32 @@
1
- "use strict"
2
-
3
- Object.defineProperty(exports, "__esModule", { value: true })
4
-
5
- const WABinary_1 = require("../../WABinary")
6
-
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const { assertNodeErrorFree: assertNodeErrorFree } = require("../../WABinary");
7
4
  class USyncStatusProtocol {
8
5
  constructor() {
9
- this.name = 'status'
6
+ this.name = "status";
10
7
  }
11
8
  getQueryElement() {
12
- return {
13
- tag: 'status',
14
- attrs: {},
15
- }
9
+ return { tag: "status", attrs: {} };
16
10
  }
17
11
  getUserElement() {
18
- return null
12
+ return null;
19
13
  }
20
14
  parser(node) {
21
- if (node.tag === 'status') {
22
- WABinary_1.assertNodeErrorFree(node)
23
- let status = node?.content?.toString() || null
24
- const setAt = new Date(+(node?.attrs?.t || 0) * 1000)
15
+ if (node.tag === "status") {
16
+ assertNodeErrorFree(node);
17
+ let status = node?.content?.toString() || null;
18
+ const setAt = new Date(+(node?.attrs?.t || 0) * 1e3);
25
19
  if (!status) {
26
20
  if (+node.attrs?.code === 401) {
27
- status = ''
28
- }
29
- else {
30
- status = null
21
+ status = "";
22
+ } else {
23
+ status = null;
31
24
  }
25
+ } else if (typeof status === "string" && status.length === 0) {
26
+ status = null;
32
27
  }
33
- else if (typeof status === 'string' && status.length === 0) {
34
- status = null
35
- }
36
- return {
37
- status,
38
- setAt,
39
- }
28
+ return { status: status, setAt: setAt };
40
29
  }
41
30
  }
42
31
  }
43
-
44
- module.exports = {
45
- USyncStatusProtocol
46
- }
32
+ module.exports = { USyncStatusProtocol: USyncStatusProtocol };
@@ -1,26 +1,37 @@
1
- "use strict"
2
-
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k
5
- var desc = Object.getOwnPropertyDescriptor(m, k)
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k] } }
8
- }
9
- Object.defineProperty(o, k2, desc)
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k
12
- o[k2] = m[k]
13
- }))
14
-
15
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p)
17
- }
18
-
19
- Object.defineProperty(exports, "__esModule", { value: true })
20
-
21
- __exportStar(require("./USyncBotProfileProtocol"), exports)
22
- __exportStar(require("./USyncContactProtocol"), exports)
23
- __exportStar(require("./USyncDeviceProtocol"), exports)
24
- __exportStar(require("./USyncLIDProtocol"), exports)
25
- __exportStar(require("./USyncStatusProtocol"), exports)
26
- __exportStar(require("./USyncDisappearingModeProtocol"), exports)
1
+ "use strict";
2
+ const __createBinding =
3
+ (this && this.__createBinding) ||
4
+ (Object.create
5
+ ? function (o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ let desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = {
10
+ enumerable: true,
11
+ get: function () {
12
+ return m[k];
13
+ },
14
+ };
15
+ }
16
+ Object.defineProperty(o, k2, desc);
17
+ }
18
+ : function (o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ o[k2] = m[k];
21
+ });
22
+ const __exportStar =
23
+ (this && this.__exportStar) ||
24
+ function (m, exports) {
25
+ for (var p in m) {
26
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) {
27
+ __createBinding(exports, m, p);
28
+ }
29
+ }
30
+ };
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ __exportStar(require("./USyncBotProfileProtocol"), exports);
33
+ __exportStar(require("./USyncContactProtocol"), exports);
34
+ __exportStar(require("./USyncDeviceProtocol"), exports);
35
+ __exportStar(require("./USyncLIDProtocol"), exports);
36
+ __exportStar(require("./USyncStatusProtocol"), exports);
37
+ __exportStar(require("./USyncDisappearingModeProtocol"), exports);
@@ -1,92 +1,92 @@
1
- "use strict"
2
-
3
- Object.defineProperty(exports, "__esModule", { value: true })
4
-
5
- const WABinary_1 = require("../WABinary")
6
- const Protocols_1 = require("./Protocols")
7
-
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const { getBinaryNodeChild: getBinaryNodeChild } = require("../WABinary");
4
+ const {
5
+ USyncLIDProtocol: USyncLIDProtocol,
6
+ USyncDeviceProtocol: USyncDeviceProtocol,
7
+ USyncContactProtocol: USyncContactProtocol,
8
+ USyncStatusProtocol: USyncStatusProtocol,
9
+ USyncBotProfileProtocol: USyncBotProfileProtocol,
10
+ USyncDisappearingModeProtocol: USyncDisappearingModeProtocol,
11
+ } = require("./Protocols");
8
12
  class USyncQuery {
9
13
  constructor() {
10
- this.protocols = []
11
- this.users = []
12
- this.context = 'interactive'
13
- this.mode = 'query'
14
+ this.protocols = [];
15
+ this.users = [];
16
+ this.context = "interactive";
17
+ this.mode = "query";
14
18
  }
15
19
  withMode(mode) {
16
- this.mode = mode
17
- return this
20
+ this.mode = mode;
21
+ return this;
18
22
  }
19
23
  withContext(context) {
20
- this.context = context
21
- return this
24
+ this.context = context;
25
+ return this;
22
26
  }
23
27
  withUser(user) {
24
- this.users.push(user)
25
- return this
28
+ this.users.push(user);
29
+ return this;
26
30
  }
27
31
  parseUSyncQueryResult(result) {
28
- if (result.attrs.type !== 'result') {
29
- return
32
+ if (!result || result.attrs.type !== "result") {
33
+ return;
30
34
  }
31
- const protocolMap = Object.fromEntries(this.protocols.map((protocol) => {
32
- return [protocol.name, protocol.parser]
33
- }))
34
- const queryResult = {
35
- // TODO: implement errors etc.
36
- list: [],
37
- sideList: [],
35
+ const protocolMap = Object.fromEntries(
36
+ this.protocols.map((protocol) => [protocol.name, protocol.parser])
37
+ );
38
+ const queryResult = { list: [], sideList: [] };
39
+ const usyncNode = getBinaryNodeChild(result, "usync");
40
+ const listNode = usyncNode ? getBinaryNodeChild(usyncNode, "list") : undefined;
41
+ if (listNode?.content && Array.isArray(listNode.content)) {
42
+ queryResult.list = listNode.content.reduce((acc, node) => {
43
+ const id = node?.attrs.jid;
44
+ if (id) {
45
+ const data = Array.isArray(node?.content)
46
+ ? Object.fromEntries(
47
+ node.content
48
+ .map((content) => {
49
+ const protocol = content.tag;
50
+ const parser = protocolMap[protocol];
51
+ if (parser) {
52
+ return [protocol, parser(content)];
53
+ } else {
54
+ return [protocol, null];
55
+ }
56
+ })
57
+ .filter(([, b]) => b !== null)
58
+ )
59
+ : {};
60
+ acc.push({ ...data, id: id });
61
+ }
62
+ return acc;
63
+ }, []);
38
64
  }
39
- const usyncNode = WABinary_1.getBinaryNodeChild(result, 'usync')
40
- //TODO: implement error backoff, refresh etc.
41
- //TODO: see if there are any errors in the result node
42
- //const resultNode = getBinaryNodeChild(usyncNode, 'result')
43
- const listNode = WABinary_1.getBinaryNodeChild(usyncNode, 'list')
44
- if (Array.isArray(listNode?.content) && typeof listNode !== 'undefined') {
45
- queryResult.list = listNode.content.map((node) => {
46
- const id = node?.attrs?.jid
47
- const data = Array.isArray(node?.content) ? Object.fromEntries(node.content.map((content) => {
48
- const protocol = content.tag
49
- const parser = protocolMap[protocol]
50
- if (parser) {
51
- return [protocol, parser(content)]
52
- }
53
- else {
54
- return [protocol, null]
55
- }
56
- }).filter(([, b]) => b !== null)) : {}
57
- return { ...data, id }
58
- })
59
- }
60
- //TODO: implement side list
61
- //const sideListNode = getBinaryNodeChild(usyncNode, 'side_list')
62
- return queryResult
65
+ return queryResult;
63
66
  }
64
67
  withLIDProtocol() {
65
- this.protocols.push(new Protocols_1.USyncLIDProtocol())
66
- return this
68
+ this.protocols.push(new USyncLIDProtocol());
69
+ return this;
67
70
  }
68
71
  withDeviceProtocol() {
69
- this.protocols.push(new Protocols_1.USyncDeviceProtocol())
70
- return this
72
+ this.protocols.push(new USyncDeviceProtocol());
73
+ return this;
71
74
  }
72
75
  withContactProtocol() {
73
- this.protocols.push(new Protocols_1.USyncContactProtocol())
74
- return this
76
+ this.protocols.push(new USyncContactProtocol());
77
+ return this;
75
78
  }
76
79
  withStatusProtocol() {
77
- this.protocols.push(new Protocols_1.USyncStatusProtocol())
78
- return this
80
+ this.protocols.push(new USyncStatusProtocol());
81
+ return this;
79
82
  }
80
83
  withBotProfileProtocol() {
81
- this.protocols.push(new Protocols_1.USyncBotProfileProtocol())
82
- return this
84
+ this.protocols.push(new USyncBotProfileProtocol());
85
+ return this;
83
86
  }
84
87
  withDisappearingModeProtocol() {
85
- this.protocols.push(new Protocols_1.USyncDisappearingModeProtocol())
86
- return this
88
+ this.protocols.push(new USyncDisappearingModeProtocol());
89
+ return this;
87
90
  }
88
91
  }
89
-
90
- module.exports = {
91
- USyncQuery
92
- }
92
+ module.exports = { USyncQuery: USyncQuery };
@@ -1,30 +1,25 @@
1
- "use strict"
2
-
3
- Object.defineProperty(exports, "__esModule", { value: true })
4
-
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
5
3
  class USyncUser {
6
4
  withId(id) {
7
- this.id = id
8
- return this
5
+ this.id = id;
6
+ return this;
9
7
  }
10
8
  withLid(lid) {
11
- this.lid = lid
12
- return this
9
+ this.lid = lid;
10
+ return this;
13
11
  }
14
12
  withPhone(phone) {
15
- this.phone = phone
16
- return this
13
+ this.phone = phone;
14
+ return this;
17
15
  }
18
16
  withType(type) {
19
- this.type = type
20
- return this
17
+ this.type = type;
18
+ return this;
21
19
  }
22
20
  withPersonaId(personaId) {
23
- this.personaId = personaId
24
- return this
21
+ this.personaId = personaId;
22
+ return this;
25
23
  }
26
24
  }
27
-
28
- module.exports = {
29
- USyncUser
30
- }
25
+ module.exports = { USyncUser: USyncUser };
@@ -1,23 +1,34 @@
1
- "use strict"
2
-
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k
5
- var desc = Object.getOwnPropertyDescriptor(m, k)
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k] } }
8
- }
9
- Object.defineProperty(o, k2, desc)
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k
12
- o[k2] = m[k]
13
- }))
14
-
15
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p)
17
- }
18
-
19
- Object.defineProperty(exports, "__esModule", { value: true })
20
-
21
- __exportStar(require("./Protocols"), exports)
22
- __exportStar(require("./USyncQuery"), exports)
23
- __exportStar(require("./USyncUser"), exports)
1
+ "use strict";
2
+ const __createBinding =
3
+ (this && this.__createBinding) ||
4
+ (Object.create
5
+ ? function (o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ let desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = {
10
+ enumerable: true,
11
+ get: function () {
12
+ return m[k];
13
+ },
14
+ };
15
+ }
16
+ Object.defineProperty(o, k2, desc);
17
+ }
18
+ : function (o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ o[k2] = m[k];
21
+ });
22
+ const __exportStar =
23
+ (this && this.__exportStar) ||
24
+ function (m, exports) {
25
+ for (var p in m) {
26
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) {
27
+ __createBinding(exports, m, p);
28
+ }
29
+ }
30
+ };
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ __exportStar(require("./Protocols"), exports);
33
+ __exportStar(require("./USyncQuery"), exports);
34
+ __exportStar(require("./USyncUser"), exports);
package/lib/index.js CHANGED
@@ -1,33 +1,100 @@
1
1
  "use strict";
2
- console.log([
3
- '',
4
- ' \x1b[36m»\x1b[0m \x1b[1m\x1b[97m@pontalabs/baileys\x1b[0m \x1b[36m«\x1b[0m',
5
- ' \x1b[35m🔥\x1b[0m \x1b[33mTerimakasih sudah memakai baileys ini >.<\x1b[0m',
6
- '',
7
- ].join('\n'))
8
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- var desc = Object.getOwnPropertyDescriptor(m, k);
11
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
- desc = { enumerable: true, get: function() { return m[k]; } };
13
- }
14
- Object.defineProperty(o, k2, desc);
15
- }) : (function(o, m, k, k2) {
16
- if (k2 === undefined) k2 = k;
17
- o[k2] = m[k];
18
- }));
19
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
20
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
- };
22
- var __importDefault = (this && this.__importDefault) || function (mod) {
23
- return (mod && mod.__esModule) ? mod : { "default": mod };
2
+
3
+ const gradients = [
4
+ { c1: [255, 80, 120], c2: [255, 180, 210] },
5
+ { c1: [140, 90, 255], c2: [90, 200, 255] },
6
+ { c1: [0, 200, 255], c2: [120, 255, 220] },
7
+ { c1: [255, 170, 0], c2: [255, 255, 120] }
8
+ ];
9
+
10
+ const pkg = {
11
+ name: "Pontalabs",
12
+ version: "1.1.9",
13
+ developer: "Ponta",
14
+ author: "Ramacodex"
24
15
  };
16
+
17
+ const mottos = [
18
+ "Pontalabs — Fast & Reliable.",
19
+ "Built for WhatsApp bots.",
20
+ "Modern Baileys modification.",
21
+ "Optimized for performance.",
22
+ "Simple and efficient.",
23
+ "Reliable automation starts here.",
24
+ "Designed for developers.",
25
+ "Lightweight and powerful.",
26
+ "Made for better messaging.",
27
+ "Your trusted Baileys fork."
28
+ ];
29
+
30
+ const g = gradients[Math.floor(Math.random() * gradients.length)];
31
+ const motto = mottos[Math.floor(Math.random() * mottos.length)];
32
+
33
+ const gradient = (text) =>
34
+ text
35
+ .split("")
36
+ .map((ch, i, arr) => {
37
+ const t = i / (arr.length - 1 || 1);
38
+ const r = Math.round(g.c1[0] + (g.c2[0] - g.c1[0]) * t);
39
+ const gg = Math.round(g.c1[1] + (g.c2[1] - g.c1[1]) * t);
40
+ const b = Math.round(g.c1[2] + (g.c2[2] - g.c1[2]) * t);
41
+ return `\x1b[38;2;${r};${gg};${b}m${ch}`;
42
+ })
43
+ .join("") + "\x1b[0m";
44
+
45
+ console.log(`
46
+ ${gradient("👋🍀 Baileys PontaLabs")}
47
+ ${gradient("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")}
48
+ ${gradient(` Version : ${pkg.version}`)}
49
+ ${gradient(` Thanks To : ${pkg.author}`)}
50
+ ${gradient(` Developer : ${pkg.developer}`)}
51
+
52
+ ${gradient(` ${motto}`)}
53
+ ${gradient("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")}
54
+ `);
55
+
56
+
57
+
58
+ const __createBinding =
59
+ (this && this.__createBinding) ||
60
+ (Object.create
61
+ ? function (o, m, k, k2) {
62
+ if (k2 === undefined) k2 = k;
63
+ let desc = Object.getOwnPropertyDescriptor(m, k);
64
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
65
+ desc = {
66
+ enumerable: true,
67
+ get: function () {
68
+ return m[k];
69
+ },
70
+ };
71
+ }
72
+ Object.defineProperty(o, k2, desc);
73
+ }
74
+ : function (o, m, k, k2) {
75
+ if (k2 === undefined) k2 = k;
76
+ o[k2] = m[k];
77
+ });
78
+ const __exportStar =
79
+ (this && this.__exportStar) ||
80
+ function (m, exports) {
81
+ for (var p in m) {
82
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) {
83
+ __createBinding(exports, m, p);
84
+ }
85
+ }
86
+ };
25
87
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.proto = exports.makeWASocket = void 0;
27
- const WAProto_1 = require("../WAProto");
28
- Object.defineProperty(exports, "proto", { enumerable: true, get: function () { return WAProto_1.proto; } });
29
- const Socket_1 = __importDefault(require("./Socket"));
30
- exports.makeWASocket = Socket_1.default;
88
+ exports.proto = exports.makeWASocket = null;
89
+ const { proto: proto } = require("../WAProto");
90
+ Object.defineProperty(exports, "proto", {
91
+ enumerable: true,
92
+ get: function () {
93
+ return proto;
94
+ },
95
+ });
96
+ const { default: socket } = require("./Socket");
97
+ exports.makeWASocket = socket;
31
98
  __exportStar(require("../WAProto"), exports);
32
99
  __exportStar(require("./Utils"), exports);
33
100
  __exportStar(require("./Types"), exports);
@@ -36,4 +103,4 @@ __exportStar(require("./Defaults"), exports);
36
103
  __exportStar(require("./WABinary"), exports);
37
104
  __exportStar(require("./WAM"), exports);
38
105
  __exportStar(require("./WAUSync"), exports);
39
- exports.default = Socket_1.default;
106
+ exports.default = socket;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pontalabs/baileys",
3
- "version": "1.0.11",
3
+ "version": "1.1.0",
4
4
  "description": "PontaLabs Baileys is a lightweight, modern, and customizable WhatsApp Web API library built on Baileys.",
5
5
  "keywords": [
6
6
  "facebook",
@@ -45,6 +45,7 @@
45
45
  "lru-cache": "^11.1.0",
46
46
  "music-metadata": "^7.12.3",
47
47
  "pino": "^9.6",
48
+ "p-queue": "6.1.1",
48
49
  "protobufjs": "^7.2.4",
49
50
  "qrcode-terminal": "^0.12.0",
50
51
  "ws": "^8.13.0"
@@ -1,3 +0,0 @@
1
- {
2
- "version": [2, 3000, 1035194821]
3
- }
@@ -1 +0,0 @@
1
- export default function queueJob<T>(bucket: string | number, awaitable: () => Promise<T>): Promise<T>;