@hiroosy/baileys-lite 0.3.4 → 0.3.6

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 (229) hide show
  1. package/WAProto/index.js +231 -113252
  2. package/WAProto/parts/ADVDeviceIdentity.part +201 -0
  3. package/WAProto/parts/ADVEncryptionType.part +6 -0
  4. package/WAProto/parts/ADVKeyIndexList.part +201 -0
  5. package/WAProto/parts/ADVSignedDeviceIdentity.part +150 -0
  6. package/WAProto/parts/ADVSignedDeviceIdentityHMAC.part +142 -0
  7. package/WAProto/parts/ADVSignedKeyIndexList.part +128 -0
  8. package/WAProto/parts/AIHomeState.part +405 -0
  9. package/WAProto/parts/AIMediaCollectionMessage.part +119 -0
  10. package/WAProto/parts/AIMediaCollectionMetadata.part +100 -0
  11. package/WAProto/parts/AIMetadataOperation.part +83 -0
  12. package/WAProto/parts/AIQueryFanout.part +133 -0
  13. package/WAProto/parts/AIRegenerateMetadata.part +112 -0
  14. package/WAProto/parts/AIRichResponseCodeMetadata.part +252 -0
  15. package/WAProto/parts/AIRichResponseContentItemsMetadata.part +354 -0
  16. package/WAProto/parts/AIRichResponseDynamicMetadata.part +172 -0
  17. package/WAProto/parts/AIRichResponseGridImageMetadata.part +114 -0
  18. package/WAProto/parts/AIRichResponseImageURL.part +119 -0
  19. package/WAProto/parts/AIRichResponseInlineImageMetadata.part +164 -0
  20. package/WAProto/parts/AIRichResponseLatexMetadata.part +346 -0
  21. package/WAProto/parts/AIRichResponseMapMetadata.part +346 -0
  22. package/WAProto/parts/AIRichResponseMessage.part +167 -0
  23. package/WAProto/parts/AIRichResponseMessageType.part +5 -0
  24. package/WAProto/parts/AIRichResponseSubMessage.part +313 -0
  25. package/WAProto/parts/AIRichResponseSubMessageType.part +13 -0
  26. package/WAProto/parts/AIRichResponseTableMetadata.part +223 -0
  27. package/WAProto/parts/AIRichResponseUnifiedResponse.part +84 -0
  28. package/WAProto/parts/AISubscriptionRequestType.part +7 -0
  29. package/WAProto/parts/AISubscriptionUpsellMetadata.part +102 -0
  30. package/WAProto/parts/AIThreadInfo.part +316 -0
  31. package/WAProto/parts/Account.part +138 -0
  32. package/WAProto/parts/ActionLink.part +100 -0
  33. package/WAProto/parts/AutoDownloadSettings.part +138 -0
  34. package/WAProto/parts/AvatarUserSettings.part +100 -0
  35. package/WAProto/parts/BizAccountLinkInfo.part +210 -0
  36. package/WAProto/parts/BizAccountPayload.part +105 -0
  37. package/WAProto/parts/BizIdentityInfo.part +298 -0
  38. package/WAProto/parts/BotAgeCollectionMetadata.part +138 -0
  39. package/WAProto/parts/BotAgentDeepLinkMetadata.part +81 -0
  40. package/WAProto/parts/BotAgentMetadata.part +83 -0
  41. package/WAProto/parts/BotCapabilityMetadata.part +437 -0
  42. package/WAProto/parts/BotCommandMetadata.part +119 -0
  43. package/WAProto/parts/BotDocumentMessageMetadata.part +100 -0
  44. package/WAProto/parts/BotFeedbackMessage.part +1366 -0
  45. package/WAProto/parts/BotGroupMetadata.part +92 -0
  46. package/WAProto/parts/BotGroupParticipantMetadata.part +81 -0
  47. package/WAProto/parts/BotImagineMetadata.part +134 -0
  48. package/WAProto/parts/BotInfrastructureDiagnostics.part +148 -0
  49. package/WAProto/parts/BotLinkedAccount.part +95 -0
  50. package/WAProto/parts/BotLinkedAccountsMetadata.part +134 -0
  51. package/WAProto/parts/BotMediaMetadata.part +229 -0
  52. package/WAProto/parts/BotMemoryFact.part +100 -0
  53. package/WAProto/parts/BotMemoryMetadata.part +141 -0
  54. package/WAProto/parts/BotMemuMetadata.part +92 -0
  55. package/WAProto/parts/BotMessageOrigin.part +95 -0
  56. package/WAProto/parts/BotMessageOriginMetadata.part +92 -0
  57. package/WAProto/parts/BotMessageSharingInfo.part +297 -0
  58. package/WAProto/parts/BotMetadata.part +934 -0
  59. package/WAProto/parts/BotMetricsEntryPoint.part +51 -0
  60. package/WAProto/parts/BotMetricsMetadata.part +341 -0
  61. package/WAProto/parts/BotMetricsThreadEntryPoint.part +8 -0
  62. package/WAProto/parts/BotModeSelectionMetadata.part +151 -0
  63. package/WAProto/parts/BotModelMetadata.part +167 -0
  64. package/WAProto/parts/BotPluginMetadata.part +379 -0
  65. package/WAProto/parts/BotProgressIndicatorMetadata.part +837 -0
  66. package/WAProto/parts/BotPromotionMessageMetadata.part +124 -0
  67. package/WAProto/parts/BotPromptSuggestion.part +100 -0
  68. package/WAProto/parts/BotPromptSuggestions.part +92 -0
  69. package/WAProto/parts/BotPttPromptMetadata.part +81 -0
  70. package/WAProto/parts/BotQuotaMetadata.part +241 -0
  71. package/WAProto/parts/BotReminderMetadata.part +232 -0
  72. package/WAProto/parts/BotRenderingConfigMetadata.part +100 -0
  73. package/WAProto/parts/BotRenderingMetadata.part +203 -0
  74. package/WAProto/parts/BotResolvedToolCallMetadata.part +100 -0
  75. package/WAProto/parts/BotSessionMetadata.part +137 -0
  76. package/WAProto/parts/BotSessionSource.part +11 -0
  77. package/WAProto/parts/BotSignatureVerificationMetadata.part +92 -0
  78. package/WAProto/parts/BotSignatureVerificationUseCaseProof.part +183 -0
  79. package/WAProto/parts/BotSourcesMetadata.part +322 -0
  80. package/WAProto/parts/BotSuggestedPromptMetadata.part +150 -0
  81. package/WAProto/parts/BotUnifiedResponseMutation.part +339 -0
  82. package/WAProto/parts/CallLogRecord.part +646 -0
  83. package/WAProto/parts/CertChain.part +392 -0
  84. package/WAProto/parts/ChatLockSettings.part +102 -0
  85. package/WAProto/parts/ChatRowOpaqueData.part +712 -0
  86. package/WAProto/parts/Citation.part +119 -0
  87. package/WAProto/parts/ClientPairingProps.part +160 -0
  88. package/WAProto/parts/ClientPayload.part +2892 -0
  89. package/WAProto/parts/CollectionName.part +9 -0
  90. package/WAProto/parts/CommentMetadata.part +102 -0
  91. package/WAProto/parts/CompanionCommitment.part +84 -0
  92. package/WAProto/parts/CompanionEphemeralIdentity.part +227 -0
  93. package/WAProto/parts/Config.part +136 -0
  94. package/WAProto/parts/ContextInfo.part +4137 -0
  95. package/WAProto/parts/Conversation.part +1472 -0
  96. package/WAProto/parts/DeviceCapabilities.part +670 -0
  97. package/WAProto/parts/DeviceConsistencyCodeMessage.part +103 -0
  98. package/WAProto/parts/DeviceListMetadata.part +306 -0
  99. package/WAProto/parts/DeviceProps.part +982 -0
  100. package/WAProto/parts/DisappearingMode.part +206 -0
  101. package/WAProto/parts/EmbeddedContent.part +100 -0
  102. package/WAProto/parts/EmbeddedMessage.part +102 -0
  103. package/WAProto/parts/EmbeddedMusic.part +370 -0
  104. package/WAProto/parts/EncryptedPairingRequest.part +106 -0
  105. package/WAProto/parts/EphemeralSetting.part +110 -0
  106. package/WAProto/parts/EventAdditionalMetadata.part +81 -0
  107. package/WAProto/parts/EventResponse.part +152 -0
  108. package/WAProto/parts/ExitCode.part +110 -0
  109. package/WAProto/parts/ExternalBlobReference.part +195 -0
  110. package/WAProto/parts/Field.part +193 -0
  111. package/WAProto/parts/ForwardedAIBotMessageInfo.part +119 -0
  112. package/WAProto/parts/GlobalSettings.part +497 -0
  113. package/WAProto/parts/GroupHistoryBundleInfo.part +141 -0
  114. package/WAProto/parts/GroupHistoryIndividualMessageInfo.part +102 -0
  115. package/WAProto/parts/GroupMention.part +100 -0
  116. package/WAProto/parts/GroupParticipant.part +142 -0
  117. package/WAProto/parts/GroupRootKeyShare.part +92 -0
  118. package/WAProto/parts/GroupRootKeyShareEntry.part +161 -0
  119. package/WAProto/parts/HandshakeMessage.part +815 -0
  120. package/WAProto/parts/HatchMetadataSync.part +132 -0
  121. package/WAProto/parts/HistorySync.part +605 -0
  122. package/WAProto/parts/HistorySyncMsg.part +112 -0
  123. package/WAProto/parts/HydratedTemplateButton.part +501 -0
  124. package/WAProto/parts/IdentityKeyPairStructure.part +106 -0
  125. package/WAProto/parts/InThreadSurveyMetadata.part +779 -0
  126. package/WAProto/parts/InlineContact.part +157 -0
  127. package/WAProto/parts/InteractiveAnnotation.part +246 -0
  128. package/WAProto/parts/InteractiveMessageAdditionalMetadata.part +81 -0
  129. package/WAProto/parts/KeepInChat.part +225 -0
  130. package/WAProto/parts/KeepType.part +6 -0
  131. package/WAProto/parts/KeyExchangeMessage.part +169 -0
  132. package/WAProto/parts/KeyId.part +84 -0
  133. package/WAProto/parts/LIDMigrationMapping.part +149 -0
  134. package/WAProto/parts/LIDMigrationMappingSyncMessage.part +84 -0
  135. package/WAProto/parts/LIDMigrationMappingSyncPayload.part +122 -0
  136. package/WAProto/parts/LegacyMessage.part +104 -0
  137. package/WAProto/parts/LimitSharing.part +177 -0
  138. package/WAProto/parts/LocalizedName.part +119 -0
  139. package/WAProto/parts/Location.part +119 -0
  140. package/WAProto/parts/MediaData.part +81 -0
  141. package/WAProto/parts/MediaDomainInfo.part +120 -0
  142. package/WAProto/parts/MediaKeyDomain.part +6 -0
  143. package/WAProto/parts/MediaNotifyMessage.part +132 -0
  144. package/WAProto/parts/MediaRetryNotification.part +170 -0
  145. package/WAProto/parts/MediaVisibility.part +6 -0
  146. package/WAProto/parts/MemberLabel.part +110 -0
  147. package/WAProto/parts/Message.part +32376 -0
  148. package/WAProto/parts/MessageAddOn.part +305 -0
  149. package/WAProto/parts/MessageAddOnContextInfo.part +113 -0
  150. package/WAProto/parts/MessageAssociation.part +235 -0
  151. package/WAProto/parts/MessageContextInfo.part +451 -0
  152. package/WAProto/parts/MessageKey.part +138 -0
  153. package/WAProto/parts/MessageSecretMessage.part +125 -0
  154. package/WAProto/parts/Money.part +129 -0
  155. package/WAProto/parts/MsgOpaqueData.part +1732 -0
  156. package/WAProto/parts/MsgRowOpaqueData.part +104 -0
  157. package/WAProto/parts/MutationProps.part +89 -0
  158. package/WAProto/parts/NoiseCertificate.part +277 -0
  159. package/WAProto/parts/NotificationMessageInfo.part +152 -0
  160. package/WAProto/parts/NotificationSettings.part +176 -0
  161. package/WAProto/parts/PairingRequest.part +128 -0
  162. package/WAProto/parts/PastParticipant.part +148 -0
  163. package/WAProto/parts/PastParticipants.part +112 -0
  164. package/WAProto/parts/PatchDebugData.part +358 -0
  165. package/WAProto/parts/PaymentBackground.part +460 -0
  166. package/WAProto/parts/PaymentInfo.part +602 -0
  167. package/WAProto/parts/PhoneNumberToLIDMapping.part +100 -0
  168. package/WAProto/parts/PhotoChange.part +125 -0
  169. package/WAProto/parts/PinInChat.part +205 -0
  170. package/WAProto/parts/Point.part +138 -0
  171. package/WAProto/parts/PollAdditionalMetadata.part +216 -0
  172. package/WAProto/parts/PollEncValue.part +106 -0
  173. package/WAProto/parts/PollUpdate.part +202 -0
  174. package/WAProto/parts/PreKeyRecordStructure.part +125 -0
  175. package/WAProto/parts/PreKeySignalMessage.part +185 -0
  176. package/WAProto/parts/PremiumMessageInfo.part +81 -0
  177. package/WAProto/parts/PrimaryEphemeralIdentity.part +106 -0
  178. package/WAProto/parts/PrivacySystemMessage.part +6 -0
  179. package/WAProto/parts/ProcessedVideo.part +266 -0
  180. package/WAProto/parts/ProloguePayload.part +105 -0
  181. package/WAProto/parts/Pushname.part +100 -0
  182. package/WAProto/parts/QuarantinedMessage.part +103 -0
  183. package/WAProto/parts/Reaction.part +169 -0
  184. package/WAProto/parts/RecentEmojiWeight.part +100 -0
  185. package/WAProto/parts/RecordStructure.part +114 -0
  186. package/WAProto/parts/Reportable.part +138 -0
  187. package/WAProto/parts/ReportingTokenInfo.part +84 -0
  188. package/WAProto/parts/ScheduledMessageMetadata.part +132 -0
  189. package/WAProto/parts/SenderKeyDistributionMessage.part +144 -0
  190. package/WAProto/parts/SenderKeyMessage.part +122 -0
  191. package/WAProto/parts/SenderKeyRecordStructure.part +92 -0
  192. package/WAProto/parts/SenderKeyStateStructure.part +469 -0
  193. package/WAProto/parts/ServerErrorReceipt.part +81 -0
  194. package/WAProto/parts/SessionStructure.part +1087 -0
  195. package/WAProto/parts/SessionTransparencyMetadata.part +132 -0
  196. package/WAProto/parts/SessionTransparencyType.part +5 -0
  197. package/WAProto/parts/SignalMessage.part +144 -0
  198. package/WAProto/parts/SignedPreKeyRecordStructure.part +176 -0
  199. package/WAProto/parts/StatusAttribution.part +1235 -0
  200. package/WAProto/parts/StatusMentionMessage.part +83 -0
  201. package/WAProto/parts/StatusPSA.part +121 -0
  202. package/WAProto/parts/StickerMetadata.part +357 -0
  203. package/WAProto/parts/SyncActionData.part +146 -0
  204. package/WAProto/parts/SyncActionValue.part +12959 -0
  205. package/WAProto/parts/SyncdIndex.part +84 -0
  206. package/WAProto/parts/SyncdMutation.part +121 -0
  207. package/WAProto/parts/SyncdMutations.part +92 -0
  208. package/WAProto/parts/SyncdPatch.part +262 -0
  209. package/WAProto/parts/SyncdRecord.part +125 -0
  210. package/WAProto/parts/SyncdSnapshot.part +157 -0
  211. package/WAProto/parts/SyncdValue.part +84 -0
  212. package/WAProto/parts/SyncdVersion.part +91 -0
  213. package/WAProto/parts/TapLinkAction.part +100 -0
  214. package/WAProto/parts/TemplateButton.part +449 -0
  215. package/WAProto/parts/ThreadID.part +126 -0
  216. package/WAProto/parts/UrlTrackingMap.part +231 -0
  217. package/WAProto/parts/UserPassword.part +399 -0
  218. package/WAProto/parts/UserReceipt.part +221 -0
  219. package/WAProto/parts/VerifiedNameCertificate.part +318 -0
  220. package/WAProto/parts/WallpaperSettings.part +119 -0
  221. package/WAProto/parts/WebFeatures.part +1870 -0
  222. package/WAProto/parts/WebLinkRenderConfig.part +5 -0
  223. package/WAProto/parts/WebMessageInfo.part +2851 -0
  224. package/WAProto/parts/WebNotificationsInfo.part +160 -0
  225. package/package.json +1 -1
  226. package/src/socket/messages-recv.js +3 -1
  227. package/src/socket/messages-send.js +25 -10
  228. package/src/socket/socket-core.js +53 -57
  229. package/src/utils/wa-protocol-core.js +3 -9
