@mamans2973/maman 0.0.0-stage → 1.0.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 (164) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1275 -2
  3. package/WAProto/index.d.ts +37016 -0
  4. package/WAProto/index.js +2972 -0
  5. package/WASignalGroup/GroupProtocol.js +1697 -0
  6. package/WASignalGroup/ciphertext_message.js +16 -0
  7. package/WASignalGroup/group_cipher.js +120 -0
  8. package/WASignalGroup/group_session_builder.js +46 -0
  9. package/WASignalGroup/index.js +5 -0
  10. package/WASignalGroup/keyhelper.js +21 -0
  11. package/WASignalGroup/protobufs.js +3 -0
  12. package/WASignalGroup/queue_job.js +69 -0
  13. package/WASignalGroup/sender_chain_key.js +50 -0
  14. package/WASignalGroup/sender_key_distribution_message.js +78 -0
  15. package/WASignalGroup/sender_key_message.js +92 -0
  16. package/WASignalGroup/sender_key_name.js +70 -0
  17. package/WASignalGroup/sender_key_record.js +56 -0
  18. package/WASignalGroup/sender_key_state.js +129 -0
  19. package/WASignalGroup/sender_message_key.js +39 -0
  20. package/engine-requirements.js +1 -0
  21. package/lib/Defaults/baileys-version.json +3 -0
  22. package/lib/Defaults/index.d.ts +51 -0
  23. package/lib/Defaults/index.js +10 -0
  24. package/lib/Signal/libsignal.d.ts +3 -0
  25. package/lib/Signal/libsignal.js +9 -0
  26. package/lib/Socket/Client/index.d.ts +2 -0
  27. package/lib/Socket/Client/index.js +2 -0
  28. package/lib/Socket/Client/types.d.ts +15 -0
  29. package/lib/Socket/Client/types.js +1 -0
  30. package/lib/Socket/Client/websocket.d.ts +12 -0
  31. package/lib/Socket/Client/websocket.js +4 -0
  32. package/lib/Socket/business.d.ts +146 -0
  33. package/lib/Socket/business.js +8 -0
  34. package/lib/Socket/chats.d.ts +85 -0
  35. package/lib/Socket/chats.js +29 -0
  36. package/lib/Socket/groups.d.ts +124 -0
  37. package/lib/Socket/groups.js +14 -0
  38. package/lib/Socket/index.d.ts +146 -0
  39. package/lib/Socket/index.js +1 -0
  40. package/lib/Socket/messages-recv.d.ts +135 -0
  41. package/lib/Socket/messages-recv.js +39 -0
  42. package/lib/Socket/messages-send.d.ts +130 -0
  43. package/lib/Socket/messages-send.js +26 -0
  44. package/lib/Socket/socket.d.ts +42 -0
  45. package/lib/Socket/socket.js +25 -0
  46. package/lib/Socket/usync.d.ts +36 -0
  47. package/lib/Socket/usync.js +3 -0
  48. package/lib/Types/Auth.d.ts +103 -0
  49. package/lib/Types/Auth.js +1 -0
  50. package/lib/Types/Call.d.ts +13 -0
  51. package/lib/Types/Call.js +1 -0
  52. package/lib/Types/Chat.d.ts +112 -0
  53. package/lib/Types/Chat.js +1 -0
  54. package/lib/Types/Contact.d.ts +19 -0
  55. package/lib/Types/Contact.js +1 -0
  56. package/lib/Types/Events.d.ts +172 -0
  57. package/lib/Types/Events.js +1 -0
  58. package/lib/Types/GroupMetadata.d.ts +58 -0
  59. package/lib/Types/GroupMetadata.js +1 -0
  60. package/lib/Types/Label.d.ts +46 -0
  61. package/lib/Types/Label.js +3 -0
  62. package/lib/Types/LabelAssociation.d.ts +29 -0
  63. package/lib/Types/LabelAssociation.js +1 -0
  64. package/lib/Types/Message.d.ts +267 -0
  65. package/lib/Types/Message.js +1 -0
  66. package/lib/Types/Product.d.ts +78 -0
  67. package/lib/Types/Product.js +1 -0
  68. package/lib/Types/Signal.d.ts +57 -0
  69. package/lib/Types/Signal.js +1 -0
  70. package/lib/Types/Socket.d.ts +121 -0
  71. package/lib/Types/Socket.js +1 -0
  72. package/lib/Types/State.d.ts +27 -0
  73. package/lib/Types/State.js +1 -0
  74. package/lib/Types/USync.d.ts +25 -0
  75. package/lib/Types/USync.js +1 -0
  76. package/lib/Types/index.d.ts +63 -0
  77. package/lib/Types/index.js +4 -0
  78. package/lib/Utils/auth-utils.d.ts +18 -0
  79. package/lib/Utils/auth-utils.js +8 -0
  80. package/lib/Utils/baileys-event-stream.d.ts +16 -0
  81. package/lib/Utils/baileys-event-stream.js +3 -0
  82. package/lib/Utils/business.d.ts +22 -0
  83. package/lib/Utils/business.js +14 -0
  84. package/lib/Utils/chat-utils.d.ts +70 -0
  85. package/lib/Utils/chat-utils.js +36 -0
  86. package/lib/Utils/crypto.d.ts +40 -0
  87. package/lib/Utils/crypto.js +11 -0
  88. package/lib/Utils/decode-wa-message.d.ts +36 -0
  89. package/lib/Utils/decode-wa-message.js +9 -0
  90. package/lib/Utils/event-buffer.d.ts +35 -0
  91. package/lib/Utils/event-buffer.js +19 -0
  92. package/lib/Utils/generics.d.ts +90 -0
  93. package/lib/Utils/generics.js +22 -0
  94. package/lib/Utils/history.d.ts +19 -0
  95. package/lib/Utils/history.js +7 -0
  96. package/lib/Utils/index.d.ts +17 -0
  97. package/lib/Utils/index.js +3 -0
  98. package/lib/Utils/link-preview.d.ts +21 -0
  99. package/lib/Utils/link-preview.js +5 -0
  100. package/lib/Utils/logger.d.ts +11 -0
  101. package/lib/Utils/logger.js +1 -0
  102. package/lib/Utils/lt-hash.d.ts +12 -0
  103. package/lib/Utils/lt-hash.js +3 -0
  104. package/lib/Utils/make-mutex.d.ts +7 -0
  105. package/lib/Utils/make-mutex.js +1 -0
  106. package/lib/Utils/messages-media.d.ts +103 -0
  107. package/lib/Utils/messages-media.js +35 -0
  108. package/lib/Utils/messages.d.ts +75 -0
  109. package/lib/Utils/messages.js +43 -0
  110. package/lib/Utils/noise-handler.d.ts +19 -0
  111. package/lib/Utils/noise-handler.js +6 -0
  112. package/lib/Utils/process-message.d.ts +41 -0
  113. package/lib/Utils/process-message.js +19 -0
  114. package/lib/Utils/signal.d.ts +33 -0
  115. package/lib/Utils/signal.js +10 -0
  116. package/lib/Utils/use-multi-file-auth-state.d.ts +12 -0
  117. package/lib/Utils/use-multi-file-auth-state.js +5 -0
  118. package/lib/Utils/validate-connection.d.ts +10 -0
  119. package/lib/Utils/validate-connection.js +10 -0
  120. package/lib/WABinary/constants.d.ts +27 -0
  121. package/lib/WABinary/constants.js +6 -0
  122. package/lib/WABinary/decode.d.ts +6 -0
  123. package/lib/WABinary/decode.js +9 -0
  124. package/lib/WABinary/encode.d.ts +2 -0
  125. package/lib/WABinary/encode.js +9 -0
  126. package/lib/WABinary/generic-utils.d.ts +14 -0
  127. package/lib/WABinary/generic-utils.js +7 -0
  128. package/lib/WABinary/index.d.ts +5 -0
  129. package/lib/WABinary/index.js +2 -0
  130. package/lib/WABinary/jid-utils.d.ts +35 -0
  131. package/lib/WABinary/jid-utils.js +5 -0
  132. package/lib/WABinary/types.d.ts +18 -0
  133. package/lib/WABinary/types.js +1 -0
  134. package/lib/WAM/BinaryInfo.d.ts +8 -0
  135. package/lib/WAM/BinaryInfo.js +1 -0
  136. package/lib/WAM/constants.d.ts +39 -0
  137. package/lib/WAM/constants.js +492 -0
  138. package/lib/WAM/encode.d.ts +2 -0
  139. package/lib/WAM/encode.js +7 -0
  140. package/lib/WAM/index.d.ts +3 -0
  141. package/lib/WAM/index.js +2 -0
  142. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -0
  143. package/lib/WAUSync/Protocols/USyncContactProtocol.js +2 -0
  144. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -0
  145. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +3 -0
  146. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
  147. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +2 -0
  148. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
  149. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +2 -0
  150. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +25 -0
  151. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +4 -0
  152. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +8 -0
  153. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +1 -0
  154. package/lib/WAUSync/Protocols/index.d.ts +4 -0
  155. package/lib/WAUSync/Protocols/index.js +2 -0
  156. package/lib/WAUSync/USyncQuery.d.ts +28 -0
  157. package/lib/WAUSync/USyncQuery.js +4 -0
  158. package/lib/WAUSync/USyncUser.d.ts +12 -0
  159. package/lib/WAUSync/USyncUser.js +1 -0
  160. package/lib/WAUSync/index.d.ts +3 -0
  161. package/lib/WAUSync/index.js +2 -0
  162. package/lib/index.d.ts +11 -0
  163. package/lib/index.js +3 -0
  164. package/package.json +94 -4
