sanka-baileyss 2.3.2 → 2.3.4

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 (159) hide show
  1. package/WAProto/BotMetadata/BotMetadata.d.ts +594 -1
  2. package/WAProto/BotMetadata/BotMetadata.js +1910 -148
  3. package/WAProto/BotMetadata/BotMetadata.proto +36 -0
  4. package/WAProto/E2E/E2E.d.ts +570 -6
  5. package/WAProto/E2E/E2E.js +1591 -26
  6. package/WAProto/E2E/E2E.proto +10 -1
  7. package/WAProto/HistorySync/HistorySync.d.ts +806 -6
  8. package/WAProto/HistorySync/HistorySync.js +2193 -29
  9. package/WAProto/HistorySync/HistorySync.proto +2 -1
  10. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.d.ts +570 -6
  11. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.js +1591 -26
  12. package/WAProto/StatusAttributions/StatusAttributions.d.ts +2 -1
  13. package/WAProto/StatusAttributions/StatusAttributions.js +7 -0
  14. package/WAProto/StatusAttributions/StatusAttributions.proto +1 -0
  15. package/WAProto/SyncAction/SyncAction.d.ts +230 -0
  16. package/WAProto/SyncAction/SyncAction.js +578 -2
  17. package/WAProto/SyncAction/SyncAction.proto +13 -1
  18. package/WAProto/Web/Web.d.ts +570 -6
  19. package/WAProto/Web/Web.js +1591 -26
  20. package/lib/Defaults/baileys-version.json +2 -2
  21. package/lib/Defaults/index.d.ts +42 -25
  22. package/lib/Defaults/index.js +6 -2
  23. package/lib/Signal/Group/sender-key-record.js +23 -28
  24. package/lib/Signal/libsignal.d.ts +1 -0
  25. package/lib/Socket/Client/index.js +13 -9
  26. package/lib/Socket/Client/types.d.ts +11 -10
  27. package/lib/Socket/Client/types.js +11 -7
  28. package/lib/Socket/Client/websocket.d.ts +9 -8
  29. package/lib/Socket/Client/websocket.js +52 -47
  30. package/lib/Socket/business.d.ts +185 -182
  31. package/lib/Socket/business.js +258 -249
  32. package/lib/Socket/chats.d.ts +90 -87
  33. package/lib/Socket/chats.js +1095 -888
  34. package/lib/Socket/community.d.ts +131 -0
  35. package/lib/Socket/community.js +369 -0
  36. package/lib/Socket/groups.d.ts +50 -41
  37. package/lib/Socket/groups.js +10 -3
  38. package/lib/Socket/index.d.ts +5 -1
  39. package/lib/Socket/index.js +19 -5
  40. package/lib/Socket/messages-recv.d.ts +6 -2
  41. package/lib/Socket/messages-recv.js +31 -8
  42. package/lib/Socket/messages-send.d.ts +5 -1
  43. package/lib/Socket/messages-send.js +1293 -1351
  44. package/lib/Socket/newsletter.d.ts +142 -135
  45. package/lib/Socket/newsletter.js +274 -230
  46. package/lib/Socket/socket.d.ts +37 -35
  47. package/lib/Socket/usync.d.ts +31 -30
  48. package/lib/Socket/usync.js +74 -62
  49. package/lib/Types/Auth.d.ts +89 -72
  50. package/lib/Types/Auth.js +1 -0
  51. package/lib/Types/Call.d.ts +11 -10
  52. package/lib/Types/Call.js +1 -0
  53. package/lib/Types/Chat.d.ts +85 -62
  54. package/lib/Types/Chat.js +4 -1
  55. package/lib/Types/Contact.js +1 -0
  56. package/lib/Types/Events.d.ts +209 -191
  57. package/lib/Types/Events.js +1 -0
  58. package/lib/Types/GroupMetadata.d.ts +12 -27
  59. package/lib/Types/GroupMetadata.js +1 -0
  60. package/lib/Types/Label.d.ts +41 -39
  61. package/lib/Types/Label.js +24 -21
  62. package/lib/Types/LabelAssociation.d.ts +18 -12
  63. package/lib/Types/LabelAssociation.js +6 -3
  64. package/lib/Types/Message.d.ts +3 -2
  65. package/lib/Types/Message.js +7 -3
  66. package/lib/Types/MexUpdates.d.ts +9 -0
  67. package/lib/Types/MexUpdates.js +18 -0
  68. package/lib/Types/Newsletter.d.ts +84 -67
  69. package/lib/Types/Newsletter.js +30 -23
  70. package/lib/Types/Product.d.ts +70 -56
  71. package/lib/Types/Product.js +1 -0
  72. package/lib/Types/Signal.d.ts +46 -35
  73. package/lib/Types/Signal.js +1 -0
  74. package/lib/Types/Socket.d.ts +105 -101
  75. package/lib/Types/Socket.js +1 -0
  76. package/lib/Types/State.d.ts +37 -23
  77. package/lib/Types/State.js +13 -1
  78. package/lib/Types/USync.d.ts +21 -20
  79. package/lib/Types/USync.js +1 -0
  80. package/lib/Types/index.d.ts +51 -42
  81. package/lib/Types/index.js +25 -19
  82. package/lib/Utils/auth-utils.d.ts +14 -11
  83. package/lib/Utils/auth-utils.js +189 -182
  84. package/lib/Utils/baileys-event-stream.d.ts +12 -10
  85. package/lib/Utils/baileys-event-stream.js +52 -46
  86. package/lib/Utils/business.d.ts +15 -8
  87. package/lib/Utils/business.js +229 -217
  88. package/lib/Utils/chat-utils.d.ts +22 -12
  89. package/lib/Utils/chat-utils.js +57 -27
  90. package/lib/Utils/crypto.d.ts +31 -15
  91. package/lib/Utils/crypto.js +136 -107
  92. package/lib/Utils/decode-wa-message.d.ts +34 -245
  93. package/lib/Utils/decode-wa-message.js +205 -217
  94. package/lib/Utils/event-buffer.d.ts +30 -26
  95. package/lib/Utils/event-buffer.js +519 -515
  96. package/lib/Utils/history.d.ts +2 -8
  97. package/lib/Utils/index.js +13 -9
  98. package/lib/Utils/link-preview.d.ts +16 -14
  99. package/lib/Utils/link-preview.js +100 -92
  100. package/lib/Utils/logger.d.ts +9 -7
  101. package/lib/Utils/logger.js +1 -1
  102. package/lib/Utils/lt-hash.d.ts +10 -8
  103. package/lib/Utils/lt-hash.js +49 -44
  104. package/lib/Utils/make-mutex.d.ts +4 -2
  105. package/lib/Utils/make-mutex.js +43 -39
  106. package/lib/Utils/messages-media.d.ts +75 -50
  107. package/lib/Utils/messages.d.ts +60 -35
  108. package/lib/Utils/messages.js +87 -8
  109. package/lib/Utils/noise-handler.d.ts +13 -12
  110. package/lib/Utils/noise-handler.js +143 -138
  111. package/lib/Utils/process-message.d.ts +32 -24
  112. package/lib/Utils/process-message.js +387 -367
  113. package/lib/Utils/signal.d.ts +24 -15
  114. package/lib/Utils/signal.js +143 -131
  115. package/lib/Utils/use-mongo-file-auth-state.d.ts +3 -2
  116. package/lib/Utils/use-mongo-file-auth-state.js +72 -63
  117. package/lib/Utils/use-multi-file-auth-state.d.ts +9 -8
  118. package/lib/Utils/use-multi-file-auth-state.js +110 -102
  119. package/lib/Utils/use-single-file-auth-state.d.ts +8 -7
  120. package/lib/Utils/use-single-file-auth-state.js +66 -61
  121. package/lib/Utils/validate-connection.d.ts +5 -2
  122. package/lib/Utils/validate-connection.js +7 -6
  123. package/lib/WABinary/constants.d.ts +24 -21
  124. package/lib/WABinary/constants.js +1302 -31
  125. package/lib/WABinary/decode.d.ts +4 -1
  126. package/lib/WABinary/decode.js +267 -234
  127. package/lib/WABinary/encode.d.ts +1 -0
  128. package/lib/WABinary/encode.js +248 -226
  129. package/lib/WABinary/generic-utils.d.ts +13 -1
  130. package/lib/WABinary/generic-utils.js +113 -96
  131. package/lib/WABinary/index.js +13 -9
  132. package/lib/WABinary/jid-utils.d.ts +23 -4
  133. package/lib/WABinary/jid-utils.js +58 -39
  134. package/lib/WABinary/types.d.ts +15 -11
  135. package/lib/WABinary/types.js +1 -0
  136. package/lib/WAM/BinaryInfo.d.ts +14 -14
  137. package/lib/WAM/BinaryInfo.js +11 -8
  138. package/lib/WAM/constants.d.ts +34 -26
  139. package/lib/WAM/constants.js +15358 -15349
  140. package/lib/WAM/encode.d.ts +1 -0
  141. package/lib/WAM/encode.js +153 -144
  142. package/lib/WAM/index.js +13 -9
  143. package/lib/index.js +11 -11
  144. package/package.json +1 -66
  145. package/WASignalGroup/GroupProtocol.js +0 -1771
  146. package/WASignalGroup/ciphertext_message.js +0 -10
  147. package/WASignalGroup/group_cipher.js +0 -103
  148. package/WASignalGroup/group_session_builder.js +0 -39
  149. package/WASignalGroup/index.js +0 -5
  150. package/WASignalGroup/keyhelper.js +0 -17
  151. package/WASignalGroup/protobufs.js +0 -2
  152. package/WASignalGroup/queue_job.js +0 -64
  153. package/WASignalGroup/sender_chain_key.js +0 -38
  154. package/WASignalGroup/sender_key_distribution_message.js +0 -68
  155. package/WASignalGroup/sender_key_message.js +0 -79
  156. package/WASignalGroup/sender_key_name.js +0 -59
  157. package/WASignalGroup/sender_key_record.js +0 -47
  158. package/WASignalGroup/sender_key_state.js +0 -110
  159. package/WASignalGroup/sender_message_key.js +0 -30
