nodejs-insta-private-api-mqt 1.3.84 → 1.3.86
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.
- package/dist/dist/constants/constants.d.ts +1 -0
- package/dist/dist/constants/index.d.ts +25 -0
- package/dist/dist/core/client.d.ts +106 -0
- package/dist/dist/core/nav-chain.d.ts +77 -0
- package/dist/dist/core/repository.d.ts +3 -0
- package/dist/dist/core/request.d.ts +76 -0
- package/dist/dist/core/state.d.ts +605 -0
- package/dist/dist/core/utils.d.ts +129 -0
- package/dist/dist/downloadMedia.d.ts +106 -0
- package/{dist-ts → dist}/dist/downloadMedia.js +19 -20
- package/dist/dist/errors/index.d.ts +18 -0
- package/dist/dist/extend.d.ts +20 -0
- package/dist/dist/fbns/fbns.client.d.ts +43 -0
- package/dist/dist/fbns/fbns.client.events.d.ts +0 -0
- package/{dist-ts → dist}/dist/fbns/fbns.client.js +4 -5
- package/dist/dist/fbns/fbns.device-auth.d.ts +9 -0
- package/{src-ts/dist/fbns/fbns.device-auth.ts → dist/dist/fbns/fbns.device-auth.js} +6 -3
- package/dist/dist/fbns/fbns.types.d.ts +0 -0
- package/dist/dist/fbns/fbns.utilities.d.ts +4 -0
- package/dist/dist/fbns/index.d.ts +2 -0
- package/dist/dist/index.d.ts +49 -0
- package/dist/dist/mqtt-shim.d.ts +1 -0
- package/dist/dist/mqttot/index.d.ts +2 -0
- package/dist/dist/mqttot/mqttot.client.d.ts +77 -0
- package/{dist-ts → dist}/dist/mqttot/mqttot.client.js +10 -10
- package/dist/dist/mqttot/mqttot.connect.request.packet.d.ts +1 -0
- package/dist/dist/mqttot/mqttot.connect.response.packet.d.ts +5 -0
- package/dist/dist/mqttot/mqttot.connection.d.ts +6 -0
- package/dist/dist/realtime/commands/commands.d.ts +19 -0
- package/dist/dist/realtime/commands/direct.commands.d.ts +142 -0
- package/dist/dist/realtime/commands/enhanced.direct.commands.d.ts +425 -0
- package/{dist-ts → dist}/dist/realtime/commands/enhanced.direct.commands.js +8 -10
- package/dist/dist/realtime/commands/index.d.ts +2 -0
- package/dist/dist/realtime/delta-sync.manager.d.ts +82 -0
- package/{dist-ts → dist}/dist/realtime/delta-sync.manager.js +7 -10
- package/dist/dist/realtime/features/dm-sender.d.ts +20 -0
- package/{src-ts/dist/realtime/features/dm-sender.ts → dist/dist/realtime/features/dm-sender.js} +6 -3
- package/dist/dist/realtime/features/error-handler.d.ts +33 -0
- package/{dist-ts → dist}/dist/realtime/features/error-handler.js +4 -4
- package/dist/dist/realtime/features/gap-handler.d.ts +19 -0
- package/dist/dist/realtime/features/persistent-logger.d.ts +28 -0
- package/{dist-ts → dist}/dist/realtime/features/persistent-logger.js +3 -3
- package/dist/dist/realtime/features/presence.manager.d.ts +24 -0
- package/{src-ts/dist/realtime/features/presence.manager.ts → dist/dist/realtime/features/presence.manager.js} +2 -1
- package/dist/dist/realtime/features/session-health-monitor.d.ts +93 -0
- package/{src-ts/dist/realtime/features/session-health-monitor.ts → dist/dist/realtime/features/session-health-monitor.js} +45 -65
- package/dist/dist/realtime/index.d.ts +9 -0
- package/dist/dist/realtime/messages/app-presence.event.d.ts +0 -0
- package/dist/dist/realtime/messages/index.d.ts +2 -0
- package/dist/dist/realtime/messages/message-sync.message.d.ts +1 -0
- package/dist/dist/realtime/messages/realtime-sub.direct.data.d.ts +0 -0
- package/dist/dist/realtime/messages/thread-update.message.d.ts +0 -0
- package/dist/dist/realtime/mixins/index.d.ts +2 -0
- package/dist/dist/realtime/mixins/message-sync.mixin.d.ts +38 -0
- package/{dist-ts → dist}/dist/realtime/mixins/message-sync.mixin.js +16 -18
- package/dist/dist/realtime/mixins/mixin.d.ts +4 -0
- package/dist/dist/realtime/mixins/presence-typing.mixin.d.ts +9 -0
- package/dist/dist/realtime/mixins/realtime-sub.mixin.d.ts +37 -0
- package/{dist-ts → dist}/dist/realtime/mixins/realtime-sub.mixin.js +4 -5
- package/dist/dist/realtime/parsers/graphql-parser.d.ts +18 -0
- package/dist/dist/realtime/parsers/graphql.parser.d.ts +10 -0
- package/{src-ts/dist/realtime/parsers/graphql.parser.ts → dist/dist/realtime/parsers/graphql.parser.js} +0 -1
- package/dist/dist/realtime/parsers/index.d.ts +2 -0
- package/dist/dist/realtime/parsers/iris-parser.d.ts +18 -0
- package/dist/dist/realtime/parsers/iris.parser.d.ts +3 -0
- package/dist/dist/realtime/parsers/json-parser.d.ts +18 -0
- package/dist/dist/realtime/parsers/json.parser.d.ts +6 -0
- package/dist/dist/realtime/parsers/parser.d.ts +0 -0
- package/dist/dist/realtime/parsers/region-hint-parser.d.ts +18 -0
- package/dist/dist/realtime/parsers/region-hint.parser.d.ts +4 -0
- package/dist/dist/realtime/parsers/skywalker-parser.d.ts +18 -0
- package/dist/dist/realtime/parsers/skywalker.parser.d.ts +7 -0
- package/dist/dist/realtime/parsers-advanced.d.ts +93 -0
- package/{dist-ts → dist}/dist/realtime/parsers-advanced.js +5 -8
- package/dist/dist/realtime/proto-parser.d.ts +27 -0
- package/{dist-ts → dist}/dist/realtime/proto-parser.js +1 -2
- package/dist/dist/realtime/protocols/iris.handshake.d.ts +41 -0
- package/dist/dist/realtime/protocols/proto-definitions.d.ts +0 -0
- package/dist/dist/realtime/protocols/skywalker.protocol.d.ts +20 -0
- package/{src-ts/dist/realtime/protocols/skywalker.protocol.ts → dist/dist/realtime/protocols/skywalker.protocol.js} +8 -5
- package/dist/dist/realtime/realtime.client.d.ts +169 -0
- package/dist/dist/realtime/realtime.client.events.d.ts +0 -0
- package/{dist-ts → dist}/dist/realtime/realtime.client.js +75 -86
- package/dist/dist/realtime/realtime.service.d.ts +109 -0
- package/dist/dist/realtime/reconnect.manager.d.ts +15 -0
- package/dist/dist/realtime/session.manager.d.ts +25 -0
- package/dist/dist/realtime/subscriptions/graphql.subscription.d.ts +4 -0
- package/dist/dist/realtime/subscriptions/index.d.ts +2 -0
- package/dist/dist/realtime/subscriptions/skywalker.subscription.d.ts +4 -0
- package/dist/dist/realtime/topic-map.d.ts +97 -0
- package/dist/dist/realtime/topic.d.ts +71 -0
- package/dist/dist/repositories/account.repository.d.ts +72 -0
- package/{dist-ts → dist}/dist/repositories/account.repository.js +4 -6
- package/dist/dist/repositories/bloks.repository.d.ts +6 -0
- package/dist/dist/repositories/captcha.repository.d.ts +6 -0
- package/dist/dist/repositories/challenge.repository.d.ts +12 -0
- package/{dist-ts → dist}/dist/repositories/challenge.repository.js +1 -2
- package/dist/dist/repositories/clip.repository.d.ts +10 -0
- package/dist/dist/repositories/close-friends.repository.d.ts +8 -0
- package/dist/dist/repositories/collection.repository.d.ts +8 -0
- package/dist/dist/repositories/direct-thread.repository.d.ts +88 -0
- package/{dist-ts → dist}/dist/repositories/direct-thread.repository.js +7 -9
- package/dist/dist/repositories/direct.repository.d.ts +22 -0
- package/{dist-ts → dist}/dist/repositories/direct.repository.js +4 -5
- package/dist/dist/repositories/explore.repository.d.ts +7 -0
- package/dist/dist/repositories/fbsearch.repository.d.ts +14 -0
- package/dist/dist/repositories/feed.repository.d.ts +19 -0
- package/dist/dist/repositories/friendship.repository.d.ts +26 -0
- package/dist/dist/repositories/fundraiser.repository.d.ts +6 -0
- package/dist/dist/repositories/hashtag.repository.d.ts +11 -0
- package/dist/dist/repositories/highlights.repository.d.ts +11 -0
- package/dist/dist/repositories/insights.repository.d.ts +8 -0
- package/dist/dist/repositories/location.repository.d.ts +9 -0
- package/dist/dist/repositories/media.repository.d.ts +41 -0
- package/{dist-ts → dist}/dist/repositories/media.repository.js +1 -2
- package/dist/dist/repositories/multiple-accounts.repository.d.ts +7 -0
- package/dist/dist/repositories/news.repository.d.ts +6 -0
- package/dist/dist/repositories/note.repository.d.ts +8 -0
- package/dist/dist/repositories/notification.repository.d.ts +33 -0
- package/{dist-ts → dist}/dist/repositories/notification.repository.js +1 -1
- package/dist/dist/repositories/share.repository.d.ts +12 -0
- package/dist/dist/repositories/signup.repository.d.ts +19 -0
- package/dist/dist/repositories/story.repository.d.ts +23 -0
- package/{dist-ts → dist}/dist/repositories/story.repository.js +1 -2
- package/dist/dist/repositories/timeline.repository.d.ts +7 -0
- package/dist/dist/repositories/totp.repository.d.ts +14 -0
- package/dist/dist/repositories/track.repository.d.ts +7 -0
- package/{dist-ts → dist}/dist/repositories/track.repository.js +1 -2
- package/dist/dist/repositories/upload.repository.d.ts +30 -0
- package/{dist-ts → dist}/dist/repositories/upload.repository.js +4 -5
- package/dist/dist/repositories/user.repository.d.ts +52 -0
- package/dist/dist/sendmedia/index.d.ts +12 -0
- package/dist/dist/sendmedia/sendFile.d.ts +8 -0
- package/dist/dist/sendmedia/sendPhoto.d.ts +26 -0
- package/dist/dist/sendmedia/sendRavenPhoto.d.ts +14 -0
- package/{dist-ts → dist}/dist/sendmedia/sendRavenPhoto.js +4 -5
- package/dist/dist/sendmedia/sendRavenVideo.d.ts +15 -0
- package/{dist-ts → dist}/dist/sendmedia/sendRavenVideo.js +4 -5
- package/dist/dist/sendmedia/uploadPhoto.d.ts +8 -0
- package/dist/dist/sendmedia/uploadfFile.d.ts +13 -0
- package/{dist-ts → dist}/dist/sendmedia/uploadfFile.js +3 -4
- package/dist/dist/services/live.service.d.ts +13 -0
- package/dist/dist/services/search.service.d.ts +11 -0
- package/dist/dist/shared/index.d.ts +4 -0
- package/{src-ts/dist/shared/index.ts → dist/dist/shared/index.js} +14 -13
- package/dist/dist/shared/shared.d.ts +15 -0
- package/dist/dist/thrift/index.d.ts +2 -0
- package/dist/dist/thrift/thrift.d.ts +11 -0
- package/dist/dist/thrift/thrift.reading.d.ts +49 -0
- package/{dist-ts → dist}/dist/thrift/thrift.reading.js +3 -5
- package/dist/dist/thrift/thrift.writing.d.ts +49 -0
- package/{dist-ts → dist}/dist/thrift/thrift.writing.js +2 -4
- package/dist/dist/types/index.d.ts +28 -0
- package/dist/dist/useMultiFileAuthState.d.ts +267 -0
- package/{dist-ts → dist}/dist/useMultiFileAuthState.js +47 -61
- package/dist/dist/utils/helper-1.d.ts +0 -0
- package/dist/dist/utils/helper-10.d.ts +0 -0
- package/dist/dist/utils/helper-11.d.ts +0 -0
- package/dist/dist/utils/helper-12.d.ts +0 -0
- package/dist/dist/utils/helper-13.d.ts +0 -0
- package/dist/dist/utils/helper-14.d.ts +0 -0
- package/dist/dist/utils/helper-15.d.ts +0 -0
- package/dist/dist/utils/helper-16.d.ts +0 -0
- package/dist/dist/utils/helper-17.d.ts +0 -0
- package/dist/dist/utils/helper-18.d.ts +0 -0
- package/dist/dist/utils/helper-19.d.ts +0 -0
- package/dist/dist/utils/helper-2.d.ts +0 -0
- package/dist/dist/utils/helper-20.d.ts +0 -0
- package/dist/dist/utils/helper-21.d.ts +0 -0
- package/dist/dist/utils/helper-22.d.ts +0 -0
- package/dist/dist/utils/helper-23.d.ts +0 -0
- package/dist/dist/utils/helper-24.d.ts +0 -0
- package/dist/dist/utils/helper-25.d.ts +0 -0
- package/dist/dist/utils/helper-26.d.ts +0 -0
- package/dist/dist/utils/helper-27.d.ts +0 -0
- package/dist/dist/utils/helper-28.d.ts +0 -0
- package/dist/dist/utils/helper-29.d.ts +0 -0
- package/dist/dist/utils/helper-3.d.ts +0 -0
- package/dist/dist/utils/helper-30.d.ts +0 -0
- package/dist/dist/utils/helper-4.d.ts +0 -0
- package/dist/dist/utils/helper-5.d.ts +0 -0
- package/dist/dist/utils/helper-6.d.ts +0 -0
- package/dist/dist/utils/helper-7.d.ts +0 -0
- package/dist/dist/utils/helper-8.d.ts +0 -0
- package/dist/dist/utils/helper-9.d.ts +0 -0
- package/dist/dist/utils/index.d.ts +56 -0
- package/{dist-ts → dist}/dist/utils/index.js +1 -2
- package/dist/dist/utils/insta-mqtt-helper.d.ts +30 -0
- package/dist/examples/listen-to-messages.d.ts +4 -0
- package/{dist-ts → dist}/examples/listen-to-messages.js +1 -2
- package/package.json +41 -38
- package/dist-ts/dist/fbns/fbns.device-auth.js +0 -59
- package/dist-ts/dist/realtime/features/dm-sender.js +0 -94
- package/dist-ts/dist/realtime/features/presence.manager.js +0 -68
- package/dist-ts/dist/realtime/features/session-health-monitor.js +0 -327
- package/dist-ts/dist/realtime/parsers/graphql.parser.js +0 -22
- package/dist-ts/dist/realtime/protocols/skywalker.protocol.js +0 -96
- package/dist-ts/dist/shared/index.js +0 -98
- package/examples/listen-to-messages.js +0 -86
- package/src-ts/dist/constants/constants.ts +0 -342
- package/src-ts/dist/constants/index.ts +0 -58
- package/src-ts/dist/core/client.ts +0 -419
- package/src-ts/dist/core/nav-chain.ts +0 -282
- package/src-ts/dist/core/repository.ts +0 -7
- package/src-ts/dist/core/request.ts +0 -395
- package/src-ts/dist/core/state.ts +0 -1484
- package/src-ts/dist/core/utils.ts +0 -786
- package/src-ts/dist/downloadMedia.ts +0 -381
- package/src-ts/dist/errors/index.ts +0 -38
- package/src-ts/dist/extend.ts +0 -167
- package/src-ts/dist/fbns/fbns.client.events.ts +0 -3
- package/src-ts/dist/fbns/fbns.client.ts +0 -252
- package/src-ts/dist/fbns/fbns.types.ts +0 -3
- package/src-ts/dist/fbns/fbns.utilities.ts +0 -79
- package/src-ts/dist/fbns/index.ts +0 -21
- package/src-ts/dist/index.ts +0 -139
- package/src-ts/dist/mqtt-shim.ts +0 -15
- package/src-ts/dist/mqttot/index.ts +0 -21
- package/src-ts/dist/mqttot/mqttot.client.ts +0 -318
- package/src-ts/dist/mqttot/mqttot.connect.request.packet.ts +0 -9
- package/src-ts/dist/mqttot/mqttot.connect.response.packet.ts +0 -24
- package/src-ts/dist/mqttot/mqttot.connection.ts +0 -77
- package/src-ts/dist/realtime/commands/commands.ts +0 -71
- package/src-ts/dist/realtime/commands/direct.commands.ts +0 -417
- package/src-ts/dist/realtime/commands/enhanced.direct.commands.ts +0 -1731
- package/src-ts/dist/realtime/commands/index.ts +0 -20
- package/src-ts/dist/realtime/delta-sync.manager.ts +0 -293
- package/src-ts/dist/realtime/features/error-handler.ts +0 -185
- package/src-ts/dist/realtime/features/gap-handler.ts +0 -61
- package/src-ts/dist/realtime/features/persistent-logger.ts +0 -186
- package/src-ts/dist/realtime/index.ts +0 -30
- package/src-ts/dist/realtime/messages/app-presence.event.ts +0 -3
- package/src-ts/dist/realtime/messages/index.ts +0 -20
- package/src-ts/dist/realtime/messages/message-sync.message.ts +0 -43
- package/src-ts/dist/realtime/messages/realtime-sub.direct.data.ts +0 -3
- package/src-ts/dist/realtime/messages/thread-update.message.ts +0 -3
- package/src-ts/dist/realtime/mixins/index.ts +0 -20
- package/src-ts/dist/realtime/mixins/message-sync.mixin.ts +0 -596
- package/src-ts/dist/realtime/mixins/mixin.ts +0 -41
- package/src-ts/dist/realtime/mixins/presence-typing.mixin.ts +0 -33
- package/src-ts/dist/realtime/mixins/realtime-sub.mixin.ts +0 -181
- package/src-ts/dist/realtime/parsers/graphql-parser.ts +0 -43
- package/src-ts/dist/realtime/parsers/index.ts +0 -23
- package/src-ts/dist/realtime/parsers/iris-parser.ts +0 -43
- package/src-ts/dist/realtime/parsers/iris.parser.ts +0 -10
- package/src-ts/dist/realtime/parsers/json-parser.ts +0 -43
- package/src-ts/dist/realtime/parsers/json.parser.ts +0 -10
- package/src-ts/dist/realtime/parsers/parser.ts +0 -3
- package/src-ts/dist/realtime/parsers/region-hint-parser.ts +0 -43
- package/src-ts/dist/realtime/parsers/region-hint.parser.ts +0 -15
- package/src-ts/dist/realtime/parsers/skywalker-parser.ts +0 -43
- package/src-ts/dist/realtime/parsers/skywalker.parser.ts +0 -15
- package/src-ts/dist/realtime/parsers-advanced.ts +0 -158
- package/src-ts/dist/realtime/proto-parser.ts +0 -195
- package/src-ts/dist/realtime/protocols/iris.handshake.ts +0 -74
- package/src-ts/dist/realtime/protocols/proto-definitions.ts +0 -80
- package/src-ts/dist/realtime/realtime.client.events.ts +0 -3
- package/src-ts/dist/realtime/realtime.client.ts +0 -1996
- package/src-ts/dist/realtime/realtime.service.ts +0 -462
- package/src-ts/dist/realtime/reconnect.manager.ts +0 -88
- package/src-ts/dist/realtime/session.manager.ts +0 -121
- package/src-ts/dist/realtime/subscriptions/graphql.subscription.ts +0 -99
- package/src-ts/dist/realtime/subscriptions/index.ts +0 -19
- package/src-ts/dist/realtime/subscriptions/skywalker.subscription.ts +0 -13
- package/src-ts/dist/realtime/topic-map.ts +0 -71
- package/src-ts/dist/realtime/topic.ts +0 -80
- package/src-ts/dist/repositories/account.repository.ts +0 -1384
- package/src-ts/dist/repositories/bloks.repository.ts +0 -70
- package/src-ts/dist/repositories/captcha.repository.ts +0 -44
- package/src-ts/dist/repositories/challenge.repository.ts +0 -120
- package/src-ts/dist/repositories/clip.repository.ts +0 -165
- package/src-ts/dist/repositories/close-friends.repository.ts +0 -46
- package/src-ts/dist/repositories/collection.repository.ts +0 -68
- package/src-ts/dist/repositories/direct-thread.repository.ts +0 -446
- package/src-ts/dist/repositories/direct.repository.ts +0 -266
- package/src-ts/dist/repositories/explore.repository.ts +0 -70
- package/src-ts/dist/repositories/fbsearch.repository.ts +0 -140
- package/src-ts/dist/repositories/feed.repository.ts +0 -245
- package/src-ts/dist/repositories/friendship.repository.ts +0 -296
- package/src-ts/dist/repositories/fundraiser.repository.ts +0 -49
- package/src-ts/dist/repositories/hashtag.repository.ts +0 -99
- package/src-ts/dist/repositories/highlights.repository.ts +0 -121
- package/src-ts/dist/repositories/insights.repository.ts +0 -82
- package/src-ts/dist/repositories/location.repository.ts +0 -84
- package/src-ts/dist/repositories/media.repository.ts +0 -395
- package/src-ts/dist/repositories/multiple-accounts.repository.ts +0 -41
- package/src-ts/dist/repositories/news.repository.ts +0 -35
- package/src-ts/dist/repositories/note.repository.ts +0 -57
- package/src-ts/dist/repositories/notification.repository.ts +0 -79
- package/src-ts/dist/repositories/share.repository.ts +0 -35
- package/src-ts/dist/repositories/signup.repository.ts +0 -218
- package/src-ts/dist/repositories/story.repository.ts +0 -290
- package/src-ts/dist/repositories/timeline.repository.ts +0 -60
- package/src-ts/dist/repositories/totp.repository.ts +0 -139
- package/src-ts/dist/repositories/track.repository.ts +0 -53
- package/src-ts/dist/repositories/upload.repository.ts +0 -204
- package/src-ts/dist/repositories/user.repository.ts +0 -360
- package/src-ts/dist/sendmedia/index.ts +0 -27
- package/src-ts/dist/sendmedia/sendFile.ts +0 -72
- package/src-ts/dist/sendmedia/sendPhoto.ts +0 -142
- package/src-ts/dist/sendmedia/sendRavenPhoto.ts +0 -153
- package/src-ts/dist/sendmedia/sendRavenVideo.ts +0 -158
- package/src-ts/dist/sendmedia/uploadPhoto.ts +0 -107
- package/src-ts/dist/sendmedia/uploadfFile.ts +0 -130
- package/src-ts/dist/services/live.service.ts +0 -139
- package/src-ts/dist/services/search.service.ts +0 -115
- package/src-ts/dist/shared/shared.ts +0 -86
- package/src-ts/dist/thrift/index.ts +0 -20
- package/src-ts/dist/thrift/thrift.reading.ts +0 -368
- package/src-ts/dist/thrift/thrift.ts +0 -111
- package/src-ts/dist/thrift/thrift.writing.ts +0 -396
- package/src-ts/dist/types/index.ts +0 -285
- package/src-ts/dist/useMultiFileAuthState.ts +0 -1800
- package/src-ts/dist/utils/helper-1.ts +0 -1
- package/src-ts/dist/utils/helper-10.ts +0 -1
- package/src-ts/dist/utils/helper-11.ts +0 -1
- package/src-ts/dist/utils/helper-12.ts +0 -1
- package/src-ts/dist/utils/helper-13.ts +0 -1
- package/src-ts/dist/utils/helper-14.ts +0 -1
- package/src-ts/dist/utils/helper-15.ts +0 -1
- package/src-ts/dist/utils/helper-16.ts +0 -1
- package/src-ts/dist/utils/helper-17.ts +0 -1
- package/src-ts/dist/utils/helper-18.ts +0 -1
- package/src-ts/dist/utils/helper-19.ts +0 -1
- package/src-ts/dist/utils/helper-2.ts +0 -1
- package/src-ts/dist/utils/helper-20.ts +0 -1
- package/src-ts/dist/utils/helper-21.ts +0 -1
- package/src-ts/dist/utils/helper-22.ts +0 -1
- package/src-ts/dist/utils/helper-23.ts +0 -1
- package/src-ts/dist/utils/helper-24.ts +0 -1
- package/src-ts/dist/utils/helper-25.ts +0 -1
- package/src-ts/dist/utils/helper-26.ts +0 -1
- package/src-ts/dist/utils/helper-27.ts +0 -1
- package/src-ts/dist/utils/helper-28.ts +0 -1
- package/src-ts/dist/utils/helper-29.ts +0 -1
- package/src-ts/dist/utils/helper-3.ts +0 -1
- package/src-ts/dist/utils/helper-30.ts +0 -1
- package/src-ts/dist/utils/helper-4.ts +0 -1
- package/src-ts/dist/utils/helper-5.ts +0 -1
- package/src-ts/dist/utils/helper-6.ts +0 -1
- package/src-ts/dist/utils/helper-7.ts +0 -1
- package/src-ts/dist/utils/helper-8.ts +0 -1
- package/src-ts/dist/utils/helper-9.ts +0 -1
- package/src-ts/dist/utils/index.ts +0 -280
- package/src-ts/dist/utils/insta-mqtt-helper.ts +0 -128
- package/src-ts/examples/listen-to-messages.ts +0 -86
- /package/{dist-ts → dist}/dist/constants/constants.js +0 -0
- /package/{dist-ts → dist}/dist/constants/index.js +0 -0
- /package/{dist-ts → dist}/dist/core/client.js +0 -0
- /package/{dist-ts → dist}/dist/core/nav-chain.js +0 -0
- /package/{dist-ts → dist}/dist/core/repository.js +0 -0
- /package/{dist-ts → dist}/dist/core/request.js +0 -0
- /package/{dist-ts → dist}/dist/core/state.js +0 -0
- /package/{dist-ts → dist}/dist/core/utils.js +0 -0
- /package/{dist-ts → dist}/dist/errors/index.js +0 -0
- /package/{dist-ts → dist}/dist/extend.js +0 -0
- /package/{dist-ts → dist}/dist/fbns/fbns.client.events.js +0 -0
- /package/{dist-ts → dist}/dist/fbns/fbns.types.js +0 -0
- /package/{dist-ts → dist}/dist/fbns/fbns.utilities.js +0 -0
- /package/{dist-ts → dist}/dist/fbns/index.js +0 -0
- /package/{dist-ts → dist}/dist/index.js +0 -0
- /package/{dist-ts → dist}/dist/mqtt-shim.js +0 -0
- /package/{dist-ts → dist}/dist/mqttot/index.js +0 -0
- /package/{dist-ts → dist}/dist/mqttot/mqttot.connect.request.packet.js +0 -0
- /package/{dist-ts → dist}/dist/mqttot/mqttot.connect.response.packet.js +0 -0
- /package/{dist-ts → dist}/dist/mqttot/mqttot.connection.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/commands/commands.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/commands/direct.commands.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/commands/index.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/features/gap-handler.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/index.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/messages/app-presence.event.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/messages/index.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/messages/message-sync.message.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/messages/realtime-sub.direct.data.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/messages/thread-update.message.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/mixins/index.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/mixins/mixin.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/mixins/presence-typing.mixin.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/parsers/graphql-parser.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/parsers/index.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/parsers/iris-parser.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/parsers/iris.parser.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/parsers/json-parser.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/parsers/json.parser.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/parsers/parser.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/parsers/region-hint-parser.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/parsers/region-hint.parser.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/parsers/skywalker-parser.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/parsers/skywalker.parser.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/protocols/iris.handshake.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/protocols/proto-definitions.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/realtime.client.events.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/realtime.service.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/reconnect.manager.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/session.manager.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/subscriptions/graphql.subscription.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/subscriptions/index.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/subscriptions/skywalker.subscription.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/topic-map.js +0 -0
- /package/{dist-ts → dist}/dist/realtime/topic.js +0 -0
- /package/{dist-ts → dist}/dist/repositories/bloks.repository.js +0 -0
- /package/{dist-ts → dist}/dist/repositories/captcha.repository.js +0 -0
- /package/{dist-ts → dist}/dist/repositories/clip.repository.js +0 -0
- /package/{dist-ts → dist}/dist/repositories/close-friends.repository.js +0 -0
- /package/{dist-ts → dist}/dist/repositories/collection.repository.js +0 -0
- /package/{dist-ts → dist}/dist/repositories/explore.repository.js +0 -0
- /package/{dist-ts → dist}/dist/repositories/fbsearch.repository.js +0 -0
- /package/{dist-ts → dist}/dist/repositories/feed.repository.js +0 -0
- /package/{dist-ts → dist}/dist/repositories/friendship.repository.js +0 -0
- /package/{dist-ts → dist}/dist/repositories/fundraiser.repository.js +0 -0
- /package/{dist-ts → dist}/dist/repositories/hashtag.repository.js +0 -0
- /package/{dist-ts → dist}/dist/repositories/highlights.repository.js +0 -0
- /package/{dist-ts → dist}/dist/repositories/insights.repository.js +0 -0
- /package/{dist-ts → dist}/dist/repositories/location.repository.js +0 -0
- /package/{dist-ts → dist}/dist/repositories/multiple-accounts.repository.js +0 -0
- /package/{dist-ts → dist}/dist/repositories/news.repository.js +0 -0
- /package/{dist-ts → dist}/dist/repositories/note.repository.js +0 -0
- /package/{dist-ts → dist}/dist/repositories/share.repository.js +0 -0
- /package/{dist-ts → dist}/dist/repositories/signup.repository.js +0 -0
- /package/{dist-ts → dist}/dist/repositories/timeline.repository.js +0 -0
- /package/{dist-ts → dist}/dist/repositories/totp.repository.js +0 -0
- /package/{dist-ts → dist}/dist/repositories/user.repository.js +0 -0
- /package/{dist-ts → dist}/dist/sendmedia/index.js +0 -0
- /package/{dist-ts → dist}/dist/sendmedia/sendFile.js +0 -0
- /package/{dist-ts → dist}/dist/sendmedia/sendPhoto.js +0 -0
- /package/{dist-ts → dist}/dist/sendmedia/uploadPhoto.js +0 -0
- /package/{dist-ts → dist}/dist/services/live.service.js +0 -0
- /package/{dist-ts → dist}/dist/services/search.service.js +0 -0
- /package/{dist-ts → dist}/dist/shared/shared.js +0 -0
- /package/{dist-ts → dist}/dist/thrift/index.js +0 -0
- /package/{dist-ts → dist}/dist/thrift/thrift.js +0 -0
- /package/{dist-ts → dist}/dist/types/index.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-1.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-10.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-11.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-12.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-13.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-14.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-15.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-16.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-17.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-18.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-19.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-2.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-20.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-21.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-22.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-23.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-24.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-25.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-26.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-27.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-28.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-29.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-3.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-30.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-4.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-5.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-6.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-7.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-8.js +0 -0
- /package/{dist-ts → dist}/dist/utils/helper-9.js +0 -0
- /package/{dist-ts → dist}/dist/utils/insta-mqtt-helper.js +0 -0
|
@@ -1,596 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MessageSyncMixin = void 0;
|
|
4
|
-
const mixin_1 = require("./mixin");
|
|
5
|
-
const constants_1 = require("../../constants");
|
|
6
|
-
const shared_1 = require("../../shared")
|
|
7
|
-
const mqtts_1 = require("mqtts");
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* MessageSyncMixin - patched for 2026 (robust parsing + safe username fetch + tolerant timestamp handling)
|
|
11
|
-
*
|
|
12
|
-
* Changes applied:
|
|
13
|
-
* - tolerant parsing for e.value (string / object / already-parsed)
|
|
14
|
-
* - support for several path shapes when extracting thread id
|
|
15
|
-
* - safer timestamp parsing (accepts seconds, milliseconds, microseconds, nanoseconds)
|
|
16
|
-
* - username fetch uses a pending map + small backoff to reduce rush/rate-limit risk
|
|
17
|
-
* - defensive try/catch around JSON.parse and all external calls
|
|
18
|
-
* - keeps original API: apply(client) registers post-connect hook and emits same events
|
|
19
|
-
*
|
|
20
|
-
* Additional change requested:
|
|
21
|
-
* - set message status to 'received' for incoming messages and 'sent' for messages authored by the logged-in account,
|
|
22
|
-
* instead of the previous 'good'.
|
|
23
|
-
*
|
|
24
|
-
* Note: No rate-limiting code is included.
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
class MessageSyncMixin extends mixin_1.Mixin {
|
|
28
|
-
constructor() {
|
|
29
|
-
super();
|
|
30
|
-
this.userCache = new Map();
|
|
31
|
-
this.pendingUserFetches = new Map();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
apply(client) {
|
|
35
|
-
console.log(`\n[MESSAGE_SYNC MIXIN] Applying mixin...`);
|
|
36
|
-
|
|
37
|
-
(0, mixin_1.hook)(client, 'connect', {
|
|
38
|
-
post: async () => {
|
|
39
|
-
console.log(`[MESSAGE_SYNC] Post-connect hook called`);
|
|
40
|
-
|
|
41
|
-
let retries = 0;
|
|
42
|
-
while (!client.mqtt && retries < 50) {
|
|
43
|
-
await new Promise(r => setTimeout(r, 100));
|
|
44
|
-
retries++;
|
|
45
|
-
}
|
|
46
|
-
if (!client.mqtt) {
|
|
47
|
-
throw new mqtts_1.IllegalStateError('No mqtt client created after retries');
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
console.log(`[MESSAGE_SYNC] MQTT ready, registering listen() on topic 146 (MESSAGE_SYNC)`);
|
|
51
|
-
|
|
52
|
-
if (client.mqtt.listen) {
|
|
53
|
-
console.log(`[MESSAGE_SYNC] mqtt.listen() method found, registering callback...`);
|
|
54
|
-
client.mqtt.listen({
|
|
55
|
-
topic: constants_1.Topics.MESSAGE_SYNC.id,
|
|
56
|
-
transformer: async ({ payload }) => {
|
|
57
|
-
try {
|
|
58
|
-
const unzipped = await (0, shared_1.tryUnzipAsync)(payload);
|
|
59
|
-
const parsed = constants_1.Topics.MESSAGE_SYNC.parser
|
|
60
|
-
.parseMessage(constants_1.Topics.MESSAGE_SYNC, unzipped)
|
|
61
|
-
.map(msg => msg.data);
|
|
62
|
-
return parsed;
|
|
63
|
-
} catch (err) {
|
|
64
|
-
// If transformer fails, return empty array so handler is tolerant
|
|
65
|
-
console.warn('[MESSAGE_SYNC] transformer parse failed:', err?.message || err);
|
|
66
|
-
return [];
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
}, data => {
|
|
70
|
-
this.handleMessageSync(client, data);
|
|
71
|
-
});
|
|
72
|
-
} else {
|
|
73
|
-
console.log(`[MESSAGE_SYNC] mqtt.listen() NOT FOUND - using fallback 'receive' event`);
|
|
74
|
-
client.on('receive', (topic, messages) => {
|
|
75
|
-
try {
|
|
76
|
-
if (topic.id === constants_1.Topics.MESSAGE_SYNC.id) {
|
|
77
|
-
const data = messages.map(m => m.data);
|
|
78
|
-
this.handleMessageSync(client, data);
|
|
79
|
-
}
|
|
80
|
-
} catch (err) {
|
|
81
|
-
console.warn('[MESSAGE_SYNC] receive fallback handler error:', err?.message || err);
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
async getUsernameFromId(client, userId) {
|
|
90
|
-
if (!userId) return null;
|
|
91
|
-
|
|
92
|
-
const userIdStr = String(userId);
|
|
93
|
-
|
|
94
|
-
if (this.userCache.has(userIdStr)) {
|
|
95
|
-
return this.userCache.get(userIdStr);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (this.pendingUserFetches.has(userIdStr)) {
|
|
99
|
-
try {
|
|
100
|
-
return await this.pendingUserFetches.get(userIdStr);
|
|
101
|
-
} catch (e) {
|
|
102
|
-
// if pending fetch failed, continue to fresh attempt
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const fetchPromise = (async () => {
|
|
107
|
-
try {
|
|
108
|
-
// small backoff to avoid immediate burst of parallel requests
|
|
109
|
-
await new Promise(r => setTimeout(r, 120));
|
|
110
|
-
if (client.ig && client.ig.user && client.ig.user.info) {
|
|
111
|
-
try {
|
|
112
|
-
const userInfo = await client.ig.user.info(userIdStr);
|
|
113
|
-
if (userInfo && userInfo.username) {
|
|
114
|
-
this.userCache.set(userIdStr, userInfo.username);
|
|
115
|
-
return userInfo.username;
|
|
116
|
-
}
|
|
117
|
-
} catch (innerErr) {
|
|
118
|
-
// rate-limited or not found - swallow
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
} catch (err) {
|
|
122
|
-
// Silently fail - will use ID instead
|
|
123
|
-
}
|
|
124
|
-
return null;
|
|
125
|
-
})();
|
|
126
|
-
|
|
127
|
-
this.pendingUserFetches.set(userIdStr, fetchPromise);
|
|
128
|
-
const result = await fetchPromise;
|
|
129
|
-
this.pendingUserFetches.delete(userIdStr);
|
|
130
|
-
|
|
131
|
-
return result;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
extractMessageContent(msgValue, itemType) {
|
|
135
|
-
let content = '';
|
|
136
|
-
let mediaInfo = '';
|
|
137
|
-
|
|
138
|
-
try {
|
|
139
|
-
switch (itemType) {
|
|
140
|
-
case 'text':
|
|
141
|
-
content = msgValue.text || msgValue.body || '';
|
|
142
|
-
break;
|
|
143
|
-
|
|
144
|
-
case 'media':
|
|
145
|
-
case 'raven_media':
|
|
146
|
-
content = '[PHOTO/VIDEO]';
|
|
147
|
-
if (msgValue.media) {
|
|
148
|
-
const media = msgValue.media;
|
|
149
|
-
if (media.image_versions2) {
|
|
150
|
-
content = '[PHOTO]';
|
|
151
|
-
mediaInfo = ` URL: ${media.image_versions2?.candidates?.[0]?.url || 'N/A'}`;
|
|
152
|
-
} else if (media.video_versions) {
|
|
153
|
-
content = '[VIDEO]';
|
|
154
|
-
mediaInfo = ` Duration: ${media.video_duration || 'N/A'}s`;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
if (msgValue.visual_media) {
|
|
158
|
-
content = '[DISAPPEARING MEDIA]';
|
|
159
|
-
}
|
|
160
|
-
break;
|
|
161
|
-
|
|
162
|
-
case 'voice_media':
|
|
163
|
-
content = '[VOICE MESSAGE]';
|
|
164
|
-
if (msgValue.voice_media?.media?.audio) {
|
|
165
|
-
const duration = msgValue.voice_media.media.audio.duration || 0;
|
|
166
|
-
content = `[VOICE MESSAGE] Duration: ${duration}ms`;
|
|
167
|
-
}
|
|
168
|
-
break;
|
|
169
|
-
|
|
170
|
-
case 'animated_media':
|
|
171
|
-
content = '[GIF]';
|
|
172
|
-
if (msgValue.animated_media?.images?.fixed_height?.url) {
|
|
173
|
-
mediaInfo = ` URL: ${msgValue.animated_media.images.fixed_height.url}`;
|
|
174
|
-
}
|
|
175
|
-
break;
|
|
176
|
-
|
|
177
|
-
case 'media_share':
|
|
178
|
-
content = '[SHARED POST]';
|
|
179
|
-
if (msgValue.media_share) {
|
|
180
|
-
const share = msgValue.media_share;
|
|
181
|
-
content = `[SHARED POST] From: @${share.user?.username || 'unknown'}`;
|
|
182
|
-
if (share.caption?.text) {
|
|
183
|
-
content += ` Caption: "${String(share.caption.text).substring(0, 50)}..."`;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
break;
|
|
187
|
-
|
|
188
|
-
case 'reel_share':
|
|
189
|
-
content = '[SHARED REEL]';
|
|
190
|
-
if (msgValue.reel_share) {
|
|
191
|
-
const reel = msgValue.reel_share;
|
|
192
|
-
content = `[SHARED REEL] From: @${reel.media?.user?.username || 'unknown'}`;
|
|
193
|
-
if (reel.text) {
|
|
194
|
-
content += ` Text: "${reel.text}"`;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
break;
|
|
198
|
-
|
|
199
|
-
case 'story_share':
|
|
200
|
-
content = '[SHARED STORY]';
|
|
201
|
-
if (msgValue.story_share) {
|
|
202
|
-
const story = msgValue.story_share;
|
|
203
|
-
content = `[SHARED STORY] From: @${story.media?.user?.username || 'unknown'}`;
|
|
204
|
-
if (story.message) {
|
|
205
|
-
content += ` Message: "${story.message}"`;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
break;
|
|
209
|
-
|
|
210
|
-
case 'felix_share':
|
|
211
|
-
content = '[SHARED IGTV/VIDEO]';
|
|
212
|
-
if (msgValue.felix_share?.video) {
|
|
213
|
-
content = `[SHARED IGTV] Title: "${msgValue.felix_share.video.title || 'N/A'}"`;
|
|
214
|
-
}
|
|
215
|
-
break;
|
|
216
|
-
|
|
217
|
-
case 'clip':
|
|
218
|
-
content = '[SHARED CLIP]';
|
|
219
|
-
if (msgValue.clip?.clip) {
|
|
220
|
-
content = `[SHARED CLIP] From: @${msgValue.clip.clip.user?.username || 'unknown'}`;
|
|
221
|
-
}
|
|
222
|
-
break;
|
|
223
|
-
|
|
224
|
-
case 'profile':
|
|
225
|
-
content = '[SHARED PROFILE]';
|
|
226
|
-
if (msgValue.profile) {
|
|
227
|
-
content = `[SHARED PROFILE] @${msgValue.profile.username || 'unknown'}`;
|
|
228
|
-
}
|
|
229
|
-
break;
|
|
230
|
-
|
|
231
|
-
case 'location':
|
|
232
|
-
content = '[LOCATION]';
|
|
233
|
-
if (msgValue.location) {
|
|
234
|
-
content = `[LOCATION] ${msgValue.location.name || msgValue.location.address || 'Unknown location'}`;
|
|
235
|
-
}
|
|
236
|
-
break;
|
|
237
|
-
|
|
238
|
-
case 'hashtag':
|
|
239
|
-
content = '[HASHTAG]';
|
|
240
|
-
if (msgValue.hashtag) {
|
|
241
|
-
content = `[HASHTAG] #${msgValue.hashtag.name || 'unknown'}`;
|
|
242
|
-
}
|
|
243
|
-
break;
|
|
244
|
-
|
|
245
|
-
case 'like':
|
|
246
|
-
content = '[LIKE]';
|
|
247
|
-
break;
|
|
248
|
-
|
|
249
|
-
case 'link':
|
|
250
|
-
content = '[LINK]';
|
|
251
|
-
if (msgValue.link) {
|
|
252
|
-
content = `[LINK] ${msgValue.link.text || msgValue.link.link_url || 'N/A'}`;
|
|
253
|
-
}
|
|
254
|
-
break;
|
|
255
|
-
|
|
256
|
-
case 'action_log':
|
|
257
|
-
content = '[ACTION]';
|
|
258
|
-
if (msgValue.action_log) {
|
|
259
|
-
content = `[ACTION] ${msgValue.action_log.description || 'N/A'}`;
|
|
260
|
-
}
|
|
261
|
-
break;
|
|
262
|
-
|
|
263
|
-
case 'placeholder':
|
|
264
|
-
content = '[PLACEHOLDER]';
|
|
265
|
-
if (msgValue.placeholder?.message) {
|
|
266
|
-
content = `[PLACEHOLDER] ${msgValue.placeholder.message}`;
|
|
267
|
-
}
|
|
268
|
-
break;
|
|
269
|
-
|
|
270
|
-
case 'xma':
|
|
271
|
-
case 'xma_media_share':
|
|
272
|
-
content = '[XMA SHARE]';
|
|
273
|
-
if (msgValue.xma_link_url) {
|
|
274
|
-
content = `[XMA SHARE] ${msgValue.xma_link_url}`;
|
|
275
|
-
}
|
|
276
|
-
break;
|
|
277
|
-
|
|
278
|
-
case 'video_call_event':
|
|
279
|
-
content = '[VIDEO CALL EVENT]';
|
|
280
|
-
if (msgValue.video_call_event) {
|
|
281
|
-
content = `[VIDEO CALL] ${msgValue.video_call_event.action || 'event'}`;
|
|
282
|
-
}
|
|
283
|
-
break;
|
|
284
|
-
|
|
285
|
-
default:
|
|
286
|
-
if (msgValue && (msgValue.text || msgValue.body)) {
|
|
287
|
-
content = msgValue.text || msgValue.body;
|
|
288
|
-
} else {
|
|
289
|
-
content = `[${(itemType || 'UNKNOWN').toUpperCase()}]`;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
} catch (e) {
|
|
293
|
-
// defensive fallback
|
|
294
|
-
try {
|
|
295
|
-
if (msgValue && (msgValue.text || msgValue.body)) {
|
|
296
|
-
content = msgValue.text || msgValue.body;
|
|
297
|
-
} else {
|
|
298
|
-
content = `[${(itemType || 'UNKNOWN').toUpperCase()}]`;
|
|
299
|
-
}
|
|
300
|
-
} catch (e2) {
|
|
301
|
-
content = `[${(itemType || 'UNKNOWN').toUpperCase()}]`;
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
return content + mediaInfo;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
formatMessageForConsole(msgData) {
|
|
309
|
-
const separator = '----------------------------------------';
|
|
310
|
-
// robust timestamp formatting into readable date+time in Europe/Bucharest
|
|
311
|
-
let ts = 'N/A';
|
|
312
|
-
try {
|
|
313
|
-
const parsed = this.parseTimestamp(msgData.timestamp);
|
|
314
|
-
if (parsed) {
|
|
315
|
-
const d = new Date(parsed);
|
|
316
|
-
ts = d.toLocaleString('ro-RO', {
|
|
317
|
-
year: 'numeric',
|
|
318
|
-
month: '2-digit',
|
|
319
|
-
day: '2-digit',
|
|
320
|
-
hour: '2-digit',
|
|
321
|
-
minute: '2-digit',
|
|
322
|
-
second: '2-digit',
|
|
323
|
-
hour12: false,
|
|
324
|
-
timeZone: 'Europe/Bucharest'
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
} catch (e) {
|
|
328
|
-
ts = 'N/A';
|
|
329
|
-
}
|
|
330
|
-
const lines = [
|
|
331
|
-
'',
|
|
332
|
-
separator,
|
|
333
|
-
'[NEW MESSAGE]',
|
|
334
|
-
separator,
|
|
335
|
-
`Username: ${msgData.username || 'unknown'}`,
|
|
336
|
-
`ID: ${msgData.userId || 'unknown'}`,
|
|
337
|
-
`Text: ${msgData.text || 'N/A'}`,
|
|
338
|
-
`Type: ${msgData.itemType || 'text'}`,
|
|
339
|
-
`Thread: ${msgData.threadId || 'unknown'}`,
|
|
340
|
-
`Message ID: ${msgData.messageId || 'unknown'}`,
|
|
341
|
-
`Timestamp: ${ts}`,
|
|
342
|
-
`Status: ${msgData.status || 'unknown'}`,
|
|
343
|
-
separator,
|
|
344
|
-
''
|
|
345
|
-
];
|
|
346
|
-
return lines.join('\n');
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* parseTimestamp
|
|
351
|
-
* - accepts numeric strings or numbers in seconds, milliseconds, microseconds, nanoseconds
|
|
352
|
-
* - normalizes to milliseconds
|
|
353
|
-
* - sanity-checks to avoid absurd future dates; returns Date.now() fallback if out of range
|
|
354
|
-
*/
|
|
355
|
-
parseTimestamp(ts) {
|
|
356
|
-
try {
|
|
357
|
-
if (ts === undefined || ts === null) return null;
|
|
358
|
-
// if object with .ms or similar, try common fields
|
|
359
|
-
if (typeof ts === 'object') {
|
|
360
|
-
if (ts.ms) return Number(ts.ms);
|
|
361
|
-
if (ts.seconds) return Number(ts.seconds) * 1000;
|
|
362
|
-
if (ts.nano) return Math.floor(Number(ts.nano) / 1e6);
|
|
363
|
-
// fallback to toString
|
|
364
|
-
ts = String(ts);
|
|
365
|
-
}
|
|
366
|
-
let n = Number(ts);
|
|
367
|
-
if (!Number.isFinite(n)) return null;
|
|
368
|
-
|
|
369
|
-
// Heuristics:
|
|
370
|
-
// nanoseconds ~ 1e18+, microseconds ~ 1e15+, milliseconds ~ 1e12, seconds ~ 1e9
|
|
371
|
-
if (n > 1e17) {
|
|
372
|
-
// nanoseconds -> ms
|
|
373
|
-
n = Math.floor(n / 1e6);
|
|
374
|
-
} else if (n > 1e14) {
|
|
375
|
-
// microseconds -> ms
|
|
376
|
-
n = Math.floor(n / 1e3);
|
|
377
|
-
} else if (n > 1e12) {
|
|
378
|
-
// likely already ms (leave)
|
|
379
|
-
n = Math.floor(n);
|
|
380
|
-
} else if (n > 1e9) {
|
|
381
|
-
// seconds -> ms
|
|
382
|
-
n = Math.floor(n * 1000);
|
|
383
|
-
} else if (n > 1e6) {
|
|
384
|
-
// ambiguous (older formats) -> treat as seconds -> ms
|
|
385
|
-
n = Math.floor(n * 1000);
|
|
386
|
-
} else {
|
|
387
|
-
// too small -> invalid
|
|
388
|
-
return null;
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
// sanity range: allow roughly 2010-2036 (ms)
|
|
392
|
-
const min = 1262304000000; // 2010-01-01
|
|
393
|
-
const max = 2114380800000; // 2037-01-01 (safe future upper bound)
|
|
394
|
-
if (!Number.isFinite(n) || n < min || n > max) {
|
|
395
|
-
// fallback to now to avoid huge future years displayed
|
|
396
|
-
return Date.now();
|
|
397
|
-
}
|
|
398
|
-
return n;
|
|
399
|
-
} catch (e) {
|
|
400
|
-
return null;
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
async handleMessageSync(client, syncData) {
|
|
405
|
-
if (!syncData || !Array.isArray(syncData)) {
|
|
406
|
-
console.log(`[MESSAGE_SYNC] No sync data received`);
|
|
407
|
-
return;
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
for (const element of syncData) {
|
|
411
|
-
try {
|
|
412
|
-
const data = element.data;
|
|
413
|
-
|
|
414
|
-
if (!data) {
|
|
415
|
-
// fallback: emit iris with original element
|
|
416
|
-
client.emit('iris', element);
|
|
417
|
-
continue;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
// ensure element.data removed in downstream parsed message (keeps original behavior)
|
|
421
|
-
delete element.data;
|
|
422
|
-
|
|
423
|
-
for (const e of data) {
|
|
424
|
-
try {
|
|
425
|
-
// tolerant handling: e.value may be string, object, null, or already parsed
|
|
426
|
-
let parsedValue = {};
|
|
427
|
-
if (e.value === undefined || e.value === null) {
|
|
428
|
-
parsedValue = {};
|
|
429
|
-
} else if (typeof e.value === 'string') {
|
|
430
|
-
const str = e.value.trim();
|
|
431
|
-
if (str.length === 0) {
|
|
432
|
-
parsedValue = {};
|
|
433
|
-
} else {
|
|
434
|
-
try {
|
|
435
|
-
parsedValue = JSON.parse(str);
|
|
436
|
-
} catch (errJson) {
|
|
437
|
-
// If not JSON, attempt basic fallback (sometimes server sends plain key=value or quoted)
|
|
438
|
-
try {
|
|
439
|
-
// try to safe-evaluate limited forms like a bare object without quotes (rare)
|
|
440
|
-
parsedValue = {};
|
|
441
|
-
} catch (err2) {
|
|
442
|
-
parsedValue = {};
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
} else if (typeof e.value === 'object') {
|
|
447
|
-
parsedValue = e.value;
|
|
448
|
-
} else {
|
|
449
|
-
parsedValue = {};
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
// Sometimes the message payload is nested under 'message' or similar
|
|
453
|
-
const msgValue = parsedValue.message || parsedValue.data || parsedValue || {};
|
|
454
|
-
|
|
455
|
-
if (!e.path) {
|
|
456
|
-
// no path means iris-like delta; merge element + e
|
|
457
|
-
client.emit('iris', { ...element, ...e, value: msgValue });
|
|
458
|
-
continue;
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
// normalize path check for thread messages
|
|
462
|
-
if ((e.path && e.path.startsWith('/direct_v2/threads')) ||
|
|
463
|
-
(e.path && e.path.startsWith('/direct_v2/inbox/threads')) ||
|
|
464
|
-
(e.path && e.path.indexOf('/direct_v2/threads/') !== -1) ) {
|
|
465
|
-
|
|
466
|
-
if (msgValue && (msgValue.item_type || msgValue.itemType || msgValue.type || msgValue.msg_type)) {
|
|
467
|
-
// determine item type as robustly as possible
|
|
468
|
-
const itemType = msgValue.item_type || msgValue.itemType || msgValue.type || msgValue.msg_type || 'text';
|
|
469
|
-
|
|
470
|
-
// thread id extraction
|
|
471
|
-
const threadId = MessageSyncMixin.getThreadIdFromPath(e.path);
|
|
472
|
-
|
|
473
|
-
// user id resolution: try many possible fields
|
|
474
|
-
const userId = msgValue.user_id || msgValue.from_user_id || msgValue.sender_id || msgValue.userId || msgValue.senderId || null;
|
|
475
|
-
|
|
476
|
-
// username resolution: prefer embedded username, otherwise fetch
|
|
477
|
-
let username = msgValue.username || msgValue.from_username || null;
|
|
478
|
-
if (!username && userId) {
|
|
479
|
-
try {
|
|
480
|
-
username = await this.getUsernameFromId(client, userId);
|
|
481
|
-
} catch (ux) {
|
|
482
|
-
username = null;
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
if (!username) {
|
|
486
|
-
username = `user_${userId || 'unknown'}`;
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
const textContent = this.extractMessageContent(msgValue, itemType);
|
|
490
|
-
|
|
491
|
-
const messageId = msgValue.item_id || msgValue.id || msgValue.client_context || msgValue.client_context_id || msgValue.message_id || msgValue.messageId || null;
|
|
492
|
-
const timestamp = msgValue.timestamp || msgValue.ts || msgValue.client_time || null;
|
|
493
|
-
|
|
494
|
-
// determine status based on whether message author is the logged-in account
|
|
495
|
-
let status = 'received';
|
|
496
|
-
try {
|
|
497
|
-
const ownId = client?.ig?.state?.cookieUserId || client?.ig?.state?.userId || null;
|
|
498
|
-
if (ownId && userId && String(userId) === String(ownId)) {
|
|
499
|
-
status = 'sent';
|
|
500
|
-
} else {
|
|
501
|
-
status = 'received';
|
|
502
|
-
}
|
|
503
|
-
} catch (stErr) {
|
|
504
|
-
status = 'received';
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
const msgData = {
|
|
508
|
-
username: username,
|
|
509
|
-
userId: userId,
|
|
510
|
-
text: textContent,
|
|
511
|
-
itemType: itemType,
|
|
512
|
-
threadId: threadId,
|
|
513
|
-
messageId: messageId,
|
|
514
|
-
timestamp: timestamp,
|
|
515
|
-
status: status,
|
|
516
|
-
rawData: msgValue
|
|
517
|
-
};
|
|
518
|
-
|
|
519
|
-
// console output (keeps original formatted block)
|
|
520
|
-
try {
|
|
521
|
-
console.log(this.formatMessageForConsole(msgData));
|
|
522
|
-
} catch (eLog) {
|
|
523
|
-
// don't let logging break processing
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
const parsedMessage = {
|
|
527
|
-
...element,
|
|
528
|
-
message: {
|
|
529
|
-
path: e.path,
|
|
530
|
-
op: e.op,
|
|
531
|
-
thread_id: threadId,
|
|
532
|
-
...msgValue,
|
|
533
|
-
},
|
|
534
|
-
parsed: msgData
|
|
535
|
-
};
|
|
536
|
-
|
|
537
|
-
client.emit('message', parsedMessage);
|
|
538
|
-
continue;
|
|
539
|
-
} // end if msgValue has item_type
|
|
540
|
-
} // end if path matches threads
|
|
541
|
-
|
|
542
|
-
// If not a thread message, emit as threadUpdate or iris depending on payload
|
|
543
|
-
try {
|
|
544
|
-
const updateValue = e.value ? (typeof e.value === 'string' ? (() => {
|
|
545
|
-
try { return JSON.parse(e.value); } catch { return e.value; }
|
|
546
|
-
})() : e.value) : {};
|
|
547
|
-
client.emit('threadUpdate', {
|
|
548
|
-
...element,
|
|
549
|
-
meta: {
|
|
550
|
-
path: e.path,
|
|
551
|
-
op: e.op,
|
|
552
|
-
thread_id: MessageSyncMixin.getThreadIdFromPath(e.path),
|
|
553
|
-
},
|
|
554
|
-
update: updateValue,
|
|
555
|
-
});
|
|
556
|
-
} catch (errUpdate) {
|
|
557
|
-
client.emit('iris', { ...element, ...e, value: parsedValue });
|
|
558
|
-
}
|
|
559
|
-
} catch (inner) {
|
|
560
|
-
console.log(`[MESSAGE_SYNC] element handling error: ${inner?.message || inner}`);
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
} catch (outer) {
|
|
564
|
-
console.log(`[MESSAGE_SYNC] item error: ${outer?.message || outer}`);
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
static getThreadIdFromPath(path) {
|
|
570
|
-
if (!path) return undefined;
|
|
571
|
-
// Common patterns:
|
|
572
|
-
// /direct_v2/threads/<thread_id>/...
|
|
573
|
-
// /direct_v2/inbox/threads/<thread_id>/...
|
|
574
|
-
// /direct_v2/threads/<thread_id>
|
|
575
|
-
// possibly with trailing segments
|
|
576
|
-
try {
|
|
577
|
-
let m = path.match(/\/direct_v2\/threads\/(\d+)/);
|
|
578
|
-
if (m && m[1]) return m[1];
|
|
579
|
-
m = path.match(/\/direct_v2\/inbox\/threads\/(\d+)/);
|
|
580
|
-
if (m && m[1]) return m[1];
|
|
581
|
-
m = path.match(/\/direct_v2\/inbox\/(\d+)/);
|
|
582
|
-
if (m && m[1]) return m[1];
|
|
583
|
-
// last resort: look for any long numeric id in path
|
|
584
|
-
const anyId = path.match(/(\d{6,})/);
|
|
585
|
-
if (anyId && anyId[1]) return anyId[1];
|
|
586
|
-
} catch (e) {
|
|
587
|
-
// ignore
|
|
588
|
-
}
|
|
589
|
-
return undefined;
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
get name() {
|
|
593
|
-
return 'Message Sync';
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
exports.MessageSyncMixin = MessageSyncMixin;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hook = exports.applyMixins = exports.Mixin = void 0;
|
|
4
|
-
class Mixin {
|
|
5
|
-
}
|
|
6
|
-
exports.Mixin = Mixin;
|
|
7
|
-
function applyMixins(mixins, client, ig) {
|
|
8
|
-
for (const mixin of mixins)
|
|
9
|
-
mixin.apply(client, ig);
|
|
10
|
-
}
|
|
11
|
-
exports.applyMixins = applyMixins;
|
|
12
|
-
function hook(target, key, hooks) {
|
|
13
|
-
const base = target[key];
|
|
14
|
-
const wrapper = (...args) => {
|
|
15
|
-
let returnValue;
|
|
16
|
-
let overrideReturn = false;
|
|
17
|
-
if (hooks.pre) {
|
|
18
|
-
const res = hooks.pre.apply(target, args);
|
|
19
|
-
if (typeof res === 'object' && res.overrideReturn) {
|
|
20
|
-
overrideReturn = true;
|
|
21
|
-
returnValue = res.returnValue;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
const actualReturn = base.apply(target, args);
|
|
25
|
-
if (!overrideReturn)
|
|
26
|
-
returnValue = actualReturn;
|
|
27
|
-
if (hooks.post) {
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- it's always defined
|
|
29
|
-
const res = hooks.post.apply(target, [returnValue, ...args]);
|
|
30
|
-
if (typeof res === 'object' && res.overrideReturn) {
|
|
31
|
-
returnValue = res.returnValue;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
// @ts-expect-error -- return value will be set [if pre sets it, else overrideReturn is false and it will be set by the actual function
|
|
35
|
-
return returnValue;
|
|
36
|
-
};
|
|
37
|
-
// @ts-expect-error -- any[] vs Parameters<Fn>
|
|
38
|
-
target[key] = wrapper.bind(target);
|
|
39
|
-
}
|
|
40
|
-
exports.hook = hook;
|
|
41
|
-
//# sourceMappingURL=mixin.js.map
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PresenceTypingMixin = void 0;
|
|
4
|
-
const presence_manager_1 = require("../features/presence.manager");
|
|
5
|
-
const skywalker_protocol_1 = require("../protocols/skywalker.protocol");
|
|
6
|
-
/**
|
|
7
|
-
* Mixin for handling Presence and Typing Indicators
|
|
8
|
-
*/
|
|
9
|
-
class PresenceTypingMixin {
|
|
10
|
-
apply(client) {
|
|
11
|
-
// Initialize managers
|
|
12
|
-
client.presenceManager = new presence_manager_1.PresenceManager(client);
|
|
13
|
-
client.skywalkerProtocol = new skywalker_protocol_1.SkywalkerProtocol(client);
|
|
14
|
-
|
|
15
|
-
// Add public methods
|
|
16
|
-
client.sendTyping = async (threadId, isTyping = true) => {
|
|
17
|
-
return client.skywalkerProtocol.sendTypingIndicator(threadId, isTyping);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
client.sendReaction = async (messageId, threadId, emoji) => {
|
|
21
|
-
return client.skywalkerProtocol.sendReaction(messageId, threadId, emoji);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
client.broadcastPresence = async (status = 'online') => {
|
|
25
|
-
return client.presenceManager.broadcastPresence(status);
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
get name() {
|
|
30
|
-
return 'Presence & Typing';
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.PresenceTypingMixin = PresenceTypingMixin;
|