@@ -0,0 +1,2 @@
1
+ import { BinaryInfo } from './BinaryInfo';
2
+ export declare const encodeWAM: (binaryInfo: BinaryInfo) => Buffer<ArrayBuffer>;
@@ -0,0 +1,7 @@
1
+ Object.defineProperty(exports,"__esModule",{value:!0});exports.encodeWAM=void 0;const constants_1=require("./constants"),getHeaderBitLength=d=>256>d?2:3,encodeWAM=d=>{d.buffer=[];encodeWAMHeader(d);encodeEvents(d);console.log(d.buffer);var b=d.buffer.map(a=>a.length).reduce((a,c)=>a+c);b=Buffer.alloc(b);let e=0;for(const a of d.buffer)a.copy(b,e),e+=a.length;return b};exports.encodeWAM=encodeWAM;
2
+ function encodeWAMHeader(d){const b=Buffer.alloc(8);b.write("WAM",0,"utf8");b.writeUInt8(d.protocolVersion,3);b.writeUInt8(1,4);b.writeUInt16BE(d.sequence,5);b.writeUInt8(0,7);d.buffer.push(b)}function encodeGlobalAttributes(d,b){for(const [e,a]of Object.entries(b)){b=constants_1.WEB_GLOBALS.find(f=>(null===f||void 0===f?void 0:f.name)===e).id;let c=a;"boolean"===typeof c&&(c=c?1:0);d.buffer.push(serializeData(b,c,constants_1.FLAG_GLOBAL))}}
3
+ function encodeEvents(d){for(const [b,{props:e,globals:a}]of d.events.map(c=>Object.entries(c)[0])){encodeGlobalAttributes(d,a);const c=constants_1.WEB_EVENTS.find(g=>g.name===b),f=Object.entries(e);let h=!1;for(const [,g]of f)h||=null!==g;d.buffer.push(serializeData(c.id,-c.weight,h?constants_1.FLAG_EVENT:constants_1.FLAG_EVENT|constants_1.FLAG_EXTENDED));for(let g=0;g<f.length;g++){const [l,m]=f[g],n=c.props[l][0];h=g<f.length-1;let k=m;"boolean"===typeof k&&(k=k?1:0);d.buffer.push(serializeData(n,
4
+ k,h?constants_1.FLAG_EVENT:constants_1.FLAG_FIELD|constants_1.FLAG_EXTENDED))}}}
5
+ function serializeData(d,b,e){var a=getHeaderBitLength(d);let c=0;if(null===b){if(e===constants_1.FLAG_GLOBAL)return a=Buffer.alloc(a),serializeHeader(a,c,d,e),a}else{if("number"===typeof b&&Number.isInteger(b))return 0===b||1===b?(a=Buffer.alloc(a),serializeHeader(a,c,d,e|b+1<<4)):-128<=b&&128>b?(a=Buffer.alloc(a+1),c=serializeHeader(a,c,d,e|48),a.writeInt8(b,c)):-32768<=b&&32768>b?(a=Buffer.alloc(a+2),c=serializeHeader(a,c,d,e|64),a.writeInt16LE(b,c)):-2147483648<=b&&2147483648>b?(a=Buffer.alloc(a+
6
+ 4),c=serializeHeader(a,c,d,e|80),a.writeInt32LE(b,c)):(a=Buffer.alloc(a+8),c=serializeHeader(a,c,d,e|112),a.writeDoubleLE(b,c)),a;if("number"===typeof b)return a=Buffer.alloc(a+8),c=serializeHeader(a,c,d,e|112),a.writeDoubleLE(b,c),a;if("string"===typeof b){const f=Buffer.byteLength(b,"utf8");256>f?(a=Buffer.alloc(a+1+f),c=serializeHeader(a,c,d,e|128),a.writeUint8(f,c++)):65536>f?(a=Buffer.alloc(a+2+f),c=serializeHeader(a,c,d,e|144),a.writeUInt16LE(f,c),c+=2):(a=Buffer.alloc(a+4+f),c=serializeHeader(a,
7
+ c,d,e|160),a.writeUInt32LE(f,c),c+=4);a.write(b,c,"utf8");return a}}throw"missing";}function serializeHeader(d,b,e,a){256>e?(d.writeUInt8(a,b),b+=1,d.writeUInt8(e,b),b+=1):(d.writeUInt8(a|constants_1.FLAG_BYTE,b),b+=1,d.writeUInt16LE(e,b),b+=2);return b};
@@ -0,0 +1,3 @@
1
+ export * from './constants';
2
+ export * from './encode';
3
+ export * from './BinaryInfo';
@@ -0,0 +1,2 @@
1
+ var __createBinding=this&&this.__createBinding||(Object.create?function(d,b,a,c){void 0===c&&(c=a);var e=Object.getOwnPropertyDescriptor(b,a);if(!e||("get"in e?!b.__esModule:e.writable||e.configurable))e={enumerable:!0,get:function(){return b[a]}};Object.defineProperty(d,c,e)}:function(d,b,a,c){void 0===c&&(c=a);d[c]=b[a]}),__exportStar=this&&this.__exportStar||function(d,b){for(var a in d)"default"===a||Object.prototype.hasOwnProperty.call(b,a)||__createBinding(b,d,a)};
2
+ Object.defineProperty(exports,"__esModule",{value:!0});__exportStar(require("./constants"),exports);__exportStar(require("./encode"),exports);__exportStar(require("./BinaryInfo"),exports);
@@ -0,0 +1,9 @@
1
+ import { USyncQueryProtocol } from '../../Types/USync';
2
+ import { BinaryNode } from '../../WABinary';
3
+ import { USyncUser } from '../USyncUser';
4
+ export declare class USyncContactProtocol implements USyncQueryProtocol {
5
+ name: string;
6
+ getQueryElement(): BinaryNode;
7
+ getUserElement(user: USyncUser): BinaryNode;
8
+ parser(node: BinaryNode): boolean;
9
+ }
@@ -0,0 +1,2 @@
1
+ Object.defineProperty(exports,"__esModule",{value:!0});exports.USyncContactProtocol=void 0;const WABinary_1=require("../../WABinary");class USyncContactProtocol{constructor(){this.name="contact"}getQueryElement(){return{tag:"contact",attrs:{}}}getUserElement(a){return{tag:"contact",attrs:{},content:a.phone}}parser(a){var b;return"contact"===a.tag?((0,WABinary_1.assertNodeErrorFree)(a),"in"===(null===(b=null===a||void 0===a?void 0:a.attrs)||void 0===b?void 0:b.type)):!1}}
2
+ exports.USyncContactProtocol=USyncContactProtocol;
@@ -0,0 +1,22 @@
1
+ import { USyncQueryProtocol } from '../../Types/USync';
2
+ import { BinaryNode } from '../../WABinary';
3
+ export type KeyIndexData = {
4
+ timestamp: number;
5
+ signedKeyIndex?: Uint8Array;
6
+ expectedTimestamp?: number;
7
+ };
8
+ export type DeviceListData = {
9
+ id: number;
10
+ keyIndex?: number;
11
+ isHosted?: boolean;
12
+ };
13
+ export type ParsedDeviceInfo = {
14
+ deviceList?: DeviceListData[];
15
+ keyIndex?: KeyIndexData;
16
+ };
17
+ export declare class USyncDeviceProtocol implements USyncQueryProtocol {
18
+ name: string;
19
+ getQueryElement(): BinaryNode;
20
+ getUserElement(): BinaryNode | null;
21
+ parser(node: BinaryNode): ParsedDeviceInfo;
22
+ }
@@ -0,0 +1,3 @@
1
+ Object.defineProperty(exports,"__esModule",{value:!0});exports.USyncDeviceProtocol=void 0;const WABinary_1=require("../../WABinary");
2
+ class USyncDeviceProtocol{constructor(){this.name="devices"}getQueryElement(){return{tag:"devices",attrs:{version:"2"}}}getUserElement(){return null}parser(a){const d=[];let e=void 0;if("devices"===a.tag){(0,WABinary_1.assertNodeErrorFree)(a);var b=(0,WABinary_1.getBinaryNodeChild)(a,"device-list");a=(0,WABinary_1.getBinaryNodeChild)(a,"key-index-list");if(Array.isArray(null===b||void 0===b?void 0:b.content))for(const {tag:f,attrs:c}of b.content){b=+c.id;const g=+c["key-index"];"device"===f&&d.push({id:b,
3
+ keyIndex:g,isHosted:!(!c.is_hosted||"true"!==c.is_hosted)})}"key-index-list"===(null===a||void 0===a?void 0:a.tag)&&(e={timestamp:+a.attrs.ts,signedKeyIndex:null===a||void 0===a?void 0:a.content,expectedTimestamp:a.attrs.expected_ts?+a.attrs.expected_ts:void 0})}return{deviceList:d,keyIndex:e}}}exports.USyncDeviceProtocol=USyncDeviceProtocol;
@@ -0,0 +1,12 @@
1
+ import { USyncQueryProtocol } from '../../Types/USync';
2
+ import { BinaryNode } from '../../WABinary';
3
+ export type DisappearingModeData = {
4
+ duration: number;
5
+ setAt?: Date;
6
+ };
7
+ export declare class USyncDisappearingModeProtocol implements USyncQueryProtocol {
8
+ name: string;
9
+ getQueryElement(): BinaryNode;
10
+ getUserElement(): null;
11
+ parser(node: BinaryNode): DisappearingModeData | undefined;
12
+ }
@@ -0,0 +1,2 @@
1
+ Object.defineProperty(exports,"__esModule",{value:!0});exports.USyncDisappearingModeProtocol=void 0;const WABinary_1=require("../../WABinary");
2
+ class USyncDisappearingModeProtocol{constructor(){this.name="disappearing_mode"}getQueryElement(){return{tag:"disappearing_mode",attrs:{}}}getUserElement(){return null}parser(a){if("status"===a.tag)return(0,WABinary_1.assertNodeErrorFree)(a),{duration:+(null===a||void 0===a?NaN:a.attrs.duration),setAt:new Date(1E3*+((null===a||void 0===a?void 0:a.attrs.t)||0))}}}exports.USyncDisappearingModeProtocol=USyncDisappearingModeProtocol;
@@ -0,0 +1,12 @@
1
+ import { USyncQueryProtocol } from '../../Types/USync';
2
+ import { BinaryNode } from '../../WABinary';
3
+ export type StatusData = {
4
+ status?: string | null;
5
+ setAt?: Date;
6
+ };
7
+ export declare class USyncStatusProtocol implements USyncQueryProtocol {
8
+ name: string;
9
+ getQueryElement(): BinaryNode;
10
+ getUserElement(): null;
11
+ parser(node: BinaryNode): StatusData | undefined;
12
+ }
@@ -0,0 +1,2 @@
1
+ Object.defineProperty(exports,"__esModule",{value:!0});exports.USyncStatusProtocol=void 0;const WABinary_1=require("../../WABinary");
2
+ class USyncStatusProtocol{constructor(){this.name="status"}getQueryElement(){return{tag:"status",attrs:{}}}getUserElement(){return null}parser(a){var c;if("status"===a.tag){(0,WABinary_1.assertNodeErrorFree)(a);let b=null===a||void 0===a?void 0:a.content.toString();const d=new Date(1E3*+((null===a||void 0===a?void 0:a.attrs.t)||0));b?"string"===typeof b&&0===b.length&&(b=null):b=401===+(null===(c=a.attrs)||void 0===c?NaN:c.code)?"":null;return{status:b,setAt:d}}}}exports.USyncStatusProtocol=USyncStatusProtocol;
@@ -0,0 +1,25 @@
1
+ import { USyncQueryProtocol } from '../../Types/USync';
2
+ import { BinaryNode } from '../../WABinary';
3
+ import { USyncUser } from '../USyncUser';
4
+ export type BotProfileCommand = {
5
+ name: string;
6
+ description: string;
7
+ };
8
+ export type BotProfileInfo = {
9
+ jid: string;
10
+ name: string;
11
+ attributes: string;
12
+ description: string;
13
+ category: string;
14
+ isDefault: boolean;
15
+ prompts: string[];
16
+ personaId: string;
17
+ commands: BotProfileCommand[];
18
+ commandsDescription: string;
19
+ };
20
+ export declare class USyncBotProfileProtocol implements USyncQueryProtocol {
21
+ name: string;
22
+ getQueryElement(): BinaryNode;
23
+ getUserElement(user: USyncUser): BinaryNode;
24
+ parser(node: BinaryNode): BotProfileInfo;
25
+ }
@@ -0,0 +1,4 @@
1
+ Object.defineProperty(exports,"__esModule",{value:!0});exports.USyncBotProfileProtocol=void 0;const WABinary_1=require("../../WABinary");
2
+ class USyncBotProfileProtocol{constructor(){this.name="bot"}getQueryElement(){return{tag:"bot",attrs:{},content:[{tag:"profile",attrs:{v:"1"}}]}}getUserElement(c){return{tag:"bot",attrs:{},content:[{tag:"profile",attrs:{persona_id:c.personaId}}]}}parser(c){var a=(0,WABinary_1.getBinaryNodeChild)(c,"bot");a=(0,WABinary_1.getBinaryNodeChild)(a,"profile");const d=(0,WABinary_1.getBinaryNodeChild)(a,"commands"),g=(0,WABinary_1.getBinaryNodeChild)(a,"prompts"),e=[],f=[];for(const b of(0,WABinary_1.getBinaryNodeChildren)(d,
3
+ "command"))e.push({name:(0,WABinary_1.getBinaryNodeChildString)(b,"name"),description:(0,WABinary_1.getBinaryNodeChildString)(b,"description")});for(const b of(0,WABinary_1.getBinaryNodeChildren)(g,"prompt"))f.push(`${(0,WABinary_1.getBinaryNodeChildString)(b,"emoji")} ${(0,WABinary_1.getBinaryNodeChildString)(b,"text")}`);return{isDefault:!!(0,WABinary_1.getBinaryNodeChild)(a,"default"),jid:c.attrs.jid,name:(0,WABinary_1.getBinaryNodeChildString)(a,"name"),attributes:(0,WABinary_1.getBinaryNodeChildString)(a,
4
+ "attributes"),description:(0,WABinary_1.getBinaryNodeChildString)(a,"description"),category:(0,WABinary_1.getBinaryNodeChildString)(a,"category"),personaId:a.attrs.persona_id,commandsDescription:(0,WABinary_1.getBinaryNodeChildString)(d,"description"),commands:e,prompts:f}}}exports.USyncBotProfileProtocol=USyncBotProfileProtocol;
@@ -0,0 +1,8 @@
1
+ import { USyncQueryProtocol } from '../../Types/USync';
2
+ import { BinaryNode } from '../../WABinary';
3
+ export declare class USyncLIDProtocol implements USyncQueryProtocol {
4
+ name: string;
5
+ getQueryElement(): BinaryNode;
6
+ getUserElement(): null;
7
+ parser(node: BinaryNode): string | null;
8
+ }
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,"__esModule",{value:!0});exports.USyncLIDProtocol=void 0;class USyncLIDProtocol{constructor(){this.name="lid"}getQueryElement(){return{tag:"lid",attrs:{}}}getUserElement(){return null}parser(a){return"lid"===a.tag?a.attrs.val:null}}exports.USyncLIDProtocol=USyncLIDProtocol;
@@ -0,0 +1,4 @@
1
+ export * from './USyncDeviceProtocol';
2
+ export * from './USyncContactProtocol';
3
+ export * from './USyncStatusProtocol';
4
+ export * from './USyncDisappearingModeProtocol';
@@ -0,0 +1,2 @@
1
+ var __createBinding=this&&this.__createBinding||(Object.create?function(d,b,a,c){void 0===c&&(c=a);var e=Object.getOwnPropertyDescriptor(b,a);if(!e||("get"in e?!b.__esModule:e.writable||e.configurable))e={enumerable:!0,get:function(){return b[a]}};Object.defineProperty(d,c,e)}:function(d,b,a,c){void 0===c&&(c=a);d[c]=b[a]}),__exportStar=this&&this.__exportStar||function(d,b){for(var a in d)"default"===a||Object.prototype.hasOwnProperty.call(b,a)||__createBinding(b,d,a)};
2
+ Object.defineProperty(exports,"__esModule",{value:!0});__exportStar(require("./USyncDeviceProtocol"),exports);__exportStar(require("./USyncContactProtocol"),exports);__exportStar(require("./USyncStatusProtocol"),exports);__exportStar(require("./USyncDisappearingModeProtocol"),exports);
@@ -0,0 +1,28 @@
1
+ import { USyncQueryProtocol } from '../Types/USync';
2
+ import { BinaryNode } from '../WABinary';
3
+ import { USyncUser } from './USyncUser';
4
+ export type USyncQueryResultList = {
5
+ [protocol: string]: unknown;
6
+ id: string;
7
+ };
8
+ export type USyncQueryResult = {
9
+ list: USyncQueryResultList[];
10
+ sideList: USyncQueryResultList[];
11
+ };
12
+ export declare class USyncQuery {
13
+ protocols: USyncQueryProtocol[];
14
+ users: USyncUser[];
15
+ context: string;
16
+ mode: string;
17
+ constructor();
18
+ withMode(mode: string): this;
19
+ withContext(context: string): this;
20
+ withUser(user: USyncUser): this;
21
+ parseUSyncQueryResult(result: BinaryNode): USyncQueryResult | undefined;
22
+ withDeviceProtocol(): this;
23
+ withContactProtocol(): this;
24
+ withStatusProtocol(): this;
25
+ withDisappearingModeProtocol(): this;
26
+ withBotProfileProtocol(): this;
27
+ withLIDProtocol(): this;
28
+ }
@@ -0,0 +1,4 @@
1
+ Object.defineProperty(exports,"__esModule",{value:!0});exports.USyncQuery=void 0;const WABinary_1=require("../WABinary"),UsyncBotProfileProtocol_1=require("./Protocols/UsyncBotProfileProtocol"),UsyncLIDProtocol_1=require("./Protocols/UsyncLIDProtocol"),Protocols_1=require("./Protocols");
2
+ class USyncQuery{constructor(){this.protocols=[];this.users=[];this.context="interactive";this.mode="query"}withMode(a){this.mode=a;return this}withContext(a){this.context=a;return this}withUser(a){this.users.push(a);return this}parseUSyncQueryResult(a){if("result"===a.attrs.type){var g=Object.fromEntries(this.protocols.map(b=>[b.name,b.parser])),e={list:[],sideList:[]};a=(0,WABinary_1.getBinaryNodeChild)(a,"usync");a=(0,WABinary_1.getBinaryNodeChild)(a,"list");Array.isArray(null===a||void 0===a?
3
+ void 0:a.content)&&"undefined"!==typeof a&&(e.list=a.content.map(b=>{const h=null===b||void 0===b?void 0:b.attrs.jid;return{...(Array.isArray(null===b||void 0===b?void 0:b.content)?Object.fromEntries(b.content.map(c=>{const d=c.tag,f=g[d];return f?[d,f(c)]:[d,null]}).filter(([,c])=>null!==c)):{}),id:h}}));return e}}withDeviceProtocol(){this.protocols.push(new Protocols_1.USyncDeviceProtocol);return this}withContactProtocol(){this.protocols.push(new Protocols_1.USyncContactProtocol);return this}withStatusProtocol(){this.protocols.push(new Protocols_1.USyncStatusProtocol);
4
+ return this}withDisappearingModeProtocol(){this.protocols.push(new Protocols_1.USyncDisappearingModeProtocol);return this}withBotProfileProtocol(){this.protocols.push(new UsyncBotProfileProtocol_1.USyncBotProfileProtocol);return this}withLIDProtocol(){this.protocols.push(new UsyncLIDProtocol_1.USyncLIDProtocol);return this}}exports.USyncQuery=USyncQuery;
@@ -0,0 +1,12 @@
1
+ export declare class USyncUser {
2
+ id: string;
3
+ lid: string;
4
+ phone: string;
5
+ type: string;
6
+ personaId: string;
7
+ withId(id: string): this;
8
+ withLid(lid: string): this;
9
+ withPhone(phone: string): this;
10
+ withType(type: string): this;
11
+ withPersonaId(personaId: string): this;
12
+ }
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,"__esModule",{value:!0});exports.USyncUser=void 0;class USyncUser{withId(a){this.id=a;return this}withLid(a){this.lid=a;return this}withPhone(a){this.phone=a;return this}withType(a){this.type=a;return this}withPersonaId(a){this.personaId=a;return this}}exports.USyncUser=USyncUser;
@@ -0,0 +1,3 @@
1
+ export * from './Protocols';
2
+ export * from './USyncQuery';
3
+ export * from './USyncUser';
@@ -0,0 +1,2 @@
1
+ var __createBinding=this&&this.__createBinding||(Object.create?function(d,b,a,c){void 0===c&&(c=a);var e=Object.getOwnPropertyDescriptor(b,a);if(!e||("get"in e?!b.__esModule:e.writable||e.configurable))e={enumerable:!0,get:function(){return b[a]}};Object.defineProperty(d,c,e)}:function(d,b,a,c){void 0===c&&(c=a);d[c]=b[a]}),__exportStar=this&&this.__exportStar||function(d,b){for(var a in d)"default"===a||Object.prototype.hasOwnProperty.call(b,a)||__createBinding(b,d,a)};
2
+ Object.defineProperty(exports,"__esModule",{value:!0});__exportStar(require("./Protocols"),exports);__exportStar(require("./USyncQuery"),exports);__exportStar(require("./USyncUser"),exports);
package/lib/index.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ import makeWASocket from './Socket';
2
+ export * from '../WAProto';
3
+ export * from './Utils';
4
+ export * from './Types';
5
+ export * from './Defaults';
6
+ export * from './WABinary';
7
+ export * from './WAM';
8
+ export * from './WAUSync';
9
+ export type WASocket = ReturnType<typeof makeWASocket>;
10
+ export { makeWASocket };
11
+ export default makeWASocket;
package/lib/index.js ADDED
@@ -0,0 +1,3 @@
1
+ var __createBinding=this&&this.__createBinding||(Object.create?function(a,c,b,d){void 0===d&&(d=b);var e=Object.getOwnPropertyDescriptor(c,b);if(!e||("get"in e?!c.__esModule:e.writable||e.configurable))e={enumerable:!0,get:function(){return c[b]}};Object.defineProperty(a,d,e)}:function(a,c,b,d){void 0===d&&(d=b);a[d]=c[b]}),__exportStar=this&&this.__exportStar||function(a,c){for(var b in a)"default"===b||Object.prototype.hasOwnProperty.call(c,b)||__createBinding(c,a,b)},__importDefault=this&&this.__importDefault||
2
+ function(a){return a&&a.__esModule?a:{"default":a}};Object.defineProperty(exports,"__esModule",{value:!0});exports.makeWASocket=void 0;const Socket_1=__importDefault(require("./Socket"));exports.makeWASocket=Socket_1.default;__exportStar(require("../WAProto"),exports);__exportStar(require("./Utils"),exports);__exportStar(require("./Types"),exports);__exportStar(require("./Defaults"),exports);__exportStar(require("./WABinary"),exports);__exportStar(require("./WAM"),exports);
3
+ __exportStar(require("./WAUSync"),exports);exports.default=Socket_1.default;
package/package.json CHANGED
@@ -1,6 +1,96 @@
1
1
  {
2
2
  "name": "@mamans2973/maman",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "description": "WhatsApp API x Button by PL",
5
+ "keywords": [
6
+ "whatsapp",
7
+ "automation"
8
+ ],
9
+ "homepage": "https://github.com/carnominocone-beep/Mamans-Baileys",
10
+ "repository": {
11
+ "url": "git+https://github.com/carnominocone-beep/Mamans-Baileys.git"
12
+ },
13
+ "license": "MIT",
14
+ "author": "Rajeh Taher",
15
+ "main": "lib/index.js",
16
+ "types": "lib/index.d.ts",
17
+ "files": [
18
+ "lib/*",
19
+ "WAProto/*.ts",
20
+ "WAProto/*.js",
21
+ "WASignalGroup/*.js",
22
+ "engine-requirements.js"
23
+ ],
24
+ "scripts": {
25
+ "build:all": "tsc && typedoc",
26
+ "build:docs": "typedoc",
27
+ "build:tsc": "tsc",
28
+ "changelog:last": "conventional-changelog -p angular -r 2",
29
+ "changelog:preview": "conventional-changelog -p angular -u",
30
+ "changelog:update": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
31
+ "example": "node --inspect -r ts-node/register Example/example.ts",
32
+ "gen:protobuf": "sh WAProto/GenerateStatics.sh",
33
+ "lint": "eslint src --ext .js,.ts",
34
+ "lint:fix": "yarn lint --fix",
35
+ "preinstall": "node ./engine-requirements.js",
36
+ "release": "release-it",
37
+ "test": "jest"
38
+ },
39
+ "dependencies": {
40
+ "@cacheable/node-cache": "^1.4.0",
41
+ "@hapi/boom": "^9.1.3",
42
+ "@whiskeysockets/eslint-config": "github:whiskeysockets/eslint-config",
43
+ "async-mutex": "^0.5.0",
44
+ "axios": "^1.6.0",
45
+ "crypto-js": "^4.2.0",
46
+ "libsignal": "github:WhiskeySockets/libsignal-node",
47
+ "lodash": "^4.17.21",
48
+ "music-metadata": "^7.12.3",
49
+ "pino": "^9.6",
50
+ "protobufjs": "^7.2.4",
51
+ "ws": "^8.13.0"
52
+ },
53
+ "devDependencies": {
54
+ "@types/jest": "^27.5.1",
55
+ "@types/node": "^16.0.0",
56
+ "@types/ws": "^8.0.0",
57
+ "conventional-changelog-cli": "^2.2.2",
58
+ "eslint": "^8.0.0",
59
+ "jest": "^27.0.6",
60
+ "jimp": "^0.16.1",
61
+ "json": "^11.0.0",
62
+ "link-preview-js": "^3.0.0",
63
+ "open": "^8.4.2",
64
+ "release-it": "^15.10.3",
65
+ "sharp": "^0.32.6",
66
+ "ts-jest": "^27.0.3",
67
+ "ts-node": "^10.8.1",
68
+ "typedoc": "^0.27.9",
69
+ "typedoc-plugin-markdown": "4.4.2",
70
+ "typescript": "^5.8.2"
71
+ },
72
+ "peerDependencies": {
73
+ "audio-decode": "^2.1.3",
74
+ "jimp": "^0.16.1",
75
+ "link-preview-js": "^3.0.0",
76
+ "sharp": "^0.32.6"
77
+ },
78
+ "peerDependenciesMeta": {
79
+ "audio-decode": {
80
+ "optional": true
81
+ },
82
+ "jimp": {
83
+ "optional": true
84
+ },
85
+ "link-preview-js": {
86
+ "optional": true
87
+ },
88
+ "sharp": {
89
+ "optional": true
90
+ }
91
+ },
92
+ "packageManager": "yarn@1.22.19",
93
+ "engines": {
94
+ "node": ">=20.0.0"
95
+ }
96
+ }