@@ -7,110 +7,114 @@ import { AuthenticationState, SignalAuthState, TransactionCapabilityOptions } fr
7
7
  import { GroupMetadata } from './GroupMetadata'
8
8
  import { MediaConnInfo } from './Message'
9
9
  import { SignalRepository } from './Signal'
10
+
10
11
  export type WAVersion = [number, number, number]
12
+
11
13
  export type WABrowserDescription = [string, string, string]
14
+
12
15
  export type CacheStore = {
13
- /** get a cached key and change the stats */
14
- get<T>(key: string): T | undefined
15
- /** set a key in the cache */
16
- set<T>(key: string, value: T): void
17
- /** delete a key from the cache */
18
- del(key: string): void
19
- /** flush all data */
20
- flushAll(): void
16
+ /** get a cached key and change the stats */
17
+ get<T>(key: string): T | undefined
18
+ /** set a key in the cache */
19
+ set<T>(key: string, value: T): void
20
+ /** delete a key from the cache */
21
+ del(key: string): void
22
+ /** flush all data */
23
+ flushAll(): void
21
24
  }
25
+
22
26
  export type SocketConfig = {
23
- /** the WS url to connect to WA */
24
- waWebSocketUrl: string | URL
25
- /** Fails the connection if the socket times out in this interval */
26
- connectTimeoutMs: number
27
- /** Default timeout for queries, undefined for no timeout */
28
- defaultQueryTimeoutMs: number | undefined
29
- /** ping-pong interval for WS connection */
30
- keepAliveIntervalMs: number
31
- /** should baileys use the mobile api instead of the multi device api
32
- * @deprecated This feature has been removed
33
- */
34
- mobile?: boolean
35
- /** proxy agent */
36
- agent?: Agent
37
- /** logger */
38
- logger: ILogger
39
- /** version to connect with */
40
- version: WAVersion
41
- /** override browser config */
42
- browser: WABrowserDescription
43
- /** agent used for fetch requests -- uploading/downloading media */
44
- fetchAgent?: Agent
45
- /** should the QR be printed in the terminal */
46
- printQRInTerminal: boolean
47
- /** should events be emitted for actions done by this socket connection */
48
- emitOwnEvents: boolean
49
- /** custom upload hosts to upload media to */
50
- customUploadHosts: MediaConnInfo['hosts']
51
- /** time to wait between sending new retry requests */
52
- retryRequestDelayMs: number
53
- /** max retry count */
54
- maxMsgRetryCount: number
55
- /** time to wait for the generation of the next QR in ms */
56
- qrTimeout?: number
57
- /** provide an auth state object to maintain the auth state */
58
- auth: AuthenticationState
59
- /** manage history processing with this control by default will sync up everything */
60
- shouldSyncHistoryMessage: (msg: proto.Message.IHistorySyncNotification) => boolean
61
- /** transaction capability options for SignalKeyStore */
62
- transactionOpts: TransactionCapabilityOptions
63
- /** marks the client as online whenever the socket successfully connects */
64
- markOnlineOnConnect: boolean
65
- /** alphanumeric country code (USA -> US) for the number used */
66
- countryCode: string
67
- /** provide a cache to store media, so does not have to be re-uploaded */
68
- mediaCache?: CacheStore
69
- /**
70
- * map to store the retry counts for failed messages
71
- * used to determine whether to retry a message or not */
72
- msgRetryCounterCache?: CacheStore
73
- /** provide a cache to store a user's device list */
74
- userDevicesCache?: CacheStore
75
- /** cache to store call offers */
76
- callOfferCache?: CacheStore
77
- /** cache to track placeholder resends */
78
- placeholderResendCache?: CacheStore
79
- /** width for link preview images */
80
- linkPreviewImageThumbnailWidth: number
81
- /** Should Baileys ask the phone for full history, will be received async */
82
- syncFullHistory: boolean
83
- /** Should baileys fire init queries automatically, default true */
84
- fireInitQueries: boolean
85
- /**
86
- * generate a high quality link preview,
87
- * entails uploading the jpegThumbnail to WA
88
- * */
89
- generateHighQualityLinkPreview: boolean
90
- /**
91
- * Returns if a jid should be ignored,
92
- * no event for that jid will be triggered.
93
- * Messages from that jid will also not be decrypted
94
- * */
95
- shouldIgnoreJid: (jid: string) => boolean | undefined
96
- /**
97
- * Optionally patch the message before sending out
98
- * */
99
- patchMessageBeforeSending: (msg: proto.IMessage, recipientJids: string[]) => Promise<proto.IMessage> | proto.IMessage
100
- /** verify app state MACs */
101
- appStateMacVerification: {
102
- patch: boolean
103
- snapshot: boolean
104
- }
105
- /** options for axios */
106
- options: AxiosRequestConfig<{}>
107
- /**
108
- * fetch a message from your store
109
- * implement this so that messages failed to send
110
- * (solves the "this message can take a while" issue) can be retried
111
- * */
112
- getMessage: (key: proto.IMessageKey) => Promise<proto.IMessage | undefined>
113
- /** cached group metadata, use to prevent redundant requests to WA & speed up msg sending */
114
- cachedGroupMetadata: (jid: string) => Promise<GroupMetadata | undefined>
115
- makeSignalRepository: (auth: SignalAuthState) => SignalRepository
27
+ /** the WS url to connect to WA */
28
+ waWebSocketUrl: string | URL
29
+ /** Fails the connection if the socket times out in this interval */
30
+ connectTimeoutMs: number
31
+ /** Default timeout for queries, undefined for no timeout */
32
+ defaultQueryTimeoutMs: number | undefined
33
+ /** ping-pong interval for WS connection */
34
+ keepAliveIntervalMs: number
35
+ /** should baileys use the mobile api instead of the multi device api
36
+ * @deprecated This feature has been removed
37
+ */
38
+ mobile?: boolean
39
+ /** proxy agent */
40
+ agent?: Agent
41
+ /** logger */
42
+ logger: ILogger
43
+ /** version to connect with */
44
+ version: WAVersion
45
+ /** override browser config */
46
+ browser: WABrowserDescription
47
+ /** agent used for fetch requests -- uploading/downloading media */
48
+ fetchAgent?: Agent
49
+ /** should the QR be printed in the terminal */
50
+ printQRInTerminal: boolean
51
+ /** should events be emitted for actions done by this socket connection */
52
+ emitOwnEvents: boolean
53
+ /** custom upload hosts to upload media to */
54
+ customUploadHosts: MediaConnInfo['hosts']
55
+ /** time to wait between sending new retry requests */
56
+ retryRequestDelayMs: number
57
+ /** max retry count */
58
+ maxMsgRetryCount: number
59
+ /** time to wait for the generation of the next QR in ms */
60
+ qrTimeout?: number
61
+ /** provide an auth state object to maintain the auth state */
62
+ auth: AuthenticationState
63
+ /** manage history processing with this control by default will sync up everything */
64
+ shouldSyncHistoryMessage: (msg: proto.Message.IHistorySyncNotification) => boolean
65
+ /** transaction capability options for SignalKeyStore */
66
+ transactionOpts: TransactionCapabilityOptions
67
+ /** marks the client as online whenever the socket successfully connects */
68
+ markOnlineOnConnect: boolean
69
+ /** alphanumeric country code (USA -> US) for the number used */
70
+ countryCode: string
71
+ /** provide a cache to store media, so does not have to be re-uploaded */
72
+ mediaCache?: CacheStore
73
+ /**
74
+ * map to store the retry counts for failed messages
75
+ * used to determine whether to retry a message or not */
76
+ msgRetryCounterCache?: CacheStore
77
+ /** provide a cache to store a user's device list */
78
+ userDevicesCache?: CacheStore
79
+ /** cache to store call offers */
80
+ callOfferCache?: CacheStore
81
+ /** cache to track placeholder resends */
82
+ placeholderResendCache?: CacheStore
83
+ /** width for link preview images */
84
+ linkPreviewImageThumbnailWidth: number
85
+ /** Should Baileys ask the phone for full history, will be received async */
86
+ syncFullHistory: boolean
87
+ /** Should baileys fire init queries automatically, default true */
88
+ fireInitQueries: boolean
89
+ /**
90
+ * generate a high quality link preview,
91
+ * entails uploading the jpegThumbnail to WA
92
+ * */
93
+ generateHighQualityLinkPreview: boolean
94
+ /**
95
+ * Returns if a jid should be ignored,
96
+ * no event for that jid will be triggered.
97
+ * Messages from that jid will also not be decrypted
98
+ * */
99
+ shouldIgnoreJid: (jid: string) => boolean | undefined
100
+ /**
101
+ * Optionally patch the message before sending out
102
+ * */
103
+ patchMessageBeforeSending: (msg: proto.IMessage, recipientJids: string[]) => Promise<proto.IMessage> | proto.IMessage
104
+ /** verify app state MACs */
105
+ appStateMacVerification: {
106
+ patch: boolean
107
+ snapshot: boolean
108
+ }
109
+ /** options for axios */
110
+ options: AxiosRequestConfig<{}>
111
+ /**
112
+ * fetch a message from your store
113
+ * implement this so that messages failed to send
114
+ * (solves the "this message can take a while" issue) can be retried
115
+ * */
116
+ getMessage: (key: proto.IMessageKey) => Promise<proto.IMessage | undefined>
117
+ /** cached group metadata, use to prevent redundant requests to WA & speed up msg sending */
118
+ cachedGroupMetadata: (jid: string) => Promise<GroupMetadata | undefined>
119
+ makeSignalRepository: (auth: SignalAuthState) => SignalRepository
116
120
  }
