cuki-bailx 1.2.5 → 2.0.7

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 (154) hide show
  1. package/WAProto/AICommon.js +27981 -0
  2. package/WAProto/AICommon.proto +713 -0
  3. package/WAProto/Ephemeral.js +295 -0
  4. package/WAProto/Ephemeral.proto +7 -0
  5. package/WAProto/GenerateStatics.sh +4 -0
  6. package/WAProto/WAProto.proto +4775 -0
  7. package/WAProto/cuki.js +7 -0
  8. package/WAProto/index.js +56886 -17506
  9. package/lib/Defaults/baileys-version.json +2 -2
  10. package/lib/Defaults/index.js +117 -102
  11. package/lib/Socket/Client/index.js +2 -3
  12. package/lib/Socket/Client/{web-socket-client.js → websocket.js} +54 -5
  13. package/lib/Socket/chats.js +97 -90
  14. package/lib/Socket/groups.js +20 -5
  15. package/lib/Socket/index.js +2 -2
  16. package/lib/Socket/messages-recv.js +9 -65
  17. package/lib/Socket/messages-send.js +612 -286
  18. package/lib/Socket/newsletter.js +68 -41
  19. package/lib/Socket/{dugong.js → setup.js} +5 -13
  20. package/lib/Socket/socket.js +58 -32
  21. package/lib/Store/index.js +1 -3
  22. package/lib/Store/make-in-memory-store.js +26 -14
  23. package/lib/Store/make-ordered-dictionary.js +2 -2
  24. package/lib/Types/Label.js +1 -1
  25. package/lib/Types/LabelAssociation.js +1 -1
  26. package/lib/Types/Message.js +0 -2
  27. package/lib/Types/Newsletter.js +3 -17
  28. package/lib/Types/index.js +2 -2
  29. package/lib/Utils/auth-utils.js +6 -13
  30. package/lib/Utils/business.js +2 -2
  31. package/lib/Utils/chat-utils.js +36 -35
  32. package/lib/Utils/crypto.js +71 -29
  33. package/lib/Utils/decode-wa-message.js +65 -56
  34. package/lib/Utils/event-buffer.js +11 -7
  35. package/lib/Utils/generics.js +73 -23
  36. package/lib/Utils/history.js +4 -6
  37. package/lib/Utils/link-preview.js +34 -1
  38. package/lib/Utils/lt-hash.js +6 -6
  39. package/lib/Utils/messages-media.js +479 -161
  40. package/lib/Utils/messages.js +391 -77
  41. package/lib/Utils/noise-handler.js +19 -23
  42. package/lib/Utils/signal.js +47 -36
  43. package/lib/Utils/use-multi-file-auth-state.js +51 -6
  44. package/lib/Utils/validate-connection.js +94 -66
  45. package/lib/WABinary/constants.js +1276 -13
  46. package/lib/WABinary/decode.js +26 -13
  47. package/lib/WABinary/encode.js +39 -17
  48. package/lib/WABinary/generic-utils.js +2 -85
  49. package/lib/WABinary/jid-utils.js +12 -5
  50. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +1 -1
  51. package/lib/index.js +18 -5
  52. package/package.json +100 -105
  53. package/engine-requirements.js +0 -10
  54. package/lib/Defaults/index.d.ts +0 -53
  55. package/lib/Defaults/phonenumber-mcc.json +0 -223
  56. package/lib/Signal/Group/ciphertext-message.d.ts +0 -9
  57. package/lib/Signal/Group/group-session-builder.d.ts +0 -14
  58. package/lib/Signal/Group/group_cipher.d.ts +0 -17
  59. package/lib/Signal/Group/index.d.ts +0 -11
  60. package/lib/Signal/Group/keyhelper.d.ts +0 -10
  61. package/lib/Signal/Group/queue-job.d.ts +0 -1
  62. package/lib/Signal/Group/sender-chain-key.d.ts +0 -13
  63. package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -16
  64. package/lib/Signal/Group/sender-key-message.d.ts +0 -18
  65. package/lib/Signal/Group/sender-key-name.d.ts +0 -17
  66. package/lib/Signal/Group/sender-key-record.d.ts +0 -30
  67. package/lib/Signal/Group/sender-key-state.d.ts +0 -38
  68. package/lib/Signal/Group/sender-message-key.d.ts +0 -11
  69. package/lib/Signal/libsignal.d.ts +0 -3
  70. package/lib/Socket/Client/abstract-socket-client.d.ts +0 -17
  71. package/lib/Socket/Client/index.d.ts +0 -3
  72. package/lib/Socket/Client/mobile-socket-client.d.ts +0 -13
  73. package/lib/Socket/Client/mobile-socket-client.js +0 -65
  74. package/lib/Socket/Client/web-socket-client.d.ts +0 -12
  75. package/lib/Socket/business.d.ts +0 -171
  76. package/lib/Socket/chats.d.ts +0 -80
  77. package/lib/Socket/dugong.d.ts +0 -219
  78. package/lib/Socket/groups.d.ts +0 -115
  79. package/lib/Socket/index.d.ts +0 -173
  80. package/lib/Socket/messages-recv.d.ts +0 -161
  81. package/lib/Socket/messages-send.d.ts +0 -149
  82. package/lib/Socket/newsletter.d.ts +0 -134
  83. package/lib/Socket/registration.d.ts +0 -267
  84. package/lib/Socket/registration.js +0 -166
  85. package/lib/Socket/socket.d.ts +0 -43
  86. package/lib/Socket/socket.js.bak +0 -630
  87. package/lib/Socket/usync.d.ts +0 -36
  88. package/lib/Store/index.d.ts +0 -3
  89. package/lib/Store/make-cache-manager-store.d.ts +0 -13
  90. package/lib/Store/make-cache-manager-store.js +0 -83
  91. package/lib/Store/make-in-memory-store.d.ts +0 -118
  92. package/lib/Store/make-ordered-dictionary.d.ts +0 -13
  93. package/lib/Store/object-repository.d.ts +0 -10
  94. package/lib/Types/Auth.d.ts +0 -110
  95. package/lib/Types/Call.d.ts +0 -13
  96. package/lib/Types/Chat.d.ts +0 -102
  97. package/lib/Types/Contact.d.ts +0 -19
  98. package/lib/Types/Events.d.ts +0 -157
  99. package/lib/Types/GroupMetadata.d.ts +0 -55
  100. package/lib/Types/Label.d.ts +0 -35
  101. package/lib/Types/LabelAssociation.d.ts +0 -29
  102. package/lib/Types/Message.d.ts +0 -273
  103. package/lib/Types/Newsletter.d.ts +0 -92
  104. package/lib/Types/Product.d.ts +0 -78
  105. package/lib/Types/Signal.d.ts +0 -57
  106. package/lib/Types/Socket.d.ts +0 -111
  107. package/lib/Types/State.d.ts +0 -27
  108. package/lib/Types/USync.d.ts +0 -25
  109. package/lib/Types/index.d.ts +0 -57
  110. package/lib/Utils/auth-utils.d.ts +0 -18
  111. package/lib/Utils/baileys-event-stream.d.ts +0 -16
  112. package/lib/Utils/business.d.ts +0 -22
  113. package/lib/Utils/chat-utils.d.ts +0 -71
  114. package/lib/Utils/crypto.d.ts +0 -41
  115. package/lib/Utils/decode-wa-message.d.ts +0 -19
  116. package/lib/Utils/event-buffer.d.ts +0 -35
  117. package/lib/Utils/generics.d.ts +0 -92
  118. package/lib/Utils/history.d.ts +0 -15
  119. package/lib/Utils/index.d.ts +0 -17
  120. package/lib/Utils/link-preview.d.ts +0 -21
  121. package/lib/Utils/logger.d.ts +0 -4
  122. package/lib/Utils/lt-hash.d.ts +0 -12
  123. package/lib/Utils/make-mutex.d.ts +0 -7
  124. package/lib/Utils/messages-media.d.ts +0 -116
  125. package/lib/Utils/messages.d.ts +0 -77
  126. package/lib/Utils/noise-handler.d.ts +0 -21
  127. package/lib/Utils/process-message.d.ts +0 -41
  128. package/lib/Utils/signal.d.ts +0 -32
  129. package/lib/Utils/use-multi-file-auth-state.d.ts +0 -13
  130. package/lib/Utils/validate-connection.d.ts +0 -11
  131. package/lib/WABinary/constants.d.ts +0 -27
  132. package/lib/WABinary/decode.d.ts +0 -7
  133. package/lib/WABinary/encode.d.ts +0 -3
  134. package/lib/WABinary/generic-utils.d.ts +0 -16
  135. package/lib/WABinary/index.d.ts +0 -5
  136. package/lib/WABinary/jid-utils.d.ts +0 -31
  137. package/lib/WABinary/types.d.ts +0 -18
  138. package/lib/WAM/BinaryInfo.d.ts +0 -17
  139. package/lib/WAM/constants.d.ts +0 -38
  140. package/lib/WAM/encode.d.ts +0 -3
  141. package/lib/WAM/index.d.ts +0 -3
  142. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -9
  143. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -22
  144. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -12
  145. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -12
  146. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +0 -25
  147. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +0 -8
  148. package/lib/WAUSync/Protocols/index.d.ts +0 -4
  149. package/lib/WAUSync/USyncQuery.d.ts +0 -28
  150. package/lib/WAUSync/USyncUser.d.ts +0 -12
  151. package/lib/WAUSync/index.d.ts +0 -3
  152. package/lib/index.d.ts +0 -12
  153. package/lib/index.js.bak +0 -48
  154. /package/lib/Socket/Client/{abstract-socket-client.js → types.js} +0 -0