@@ -0,0 +1,605 @@
1
+ "use strict";
2
+ function HistorySync(p) {
3
+ this.conversations = [];
4
+ this.statusV3Messages = [];
5
+ this.pushnames = [];
6
+ this.recentStickers = [];
7
+ this.pastParticipants = [];
8
+ this.callLogRecords = [];
9
+ this.phoneNumberToLidMappings = [];
10
+ this.accounts = [];
11
+ this.inlineContacts = [];
12
+ if (p)
13
+ for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
14
+ if (p[ks[i]] != null && ks[i] !== "__proto__")
15
+ this[ks[i]] = p[ks[i]];
16
+ }
17
+ HistorySync.prototype.syncType = 0;
18
+ HistorySync.prototype.conversations = $util.emptyArray;
19
+ HistorySync.prototype.statusV3Messages = $util.emptyArray;
20
+ HistorySync.prototype.chunkOrder = null;
21
+ HistorySync.prototype.progress = null;
22
+ HistorySync.prototype.pushnames = $util.emptyArray;
23
+ HistorySync.prototype.globalSettings = null;
24
+ HistorySync.prototype.threadIdUserSecret = null;
25
+ HistorySync.prototype.threadDsTimeframeOffset = null;
26
+ HistorySync.prototype.recentStickers = $util.emptyArray;
27
+ HistorySync.prototype.pastParticipants = $util.emptyArray;
28
+ HistorySync.prototype.callLogRecords = $util.emptyArray;
29
+ HistorySync.prototype.aiWaitListState = null;
30
+ HistorySync.prototype.phoneNumberToLidMappings = $util.emptyArray;
31
+ HistorySync.prototype.companionMetaNonce = null;
32
+ HistorySync.prototype.shareableChatIdentifierEncryptionKey = null;
33
+ HistorySync.prototype.accounts = $util.emptyArray;
34
+ HistorySync.prototype.nctSalt = null;
35
+ HistorySync.prototype.inlineContacts = $util.emptyArray;
36
+ HistorySync.prototype.inlineContactsProvided = null;
37
+ let $oneOfFields;
38
+ Object.defineProperty(HistorySync.prototype, "_chunkOrder", {
39
+ get: $util.oneOfGetter($oneOfFields = ["chunkOrder"]),
40
+ set: $util.oneOfSetter($oneOfFields)
41
+ });
42
+ Object.defineProperty(HistorySync.prototype, "_progress", {
43
+ get: $util.oneOfGetter($oneOfFields = ["progress"]),
44
+ set: $util.oneOfSetter($oneOfFields)
45
+ });
46
+ Object.defineProperty(HistorySync.prototype, "_globalSettings", {
47
+ get: $util.oneOfGetter($oneOfFields = ["globalSettings"]),
48
+ set: $util.oneOfSetter($oneOfFields)
49
+ });
50
+ Object.defineProperty(HistorySync.prototype, "_threadIdUserSecret", {
51
+ get: $util.oneOfGetter($oneOfFields = ["threadIdUserSecret"]),
52
+ set: $util.oneOfSetter($oneOfFields)
53
+ });
54
+ Object.defineProperty(HistorySync.prototype, "_threadDsTimeframeOffset", {
55
+ get: $util.oneOfGetter($oneOfFields = ["threadDsTimeframeOffset"]),
56
+ set: $util.oneOfSetter($oneOfFields)
57
+ });
58
+ Object.defineProperty(HistorySync.prototype, "_aiWaitListState", {
59
+ get: $util.oneOfGetter($oneOfFields = ["aiWaitListState"]),
60
+ set: $util.oneOfSetter($oneOfFields)
61
+ });
62
+ Object.defineProperty(HistorySync.prototype, "_companionMetaNonce", {
63
+ get: $util.oneOfGetter($oneOfFields = ["companionMetaNonce"]),
64
+ set: $util.oneOfSetter($oneOfFields)
65
+ });
66
+ Object.defineProperty(HistorySync.prototype, "_shareableChatIdentifierEncryptionKey", {
67
+ get: $util.oneOfGetter($oneOfFields = ["shareableChatIdentifierEncryptionKey"]),
68
+ set: $util.oneOfSetter($oneOfFields)
69
+ });
70
+ Object.defineProperty(HistorySync.prototype, "_nctSalt", {
71
+ get: $util.oneOfGetter($oneOfFields = ["nctSalt"]),
72
+ set: $util.oneOfSetter($oneOfFields)
73
+ });
74
+ Object.defineProperty(HistorySync.prototype, "_inlineContactsProvided", {
75
+ get: $util.oneOfGetter($oneOfFields = ["inlineContactsProvided"]),
76
+ set: $util.oneOfSetter($oneOfFields)
77
+ });
78
+ HistorySync.create = function create(properties) {
79
+ return new HistorySync(properties);
80
+ };
81
+ HistorySync.encode = function encode(m, w) {
82
+ if (!w)
83
+ w = $Writer.create();
84
+ if (m.syncType != null && Object.hasOwnProperty.call(m, "syncType"))
85
+ w.uint32(8).int32(m.syncType);
86
+ if (m.conversations != null && m.conversations.length) {
87
+ for (var i = 0; i < m.conversations.length; ++i)
88
+ $root.proto.Conversation.encode(m.conversations[i], w.uint32(18).fork()).ldelim();
89
+ }
90
+ if (m.statusV3Messages != null && m.statusV3Messages.length) {
91
+ for (var i = 0; i < m.statusV3Messages.length; ++i)
92
+ $root.proto.WebMessageInfo.encode(m.statusV3Messages[i], w.uint32(26).fork()).ldelim();
93
+ }
94
+ if (m.chunkOrder != null && Object.hasOwnProperty.call(m, "chunkOrder"))
95
+ w.uint32(40).uint32(m.chunkOrder);
96
+ if (m.progress != null && Object.hasOwnProperty.call(m, "progress"))
97
+ w.uint32(48).uint32(m.progress);
98
+ if (m.pushnames != null && m.pushnames.length) {
99
+ for (var i = 0; i < m.pushnames.length; ++i)
100
+ $root.proto.Pushname.encode(m.pushnames[i], w.uint32(58).fork()).ldelim();
101
+ }
102
+ if (m.globalSettings != null && Object.hasOwnProperty.call(m, "globalSettings"))
103
+ $root.proto.GlobalSettings.encode(m.globalSettings, w.uint32(66).fork()).ldelim();
104
+ if (m.threadIdUserSecret != null && Object.hasOwnProperty.call(m, "threadIdUserSecret"))
105
+ w.uint32(74).bytes(m.threadIdUserSecret);
106
+ if (m.threadDsTimeframeOffset != null && Object.hasOwnProperty.call(m, "threadDsTimeframeOffset"))
107
+ w.uint32(80).uint32(m.threadDsTimeframeOffset);
108
+ if (m.recentStickers != null && m.recentStickers.length) {
109
+ for (var i = 0; i < m.recentStickers.length; ++i)
110
+ $root.proto.StickerMetadata.encode(m.recentStickers[i], w.uint32(90).fork()).ldelim();
111
+ }
112
+ if (m.pastParticipants != null && m.pastParticipants.length) {
113
+ for (var i = 0; i < m.pastParticipants.length; ++i)
114
+ $root.proto.PastParticipants.encode(m.pastParticipants[i], w.uint32(98).fork()).ldelim();
115
+ }
116
+ if (m.callLogRecords != null && m.callLogRecords.length) {
117
+ for (var i = 0; i < m.callLogRecords.length; ++i)
118
+ $root.proto.CallLogRecord.encode(m.callLogRecords[i], w.uint32(106).fork()).ldelim();
119
+ }
120
+ if (m.aiWaitListState != null && Object.hasOwnProperty.call(m, "aiWaitListState"))
121
+ w.uint32(112).int32(m.aiWaitListState);
122
+ if (m.phoneNumberToLidMappings != null && m.phoneNumberToLidMappings.length) {
123
+ for (var i = 0; i < m.phoneNumberToLidMappings.length; ++i)
124
+ $root.proto.PhoneNumberToLIDMapping.encode(m.phoneNumberToLidMappings[i], w.uint32(122).fork()).ldelim();
125
+ }
126
+ if (m.companionMetaNonce != null && Object.hasOwnProperty.call(m, "companionMetaNonce"))
127
+ w.uint32(130).string(m.companionMetaNonce);
128
+ if (m.shareableChatIdentifierEncryptionKey != null && Object.hasOwnProperty.call(m, "shareableChatIdentifierEncryptionKey"))
129
+ w.uint32(138).bytes(m.shareableChatIdentifierEncryptionKey);
130
+ if (m.accounts != null && m.accounts.length) {
131
+ for (var i = 0; i < m.accounts.length; ++i)
132
+ $root.proto.Account.encode(m.accounts[i], w.uint32(146).fork()).ldelim();
133
+ }
134
+ if (m.nctSalt != null && Object.hasOwnProperty.call(m, "nctSalt"))
135
+ w.uint32(154).bytes(m.nctSalt);
136
+ if (m.inlineContacts != null && m.inlineContacts.length) {
137
+ for (var i = 0; i < m.inlineContacts.length; ++i)
138
+ $root.proto.InlineContact.encode(m.inlineContacts[i], w.uint32(162).fork()).ldelim();
139
+ }
140
+ if (m.inlineContactsProvided != null && Object.hasOwnProperty.call(m, "inlineContactsProvided"))
141
+ w.uint32(168).bool(m.inlineContactsProvided);
142
+ return w;
143
+ };
144
+ HistorySync.decode = function decode(r, l, e, n) {
145
+ if (!(r instanceof $Reader))
146
+ r = $Reader.create(r);
147
+ if (n === undefined)
148
+ n = 0;
149
+ if (n > $Reader.recursionLimit)
150
+ throw Error("maximum nesting depth exceeded");
151
+ var c = l === undefined ? r.len : r.pos + l, m = new $root.proto.HistorySync();
152
+ while (r.pos < c) {
153
+ var t = r.uint32();
154
+ if (t === e)
155
+ break;
156
+ switch (t >>> 3) {
157
+ case 1: {
158
+ m.syncType = r.int32();
159
+ break;
160
+ }
161
+ case 2: {
162
+ if (!(m.conversations && m.conversations.length))
163
+ m.conversations = [];
164
+ m.conversations.push($root.proto.Conversation.decode(r, r.uint32(), undefined, n + 1));
165
+ break;
166
+ }
167
+ case 3: {
168
+ if (!(m.statusV3Messages && m.statusV3Messages.length))
169
+ m.statusV3Messages = [];
170
+ m.statusV3Messages.push($root.proto.WebMessageInfo.decode(r, r.uint32(), undefined, n + 1));
171
+ break;
172
+ }
173
+ case 5: {
174
+ m.chunkOrder = r.uint32();
175
+ break;
176
+ }
177
+ case 6: {
178
+ m.progress = r.uint32();
179
+ break;
180
+ }
181
+ case 7: {
182
+ if (!(m.pushnames && m.pushnames.length))
183
+ m.pushnames = [];
184
+ m.pushnames.push($root.proto.Pushname.decode(r, r.uint32(), undefined, n + 1));
185
+ break;
186
+ }
187
+ case 8: {
188
+ m.globalSettings = $root.proto.GlobalSettings.decode(r, r.uint32(), undefined, n + 1);
189
+ break;
190
+ }
191
+ case 9: {
192
+ m.threadIdUserSecret = r.bytes();
193
+ break;
194
+ }
195
+ case 10: {
196
+ m.threadDsTimeframeOffset = r.uint32();
197
+ break;
198
+ }
199
+ case 11: {
200
+ if (!(m.recentStickers && m.recentStickers.length))
201
+ m.recentStickers = [];
202
+ m.recentStickers.push($root.proto.StickerMetadata.decode(r, r.uint32(), undefined, n + 1));
203
+ break;
204
+ }
205
+ case 12: {
206
+ if (!(m.pastParticipants && m.pastParticipants.length))
207
+ m.pastParticipants = [];
208
+ m.pastParticipants.push($root.proto.PastParticipants.decode(r, r.uint32(), undefined, n + 1));
209
+ break;
210
+ }
211
+ case 13: {
212
+ if (!(m.callLogRecords && m.callLogRecords.length))
213
+ m.callLogRecords = [];
214
+ m.callLogRecords.push($root.proto.CallLogRecord.decode(r, r.uint32(), undefined, n + 1));
215
+ break;
216
+ }
217
+ case 14: {
218
+ m.aiWaitListState = r.int32();
219
+ break;
220
+ }
221
+ case 15: {
222
+ if (!(m.phoneNumberToLidMappings && m.phoneNumberToLidMappings.length))
223
+ m.phoneNumberToLidMappings = [];
224
+ m.phoneNumberToLidMappings.push($root.proto.PhoneNumberToLIDMapping.decode(r, r.uint32(), undefined, n + 1));
225
+ break;
226
+ }
227
+ case 16: {
228
+ m.companionMetaNonce = r.string();
229
+ break;
230
+ }
231
+ case 17: {
232
+ m.shareableChatIdentifierEncryptionKey = r.bytes();
233
+ break;
234
+ }
235
+ case 18: {
236
+ if (!(m.accounts && m.accounts.length))
237
+ m.accounts = [];
238
+ m.accounts.push($root.proto.Account.decode(r, r.uint32(), undefined, n + 1));
239
+ break;
240
+ }
241
+ case 19: {
242
+ m.nctSalt = r.bytes();
243
+ break;
244
+ }
245
+ case 20: {
246
+ if (!(m.inlineContacts && m.inlineContacts.length))
247
+ m.inlineContacts = [];
248
+ m.inlineContacts.push($root.proto.InlineContact.decode(r, r.uint32(), undefined, n + 1));
249
+ break;
250
+ }
251
+ case 21: {
252
+ m.inlineContactsProvided = r.bool();
253
+ break;
254
+ }
255
+ default:
256
+ r.skipType(t & 7, n);
257
+ break;
258
+ }
259
+ }
260
+ return m;
261
+ };
262
+ HistorySync.fromObject = function fromObject(d, n) {
263
+ if (d instanceof $root.proto.HistorySync)
264
+ return d;
265
+ if (n === undefined)
266
+ n = 0;
267
+ if (n > $util.recursionLimit)
268
+ throw Error("maximum nesting depth exceeded");
269
+ var m = new $root.proto.HistorySync();
270
+ switch (d.syncType) {
271
+ default:
272
+ if (typeof d.syncType === "number") {
273
+ m.syncType = d.syncType;
274
+ break;
275
+ }
276
+ break;
277
+ case "INITIAL_BOOTSTRAP":
278
+ case 0:
279
+ m.syncType = 0;
280
+ break;
281
+ case "INITIAL_STATUS_V3":
282
+ case 1:
283
+ m.syncType = 1;
284
+ break;
285
+ case "FULL":
286
+ case 2:
287
+ m.syncType = 2;
288
+ break;
289
+ case "RECENT":
290
+ case 3:
291
+ m.syncType = 3;
292
+ break;
293
+ case "PUSH_NAME":
294
+ case 4:
295
+ m.syncType = 4;
296
+ break;
297
+ case "NON_BLOCKING_DATA":
298
+ case 5:
299
+ m.syncType = 5;
300
+ break;
301
+ case "ON_DEMAND":
302
+ case 6:
303
+ m.syncType = 6;
304
+ break;
305
+ }
306
+ if (d.conversations) {
307
+ if (!Array.isArray(d.conversations))
308
+ throw TypeError(".proto.HistorySync.conversations: array expected");
309
+ m.conversations = [];
310
+ for (var i = 0; i < d.conversations.length; ++i) {
311
+ if (typeof d.conversations[i] !== "object")
312
+ throw TypeError(".proto.HistorySync.conversations: object expected");
313
+ m.conversations[i] = $root.proto.Conversation.fromObject(d.conversations[i], n + 1);
314
+ }
315
+ }
316
+ if (d.statusV3Messages) {
317
+ if (!Array.isArray(d.statusV3Messages))
318
+ throw TypeError(".proto.HistorySync.statusV3Messages: array expected");
319
+ m.statusV3Messages = [];
320
+ for (var i = 0; i < d.statusV3Messages.length; ++i) {
321
+ if (typeof d.statusV3Messages[i] !== "object")
322
+ throw TypeError(".proto.HistorySync.statusV3Messages: object expected");
323
+ m.statusV3Messages[i] = $root.proto.WebMessageInfo.fromObject(d.statusV3Messages[i], n + 1);
324
+ }
325
+ }
326
+ if (d.chunkOrder != null) {
327
+ m.chunkOrder = d.chunkOrder >>> 0;
328
+ }
329
+ if (d.progress != null) {
330
+ m.progress = d.progress >>> 0;
331
+ }
332
+ if (d.pushnames) {
333
+ if (!Array.isArray(d.pushnames))
334
+ throw TypeError(".proto.HistorySync.pushnames: array expected");
335
+ m.pushnames = [];
336
+ for (var i = 0; i < d.pushnames.length; ++i) {
337
+ if (typeof d.pushnames[i] !== "object")
338
+ throw TypeError(".proto.HistorySync.pushnames: object expected");
339
+ m.pushnames[i] = $root.proto.Pushname.fromObject(d.pushnames[i], n + 1);
340
+ }
341
+ }
342
+ if (d.globalSettings != null) {
343
+ if (typeof d.globalSettings !== "object")
344
+ throw TypeError(".proto.HistorySync.globalSettings: object expected");
345
+ m.globalSettings = $root.proto.GlobalSettings.fromObject(d.globalSettings, n + 1);
346
+ }
347
+ if (d.threadIdUserSecret != null) {
348
+ if (typeof d.threadIdUserSecret === "string")
349
+ $util.base64.decode(d.threadIdUserSecret, m.threadIdUserSecret = $util.newBuffer($util.base64.length(d.threadIdUserSecret)), 0);
350
+ else if (d.threadIdUserSecret.length >= 0)
351
+ m.threadIdUserSecret = d.threadIdUserSecret;
352
+ }
353
+ if (d.threadDsTimeframeOffset != null) {
354
+ m.threadDsTimeframeOffset = d.threadDsTimeframeOffset >>> 0;
355
+ }
356
+ if (d.recentStickers) {
357
+ if (!Array.isArray(d.recentStickers))
358
+ throw TypeError(".proto.HistorySync.recentStickers: array expected");
359
+ m.recentStickers = [];
360
+ for (var i = 0; i < d.recentStickers.length; ++i) {
361
+ if (typeof d.recentStickers[i] !== "object")
362
+ throw TypeError(".proto.HistorySync.recentStickers: object expected");
363
+ m.recentStickers[i] = $root.proto.StickerMetadata.fromObject(d.recentStickers[i], n + 1);
364
+ }
365
+ }
366
+ if (d.pastParticipants) {
367
+ if (!Array.isArray(d.pastParticipants))
368
+ throw TypeError(".proto.HistorySync.pastParticipants: array expected");
369
+ m.pastParticipants = [];
370
+ for (var i = 0; i < d.pastParticipants.length; ++i) {
371
+ if (typeof d.pastParticipants[i] !== "object")
372
+ throw TypeError(".proto.HistorySync.pastParticipants: object expected");
373
+ m.pastParticipants[i] = $root.proto.PastParticipants.fromObject(d.pastParticipants[i], n + 1);
374
+ }
375
+ }
376
+ if (d.callLogRecords) {
377
+ if (!Array.isArray(d.callLogRecords))
378
+ throw TypeError(".proto.HistorySync.callLogRecords: array expected");
379
+ m.callLogRecords = [];
380
+ for (var i = 0; i < d.callLogRecords.length; ++i) {
381
+ if (typeof d.callLogRecords[i] !== "object")
382
+ throw TypeError(".proto.HistorySync.callLogRecords: object expected");
383
+ m.callLogRecords[i] = $root.proto.CallLogRecord.fromObject(d.callLogRecords[i], n + 1);
384
+ }
385
+ }
386
+ switch (d.aiWaitListState) {
387
+ default:
388
+ if (typeof d.aiWaitListState === "number") {
389
+ m.aiWaitListState = d.aiWaitListState;
390
+ break;
391
+ }
392
+ break;
393
+ case "IN_WAITLIST":
394
+ case 0:
395
+ m.aiWaitListState = 0;
396
+ break;
397
+ case "AI_AVAILABLE":
398
+ case 1:
399
+ m.aiWaitListState = 1;
400
+ break;
401
+ }
402
+ if (d.phoneNumberToLidMappings) {
403
+ if (!Array.isArray(d.phoneNumberToLidMappings))
404
+ throw TypeError(".proto.HistorySync.phoneNumberToLidMappings: array expected");
405
+ m.phoneNumberToLidMappings = [];
406
+ for (var i = 0; i < d.phoneNumberToLidMappings.length; ++i) {
407
+ if (typeof d.phoneNumberToLidMappings[i] !== "object")
408
+ throw TypeError(".proto.HistorySync.phoneNumberToLidMappings: object expected");
409
+ m.phoneNumberToLidMappings[i] = $root.proto.PhoneNumberToLIDMapping.fromObject(d.phoneNumberToLidMappings[i], n + 1);
410
+ }
411
+ }
412
+ if (d.companionMetaNonce != null) {
413
+ m.companionMetaNonce = String(d.companionMetaNonce);
414
+ }
415
+ if (d.shareableChatIdentifierEncryptionKey != null) {
416
+ if (typeof d.shareableChatIdentifierEncryptionKey === "string")
417
+ $util.base64.decode(d.shareableChatIdentifierEncryptionKey, m.shareableChatIdentifierEncryptionKey = $util.newBuffer($util.base64.length(d.shareableChatIdentifierEncryptionKey)), 0);
418
+ else if (d.shareableChatIdentifierEncryptionKey.length >= 0)
419
+ m.shareableChatIdentifierEncryptionKey = d.shareableChatIdentifierEncryptionKey;
420
+ }
421
+ if (d.accounts) {
422
+ if (!Array.isArray(d.accounts))
423
+ throw TypeError(".proto.HistorySync.accounts: array expected");
424
+ m.accounts = [];
425
+ for (var i = 0; i < d.accounts.length; ++i) {
426
+ if (typeof d.accounts[i] !== "object")
427
+ throw TypeError(".proto.HistorySync.accounts: object expected");
428
+ m.accounts[i] = $root.proto.Account.fromObject(d.accounts[i], n + 1);
429
+ }
430
+ }
431
+ if (d.nctSalt != null) {
432
+ if (typeof d.nctSalt === "string")
433
+ $util.base64.decode(d.nctSalt, m.nctSalt = $util.newBuffer($util.base64.length(d.nctSalt)), 0);
434
+ else if (d.nctSalt.length >= 0)
435
+ m.nctSalt = d.nctSalt;
436
+ }
437
+ if (d.inlineContacts) {
438
+ if (!Array.isArray(d.inlineContacts))
439
+ throw TypeError(".proto.HistorySync.inlineContacts: array expected");
440
+ m.inlineContacts = [];
441
+ for (var i = 0; i < d.inlineContacts.length; ++i) {
442
+ if (typeof d.inlineContacts[i] !== "object")
443
+ throw TypeError(".proto.HistorySync.inlineContacts: object expected");
444
+ m.inlineContacts[i] = $root.proto.InlineContact.fromObject(d.inlineContacts[i], n + 1);
445
+ }
446
+ }
447
+ if (d.inlineContactsProvided != null) {
448
+ m.inlineContactsProvided = Boolean(d.inlineContactsProvided);
449
+ }
450
+ return m;
451
+ };
452
+ HistorySync.toObject = function toObject(m, o) {
453
+ if (!o)
454
+ o = {};
455
+ var d = {};
456
+ if (o.arrays || o.defaults) {
457
+ d.conversations = [];
458
+ d.statusV3Messages = [];
459
+ d.pushnames = [];
460
+ d.recentStickers = [];
461
+ d.pastParticipants = [];
462
+ d.callLogRecords = [];
463
+ d.phoneNumberToLidMappings = [];
464
+ d.accounts = [];
465
+ d.inlineContacts = [];
466
+ }
467
+ if (o.defaults) {
468
+ d.syncType = o.enums === String ? "INITIAL_BOOTSTRAP" : 0;
469
+ }
470
+ if (m.syncType != null && m.hasOwnProperty("syncType")) {
471
+ d.syncType = o.enums === String ? $root.proto.HistorySync.HistorySyncType[m.syncType] === undefined ? m.syncType : $root.proto.HistorySync.HistorySyncType[m.syncType] : m.syncType;
472
+ }
473
+ if (m.conversations && m.conversations.length) {
474
+ d.conversations = [];
475
+ for (var j = 0; j < m.conversations.length; ++j) {
476
+ d.conversations[j] = $root.proto.Conversation.toObject(m.conversations[j], o);
477
+ }
478
+ }
479
+ if (m.statusV3Messages && m.statusV3Messages.length) {
480
+ d.statusV3Messages = [];
481
+ for (var j = 0; j < m.statusV3Messages.length; ++j) {
482
+ d.statusV3Messages[j] = $root.proto.WebMessageInfo.toObject(m.statusV3Messages[j], o);
483
+ }
484
+ }
485
+ if (m.chunkOrder != null && m.hasOwnProperty("chunkOrder")) {
486
+ d.chunkOrder = m.chunkOrder;
487
+ if (o.oneofs)
488
+ d._chunkOrder = "chunkOrder";
489
+ }
490
+ if (m.progress != null && m.hasOwnProperty("progress")) {
491
+ d.progress = m.progress;
492
+ if (o.oneofs)
493
+ d._progress = "progress";
494
+ }
495
+ if (m.pushnames && m.pushnames.length) {
496
+ d.pushnames = [];
497
+ for (var j = 0; j < m.pushnames.length; ++j) {
498
+ d.pushnames[j] = $root.proto.Pushname.toObject(m.pushnames[j], o);
499
+ }
500
+ }
501
+ if (m.globalSettings != null && m.hasOwnProperty("globalSettings")) {
502
+ d.globalSettings = $root.proto.GlobalSettings.toObject(m.globalSettings, o);
503
+ if (o.oneofs)
504
+ d._globalSettings = "globalSettings";
505
+ }
506
+ if (m.threadIdUserSecret != null && m.hasOwnProperty("threadIdUserSecret")) {
507
+ d.threadIdUserSecret = o.bytes === String ? $util.base64.encode(m.threadIdUserSecret, 0, m.threadIdUserSecret.length) : o.bytes === Array ? Array.prototype.slice.call(m.threadIdUserSecret) : m.threadIdUserSecret;
508
+ if (o.oneofs)
509
+ d._threadIdUserSecret = "threadIdUserSecret";
510
+ }
511
+ if (m.threadDsTimeframeOffset != null && m.hasOwnProperty("threadDsTimeframeOffset")) {
512
+ d.threadDsTimeframeOffset = m.threadDsTimeframeOffset;
513
+ if (o.oneofs)
514
+ d._threadDsTimeframeOffset = "threadDsTimeframeOffset";
515
+ }
516
+ if (m.recentStickers && m.recentStickers.length) {
517
+ d.recentStickers = [];
518
+ for (var j = 0; j < m.recentStickers.length; ++j) {
519
+ d.recentStickers[j] = $root.proto.StickerMetadata.toObject(m.recentStickers[j], o);
520
+ }
521
+ }
522
+ if (m.pastParticipants && m.pastParticipants.length) {
523
+ d.pastParticipants = [];
524
+ for (var j = 0; j < m.pastParticipants.length; ++j) {
525
+ d.pastParticipants[j] = $root.proto.PastParticipants.toObject(m.pastParticipants[j], o);
526
+ }
527
+ }
528
+ if (m.callLogRecords && m.callLogRecords.length) {
529
+ d.callLogRecords = [];
530
+ for (var j = 0; j < m.callLogRecords.length; ++j) {
531
+ d.callLogRecords[j] = $root.proto.CallLogRecord.toObject(m.callLogRecords[j], o);
532
+ }
533
+ }
534
+ if (m.aiWaitListState != null && m.hasOwnProperty("aiWaitListState")) {
535
+ d.aiWaitListState = o.enums === String ? $root.proto.HistorySync.BotAIWaitListState[m.aiWaitListState] === undefined ? m.aiWaitListState : $root.proto.HistorySync.BotAIWaitListState[m.aiWaitListState] : m.aiWaitListState;
536
+ if (o.oneofs)
537
+ d._aiWaitListState = "aiWaitListState";
538
+ }
539
+ if (m.phoneNumberToLidMappings && m.phoneNumberToLidMappings.length) {
540
+ d.phoneNumberToLidMappings = [];
541
+ for (var j = 0; j < m.phoneNumberToLidMappings.length; ++j) {
542
+ d.phoneNumberToLidMappings[j] = $root.proto.PhoneNumberToLIDMapping.toObject(m.phoneNumberToLidMappings[j], o);
543
+ }
544
+ }
545
+ if (m.companionMetaNonce != null && m.hasOwnProperty("companionMetaNonce")) {
546
+ d.companionMetaNonce = m.companionMetaNonce;
547
+ if (o.oneofs)
548
+ d._companionMetaNonce = "companionMetaNonce";
549
+ }
550
+ if (m.shareableChatIdentifierEncryptionKey != null && m.hasOwnProperty("shareableChatIdentifierEncryptionKey")) {
551
+ d.shareableChatIdentifierEncryptionKey = o.bytes === String ? $util.base64.encode(m.shareableChatIdentifierEncryptionKey, 0, m.shareableChatIdentifierEncryptionKey.length) : o.bytes === Array ? Array.prototype.slice.call(m.shareableChatIdentifierEncryptionKey) : m.shareableChatIdentifierEncryptionKey;
552
+ if (o.oneofs)
553
+ d._shareableChatIdentifierEncryptionKey = "shareableChatIdentifierEncryptionKey";
554
+ }
555
+ if (m.accounts && m.accounts.length) {
556
+ d.accounts = [];
557
+ for (var j = 0; j < m.accounts.length; ++j) {
558
+ d.accounts[j] = $root.proto.Account.toObject(m.accounts[j], o);
559
+ }
560
+ }
561
+ if (m.nctSalt != null && m.hasOwnProperty("nctSalt")) {
562
+ d.nctSalt = o.bytes === String ? $util.base64.encode(m.nctSalt, 0, m.nctSalt.length) : o.bytes === Array ? Array.prototype.slice.call(m.nctSalt) : m.nctSalt;
563
+ if (o.oneofs)
564
+ d._nctSalt = "nctSalt";
565
+ }
566
+ if (m.inlineContacts && m.inlineContacts.length) {
567
+ d.inlineContacts = [];
568
+ for (var j = 0; j < m.inlineContacts.length; ++j) {
569
+ d.inlineContacts[j] = $root.proto.InlineContact.toObject(m.inlineContacts[j], o);
570
+ }
571
+ }
572
+ if (m.inlineContactsProvided != null && m.hasOwnProperty("inlineContactsProvided")) {
573
+ d.inlineContactsProvided = m.inlineContactsProvided;
574
+ if (o.oneofs)
575
+ d._inlineContactsProvided = "inlineContactsProvided";
576
+ }
577
+ return d;
578
+ };
579
+ HistorySync.prototype.toJSON = function toJSON() {
580
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
581
+ };
582
+ HistorySync.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
583
+ if (typeUrlPrefix === undefined) {
584
+ typeUrlPrefix = "type.googleapis.com";
585
+ }
586
+ return typeUrlPrefix + "/proto.HistorySync";
587
+ };
588
+ $lazy(HistorySync, "BotAIWaitListState", function() {
589
+ const valuesById = {}, values = Object.create(valuesById);
590
+ values[valuesById[0] = "IN_WAITLIST"] = 0;
591
+ values[valuesById[1] = "AI_AVAILABLE"] = 1;
592
+ return values;
593
+ });
594
+ $lazy(HistorySync, "HistorySyncType", function() {
595
+ const valuesById = {}, values = Object.create(valuesById);
596
+ values[valuesById[0] = "INITIAL_BOOTSTRAP"] = 0;
597
+ values[valuesById[1] = "INITIAL_STATUS_V3"] = 1;
598
+ values[valuesById[2] = "FULL"] = 2;
599
+ values[valuesById[3] = "RECENT"] = 3;
600
+ values[valuesById[4] = "PUSH_NAME"] = 4;
601
+ values[valuesById[5] = "NON_BLOCKING_DATA"] = 5;
602
+ values[valuesById[6] = "ON_DEMAND"] = 6;
603
+ return values;
604
+ });
605
+ return HistorySync;