@@ -1,2 +1,3 @@
1
1
  "use strict"
2
+
2
3
  Object.defineProperty(exports, "__esModule", { value: true })
@@ -1,27 +1,41 @@
1
+ import { Boom } from '@hapi/boom'
1
2
  import { Contact } from './Contact'
3
+
4
+ export declare const enum SyncState {
5
+ /** The socket is connecting, but we haven't received pending notifications yet. */
6
+ Connecting = 0,
7
+ /** Pending notifications received. Buffering events until we decide whether to sync or not. */
8
+ AwaitingInitialSync = 1,
9
+ /** The initial app state sync (history, etc.) is in progress. Buffering continues. */
10
+ Syncing = 2,
11
+ /** Initial sync is complete, or was skipped. The socket is fully operational and events are processed in real-time. */
12
+ Online = 3
13
+ }
14
+
2
15
  export type WAConnectionState = 'open' | 'connecting' | 'close'
16
+
3
17
  export type ConnectionState = {
4
- /** connection is now open, connecting or closed */
5
- connection: WAConnectionState
6
- /** the error that caused the connection to close */
7
- lastDisconnect?: {
8
- error: Error | undefined
9
- date: Date
10
- }
11
- /** is this a new login */
12
- isNewLogin?: boolean
13
- /** the current QR code */
14
- qr?: string
15
- /** has the device received all pending notifications while it was offline */
16
- receivedPendingNotifications?: boolean
17
- /** legacy connection options */
18
- legacy?: {
19
- phoneConnected: boolean
20
- user?: Contact
21
- }
22
- /**
23
- * if the client is shown as an active, online client.
24
- * If this is false, the primary phone and other devices will receive notifs
25
- * */
26
- isOnline?: boolean
18
+ /** connection is now open, connecting or closed */
19
+ connection: WAConnectionState
20
+ /** the error that caused the connection to close */
21
+ lastDisconnect?: {
22
+ error: Boom | Error | undefined
23
+ date: Date
24
+ }
25
+ /** is this a new login */
26
+ isNewLogin?: boolean
27
+ /** the current QR code */
28
+ qr?: string
29
+ /** has the device received all pending notifications while it was offline */
30
+ receivedPendingNotifications?: boolean
31
+ /** legacy connection options */
32
+ legacy?: {
33
+ phoneConnected: boolean
34
+ user?: Contact
35
+ }
36
+ /**
37
+ * if the client is shown as an active, online client.
38
+ * If this is false, the primary phone and other devices will receive notifs
39
+ * */
40
+ isOnline?: boolean
27
41
  }