@@ -0,0 +1,295 @@
1
+ /*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
2
+ "use strict";
3
+
4
+ var $protobuf = require("protobufjs/minimal");
5
+
6
+ // Common aliases
7
+ var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
8
+
9
+ // Exported root namespace
10
+ var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
11
+
12
+ $root.Ephemeral = (function() {
13
+
14
+ /**
15
+ * Namespace Ephemeral.
16
+ * @exports Ephemeral
17
+ * @namespace
18
+ */
19
+ var Ephemeral = {};
20
+
21
+ Ephemeral.EphemeralSetting = (function() {
22
+
23
+ /**
24
+ * Properties of an EphemeralSetting.
25
+ * @memberof Ephemeral
26
+ * @interface IEphemeralSetting
27
+ * @property {number|null} [duration] EphemeralSetting duration
28
+ * @property {number|Long|null} [timestamp] EphemeralSetting timestamp
29
+ */
30
+
31
+ /**
32
+ * Constructs a new EphemeralSetting.
33
+ * @memberof Ephemeral
34
+ * @classdesc Represents an EphemeralSetting.
35
+ * @implements IEphemeralSetting
36
+ * @constructor
37
+ * @param {Ephemeral.IEphemeralSetting=} [properties] Properties to set
38
+ */
39
+ function EphemeralSetting(properties) {
40
+ if (properties)
41
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
42
+ if (properties[keys[i]] != null)
43
+ this[keys[i]] = properties[keys[i]];
44
+ }
45
+
46
+ /**
47
+ * EphemeralSetting duration.
48
+ * @member {number|null|undefined} duration
49
+ * @memberof Ephemeral.EphemeralSetting
50
+ * @instance
51
+ */
52
+ EphemeralSetting.prototype.duration = null;
53
+
54
+ /**
55
+ * EphemeralSetting timestamp.
56
+ * @member {number|Long|null|undefined} timestamp
57
+ * @memberof Ephemeral.EphemeralSetting
58
+ * @instance
59
+ */
60
+ EphemeralSetting.prototype.timestamp = null;
61
+
62
+ // OneOf field names bound to virtual getters and setters
63
+ var $oneOfFields;
64
+
65
+ /**
66
+ * EphemeralSetting _duration.
67
+ * @member {"duration"|undefined} _duration
68
+ * @memberof Ephemeral.EphemeralSetting
69
+ * @instance
70
+ */
71
+ Object.defineProperty(EphemeralSetting.prototype, "_duration", {
72
+ get: $util.oneOfGetter($oneOfFields = ["duration"]),
73
+ set: $util.oneOfSetter($oneOfFields)
74
+ });
75
+
76
+ /**
77
+ * EphemeralSetting _timestamp.
78
+ * @member {"timestamp"|undefined} _timestamp
79
+ * @memberof Ephemeral.EphemeralSetting
80
+ * @instance
81
+ */
82
+ Object.defineProperty(EphemeralSetting.prototype, "_timestamp", {
83
+ get: $util.oneOfGetter($oneOfFields = ["timestamp"]),
84
+ set: $util.oneOfSetter($oneOfFields)
85
+ });
86
+
87
+ /**
88
+ * Creates a new EphemeralSetting instance using the specified properties.
89
+ * @function create
90
+ * @memberof Ephemeral.EphemeralSetting
91
+ * @static
92
+ * @param {Ephemeral.IEphemeralSetting=} [properties] Properties to set
93
+ * @returns {Ephemeral.EphemeralSetting} EphemeralSetting instance
94
+ */
95
+ EphemeralSetting.create = function create(properties) {
96
+ return new EphemeralSetting(properties);
97
+ };
98
+
99
+ /**
100
+ * Encodes the specified EphemeralSetting message. Does not implicitly {@link Ephemeral.EphemeralSetting.verify|verify} messages.
101
+ * @function encode
102
+ * @memberof Ephemeral.EphemeralSetting
103
+ * @static
104
+ * @param {Ephemeral.IEphemeralSetting} message EphemeralSetting message or plain object to encode
105
+ * @param {$protobuf.Writer} [writer] Writer to encode to
106
+ * @returns {$protobuf.Writer} Writer
107
+ */
108
+ EphemeralSetting.encode = function encode(message, writer) {
109
+ if (!writer)
110
+ writer = $Writer.create();
111
+ if (message.duration != null && Object.hasOwnProperty.call(message, "duration"))
112
+ writer.uint32(/* id 1, wireType 5 =*/13).sfixed32(message.duration);
113
+ if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp"))
114
+ writer.uint32(/* id 2, wireType 1 =*/17).sfixed64(message.timestamp);
115
+ return writer;
116
+ };
117
+
118
+ /**
119
+ * Encodes the specified EphemeralSetting message, length delimited. Does not implicitly {@link Ephemeral.EphemeralSetting.verify|verify} messages.
120
+ * @function encodeDelimited
121
+ * @memberof Ephemeral.EphemeralSetting
122
+ * @static
123
+ * @param {Ephemeral.IEphemeralSetting} message EphemeralSetting message or plain object to encode
124
+ * @param {$protobuf.Writer} [writer] Writer to encode to
125
+ * @returns {$protobuf.Writer} Writer
126
+ */
127
+ EphemeralSetting.encodeDelimited = function encodeDelimited(message, writer) {
128
+ return this.encode(message, writer).ldelim();
129
+ };
130
+
131
+ /**
132
+ * Decodes an EphemeralSetting message from the specified reader or buffer.
133
+ * @function decode
134
+ * @memberof Ephemeral.EphemeralSetting
135
+ * @static
136
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
137
+ * @param {number} [length] Message length if known beforehand
138
+ * @returns {Ephemeral.EphemeralSetting} EphemeralSetting
139
+ * @throws {Error} If the payload is not a reader or valid buffer
140
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
141
+ */
142
+ EphemeralSetting.decode = function decode(reader, length, error) {
143
+ if (!(reader instanceof $Reader))
144
+ reader = $Reader.create(reader);
145
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.Ephemeral.EphemeralSetting();
146
+ while (reader.pos < end) {
147
+ var tag = reader.uint32();
148
+ if (tag === error)
149
+ break;
150
+ switch (tag >>> 3) {
151
+ case 1: {
152
+ message.duration = reader.sfixed32();
153
+ break;
154
+ }
155
+ case 2: {
156
+ message.timestamp = reader.sfixed64();
157
+ break;
158
+ }
159
+ default:
160
+ reader.skipType(tag & 7);
161
+ break;
162
+ }
163
+ }
164
+ return message;
165
+ };
166
+
167
+ /**
168
+ * Decodes an EphemeralSetting message from the specified reader or buffer, length delimited.
169
+ * @function decodeDelimited
170
+ * @memberof Ephemeral.EphemeralSetting
171
+ * @static
172
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
173
+ * @returns {Ephemeral.EphemeralSetting} EphemeralSetting
174
+ * @throws {Error} If the payload is not a reader or valid buffer
175
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
176
+ */
177
+ EphemeralSetting.decodeDelimited = function decodeDelimited(reader) {
178
+ if (!(reader instanceof $Reader))
179
+ reader = new $Reader(reader);
180
+ return this.decode(reader, reader.uint32());
181
+ };
182
+
183
+ /**
184
+ * Verifies an EphemeralSetting message.
185
+ * @function verify
186
+ * @memberof Ephemeral.EphemeralSetting
187
+ * @static
188
+ * @param {Object.<string,*>} message Plain object to verify
189
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
190
+ */
191
+ EphemeralSetting.verify = function verify(message) {
192
+ if (typeof message !== "object" || message === null)
193
+ return "object expected";
194
+ var properties = {};
195
+ if (message.duration != null && message.hasOwnProperty("duration")) {
196
+ properties._duration = 1;
197
+ if (!$util.isInteger(message.duration))
198
+ return "duration: integer expected";
199
+ }
200
+ if (message.timestamp != null && message.hasOwnProperty("timestamp")) {
201
+ properties._timestamp = 1;
202
+ if (!$util.isInteger(message.timestamp) && !(message.timestamp && $util.isInteger(message.timestamp.low) && $util.isInteger(message.timestamp.high)))
203
+ return "timestamp: integer|Long expected";
204
+ }
205
+ return null;
206
+ };
207
+
208
+ /**
209
+ * Creates an EphemeralSetting message from a plain object. Also converts values to their respective internal types.
210
+ * @function fromObject
211
+ * @memberof Ephemeral.EphemeralSetting
212
+ * @static
213
+ * @param {Object.<string,*>} object Plain object
214
+ * @returns {Ephemeral.EphemeralSetting} EphemeralSetting
215
+ */
216
+ EphemeralSetting.fromObject = function fromObject(object) {
217
+ if (object instanceof $root.Ephemeral.EphemeralSetting)
218
+ return object;
219
+ var message = new $root.Ephemeral.EphemeralSetting();
220
+ if (object.duration != null)
221
+ message.duration = object.duration | 0;
222
+ if (object.timestamp != null)
223
+ if ($util.Long)
224
+ (message.timestamp = $util.Long.fromValue(object.timestamp)).unsigned = false;
225
+ else if (typeof object.timestamp === "string")
226
+ message.timestamp = parseInt(object.timestamp, 10);
227
+ else if (typeof object.timestamp === "number")
228
+ message.timestamp = object.timestamp;
229
+ else if (typeof object.timestamp === "object")
230
+ message.timestamp = new $util.LongBits(object.timestamp.low >>> 0, object.timestamp.high >>> 0).toNumber();
231
+ return message;
232
+ };
233
+
234
+ /**
235
+ * Creates a plain object from an EphemeralSetting message. Also converts values to other types if specified.
236
+ * @function toObject
237
+ * @memberof Ephemeral.EphemeralSetting
238
+ * @static
239
+ * @param {Ephemeral.EphemeralSetting} message EphemeralSetting
240
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
241
+ * @returns {Object.<string,*>} Plain object
242
+ */
243
+ EphemeralSetting.toObject = function toObject(message, options) {
244
+ if (!options)
245
+ options = {};
246
+ var object = {};
247
+ if (message.duration != null && message.hasOwnProperty("duration")) {
248
+ object.duration = message.duration;
249
+ if (options.oneofs)
250
+ object._duration = "duration";
251
+ }
252
+ if (message.timestamp != null && message.hasOwnProperty("timestamp")) {
253
+ if (typeof message.timestamp === "number")
254
+ object.timestamp = options.longs === String ? String(message.timestamp) : message.timestamp;
255
+ else
256
+ object.timestamp = options.longs === String ? $util.Long.prototype.toString.call(message.timestamp) : options.longs === Number ? new $util.LongBits(message.timestamp.low >>> 0, message.timestamp.high >>> 0).toNumber() : message.timestamp;
257
+ if (options.oneofs)
258
+ object._timestamp = "timestamp";
259
+ }
260
+ return object;
261
+ };
262
+
263
+ /**
264
+ * Converts this EphemeralSetting to JSON.
265
+ * @function toJSON
266
+ * @memberof Ephemeral.EphemeralSetting
267
+ * @instance
268
+ * @returns {Object.<string,*>} JSON object
269
+ */
270
+ EphemeralSetting.prototype.toJSON = function toJSON() {
271
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
272
+ };
273
+
274
+ /**
275
+ * Gets the default type url for EphemeralSetting
276
+ * @function getTypeUrl
277
+ * @memberof Ephemeral.EphemeralSetting
278
+ * @static
279
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
280
+ * @returns {string} The default type url
281
+ */
282
+ EphemeralSetting.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
283
+ if (typeUrlPrefix === undefined) {
284
+ typeUrlPrefix = "type.googleapis.com";
285
+ }
286
+ return typeUrlPrefix + "/Ephemeral.EphemeralSetting";
287
+ };
288
+
289
+ return EphemeralSetting;
290
+ })();
291
+
292
+ return Ephemeral;
293
+ })();
294
+
295
+ module.exports = $root;
@@ -0,0 +1,7 @@
1
+ syntax = "proto3";
2
+ package Ephemeral;
3
+
4
+ message EphemeralSetting {
5
+ optional sfixed32 duration = 1;
6
+ optional sfixed64 timestamp = 2;
7
+ }
@@ -0,0 +1,4 @@
1
+ yarn pbjs -t static-module -w commonjs -o ./WAProto/index.js ./WAProto/WAProto.proto;
2
+ yarn pbts -o ./WAProto/index.d.ts ./WAProto/index.js;
3
+
4
+ #protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_opt=env=node,useOptionals=true,forceLong=long --ts_proto_out=. ./src/Binary/WAMessage.proto;