@@ -1,2 +1,14 @@
1
1
  "use strict"
2
- Object.defineProperty(exports, "__esModule", { value: true })
2
+
3
+ Object.defineProperty(exports, "__esModule", { value: true })
4
+
5
+ const SyncState = {
6
+ Connecting: 0,
7
+ AwaitingInitialSync: 1,
8
+ Syncing: 2,
9
+ Online: 3
10
+ }
11
+
12
+ module.exports = {
13
+ SyncState
14
+ }
@@ -1,25 +1,26 @@
1
1
  import { BinaryNode } from '../WABinary'
2
2
  import { USyncUser } from '../WAUSync'
3
+
3
4
  /**
4
- * Defines the interface for a USyncQuery protocol
5
- */
5
+ * Defines the interface for a USyncQuery protocol
6
+ */
6
7
  export interface USyncQueryProtocol {
7
- /**
8
- * The name of the protocol
9
- */
10
- name: string
11
- /**
12
- * Defines what goes inside the query part of a USyncQuery
13
- */
14
- getQueryElement: () => BinaryNode
15
- /**
16
- * Defines what goes inside the user part of a USyncQuery
17
- */
18
- getUserElement: (user: USyncUser) => BinaryNode | null
19
- /**
20
- * Parse the result of the query
21
- * @param data Data from the result
22
- * @returns Whatever the protocol is supposed to return
23
- */
24
- parser: (data: BinaryNode) => unknown
8
+ /**
9
+ * The name of the protocol
10
+ */
11
+ name: string
12
+ /**
13
+ * Defines what goes inside the query part of a USyncQuery
14
+ */
15
+ getQueryElement: () => BinaryNode
16
+ /**
17
+ * Defines what goes inside the user part of a USyncQuery
18
+ */
19
+ getUserElement: (user: USyncUser) => BinaryNode | null
20
+ /**
21
+ * Parse the result of the query
22
+ * @param data Data from the result
23
+ * @returns Whatever the protocol is supposed to return
24
+ */
25
+ parser: (data: BinaryNode) => unknown
25
26
  }
@@ -1,2 +1,3 @@
1
1
  "use strict"
2
+
2
3
  Object.defineProperty(exports, "__esModule", { value: true })
@@ -3,6 +3,7 @@ export * from './GroupMetadata'
3
3
  export * from './Chat'
4
4
  export * from './Contact'
5
5
  export * from './State'
6
+ export * from './MexUpdates'
6
7
  export * from './Message'
7
8
  export * from './Newsletter'
8
9
  export * from './Socket'
@@ -10,61 +11,69 @@ export * from './Events'
10
11
  export * from './Product'
11
12
  export * from './Call'
12
13
  export * from './Signal'
14
+
13
15
  import { AuthenticationState } from './Auth'
14
16
  import { SocketConfig } from './Socket'
17
+
15
18
  export type UserFacingSocketConfig = Partial<SocketConfig> & {
16
- auth: AuthenticationState
19
+ auth: AuthenticationState
17
20
  }
21
+
18
22
  export type BrowsersMap = {
19
- ubuntu(browser: string): [string, string, string]
20
- macOS(browser: string): [string, string, string]
21
- windows(browser: string): [string, string, string]
22
- linux(browser: string): [string, string, string]
23
- android(browser: string): [string, string, string]
24
- iOS(browser: string): [string, string, string]
25
- baileys(browser: string): [string, string, string]
26
- kaiOS(browser: string): [string, string, string]
27
- chromeOS(browser: string): [string, string, string]
28
- appropriate(browser: string): [string, string, string]
29
- custom(platform: string, browser: string, version: string): [string, string, string]
23
+ ubuntu(browser: string): [string, string, string]
24
+ macOS(browser: string): [string, string, string]
25
+ windows(browser: string): [string, string, string]
26
+ linux(browser: string): [string, string, string]
27
+ android(browser: string): [string, string, string]
28
+ iOS(browser: string): [string, string, string]
29
+ baileys(browser: string): [string, string, string]
30
+ kaiOS(browser: string): [string, string, string]
31
+ chromeOS(browser: string): [string, string, string]
32
+ appropriate(browser: string): [string, string, string]
33
+ custom(platform: string, browser: string, version: string): [string, string, string]
30
34
  }
35
+
31
36
  export declare const enum DisconnectReason {
32
- connectionClosed = 428,
33
- connectionLost = 408,
34
- connectionReplaced = 440,
35
- timedOut = 408,
36
- loggedOut = 401,
37
- badSession = 500,
38
- restartRequired = 515,
39
- multideviceMismatch = 411,
40
- forbidden = 403,
41
- unavailableService = 503
37
+ connectionClosed = 428,
38
+ connectionLost = 408,
39
+ connectionReplaced = 440,
40
+ timedOut = 408,
41
+ loggedOut = 401,
42
+ badSession = 500,
43
+ restartRequired = 515,
44
+ multideviceMismatch = 411,
45
+ forbidden = 403,
46
+ unavailableService = 503
42
47
  }
48
+
43
49
  export type WAInitResponse = {
44
- ref: string
45
- ttl: number
46
- status: 200
50
+ ref: string
51
+ ttl: number
52
+ status: 200
47
53
  }
54
+
48
55
  export type WABusinessHoursConfig = {
49
- day_of_week: string
50
- mode: string
51
- open_time?: number
52
- close_time?: number
56
+ day_of_week: string
57
+ mode: string
58
+ open_time?: number
59
+ close_time?: number
53
60
  }
61
+
54
62
  export type WABusinessProfile = {
55
- description: string
56
- email: string | undefined
57
- business_hours: {
58
- timezone?: string
59
- config?: WABusinessHoursConfig[]
60
- business_config?: WABusinessHoursConfig[]
61
- }
62
- website: string[]
63
- category?: string
64
- wid?: string
65
- address?: string
63
+ description: string
64
+ email: string | undefined
65
+ business_hours: {
66
+ timezone?: string
67
+ config?: WABusinessHoursConfig[]
68
+ business_config?: WABusinessHoursConfig[]
69
+ }
70
+ website: string[]
71
+ category?: string
72
+ wid?: string
73
+ address?: string
66
74
  }
75
+
67
76
  export type CurveKeyPair = {
68
- private: Uint8Array
69
- public: Uint8Array
77
+ private: Uint8Array
78
+ public: Uint8Array
70
79
  }
@@ -1,25 +1,30 @@
1
1
  "use strict"
2
+
2
3
  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)
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)
9
10
  }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k
11
- o[k2] = m[k]
11
+ if (k2 === undefined) k2 = k
12
+ o[k2] = m[k]
12
13
  }))
14
+
13
15
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p)
16
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p)
15
17
  }
18
+
16
19
  Object.defineProperty(exports, "__esModule", { value: true })
20
+
17
21
  exports.DisconnectReason = void 0;
18
22
  __exportStar(require("./Auth"), exports)
19
23
  __exportStar(require("./GroupMetadata"), exports)
20
24
  __exportStar(require("./Chat"), exports)
21
25
  __exportStar(require("./Contact"), exports)
22
26
  __exportStar(require("./State"), exports)
27
+ __exportStar(require("./MexUpdates"), exports)
23
28
  __exportStar(require("./Message"), exports)
24
29
  __exportStar(require("./Newsletter"), exports)
25
30
  __exportStar(require("./Socket"), exports)
@@ -27,16 +32,17 @@ __exportStar(require("./Events"), exports)
27
32
  __exportStar(require("./Product"), exports)
28
33
  __exportStar(require("./Call"), exports)
29
34
  __exportStar(require("./Signal"), exports)
35
+
30
36
  const DisconnectReason = {
31
- connectionClosed: 428,
32
- connectionLost: 408,
33
- connectionReplaced: 440,
34
- timedOut: 408,
35
- loggedOut: 401,
36
- badSession: 500,
37
- restartRequired: 515,
38
- multideviceMismatch: 411,
39
- forbidden: 403,
40
- unavailableService: 503
37
+ connectionClosed: 428,
38
+ connectionLost: 408,
39
+ connectionReplaced: 440,
40
+ timedOut: 408,
41
+ loggedOut: 401,
42
+ badSession: 500,
43
+ restartRequired: 515,
44
+ multideviceMismatch: 411,
45
+ forbidden: 403,
46
+ unavailableService: 503
41
47
  }
42
48
  exports.DisconnectReason = DisconnectReason
@@ -1,18 +1,21 @@
1
1
  import type { AuthenticationCreds, CacheStore, SignalKeyStore, SignalKeyStoreWithTransaction, TransactionCapabilityOptions } from '../Types'
2
2
  import { ILogger } from './logger'
3
+
3
4
  /**
4
- * Adds caching capability to a SignalKeyStore
5
- * @param store the store to add caching to
6
- * @param logger to log trace events
7
- * @param _cache cache store to use
8
- */
5
+ * Adds caching capability to a SignalKeyStore
6
+ * @param store the store to add caching to
7
+ * @param logger to log trace events
8
+ * @param _cache cache store to use
9
+ */
9
10
  export declare function makeCacheableSignalKeyStore(store: SignalKeyStore, logger?: ILogger, _cache?: CacheStore): SignalKeyStore
11
+
10
12
  /**
11
- * Adds DB like transaction capability (https://en.wikipedia.org/wiki/Database_transaction) to the SignalKeyStore,
12
- * this allows batch read & write operations & improves the performance of the lib
13
- * @param state the key store to apply this capability to
14
- * @param logger logger to log events
15
- * @returns SignalKeyStore with transaction capability
16
- */
13
+ * Adds DB like transaction capability (https://en.wikipedia.org/wiki/Database_transaction) to the SignalKeyStore,
14
+ * this allows batch read & write operations & improves the performance of the lib
15
+ * @param state the key store to apply this capability to
16
+ * @param logger logger to log events
17
+ * @returns SignalKeyStore with transaction capability
18
+ */
17
19
  export declare const addTransactionCapability: (state: SignalKeyStore, logger?: ILogger, { maxCommitRetries, delayBetweenTriesMs }: TransactionCapabilityOptions) => SignalKeyStoreWithTransaction
20
+
18
21
  export declare const initAuthCreds: () => AuthenticationCreds