nodejs-insta-private-api-mqt 1.3.83 → 1.3.84
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-ts/dist/constants/constants.js +341 -0
- package/dist-ts/dist/constants/index.js +53 -0
- package/dist-ts/dist/core/client.js +437 -0
- package/dist-ts/dist/core/nav-chain.js +252 -0
- package/dist-ts/dist/core/repository.js +6 -0
- package/dist-ts/dist/core/request.js +358 -0
- package/dist-ts/dist/core/state.js +1428 -0
- package/dist-ts/dist/core/utils.js +723 -0
- package/dist-ts/dist/downloadMedia.js +336 -0
- package/dist-ts/dist/errors/index.js +37 -0
- package/dist-ts/dist/extend.js +157 -0
- package/dist-ts/dist/fbns/fbns.client.events.js +2 -0
- package/dist-ts/dist/fbns/fbns.client.js +237 -0
- package/dist-ts/dist/fbns/fbns.device-auth.js +59 -0
- package/dist-ts/dist/fbns/fbns.types.js +2 -0
- package/dist-ts/dist/fbns/fbns.utilities.js +78 -0
- package/dist-ts/dist/fbns/index.js +24 -0
- package/dist-ts/dist/index.js +137 -0
- package/dist-ts/dist/mqtt-shim.js +14 -0
- package/dist-ts/dist/mqttot/index.js +24 -0
- package/dist-ts/dist/mqttot/mqttot.client.js +322 -0
- package/dist-ts/dist/mqttot/mqttot.connect.request.packet.js +8 -0
- package/dist-ts/dist/mqttot/mqttot.connect.response.packet.js +23 -0
- package/dist-ts/dist/mqttot/mqttot.connection.js +68 -0
- package/dist-ts/dist/realtime/commands/commands.js +67 -0
- package/dist-ts/dist/realtime/commands/direct.commands.js +415 -0
- package/dist-ts/dist/realtime/commands/enhanced.direct.commands.js +1529 -0
- package/dist-ts/dist/realtime/commands/index.js +23 -0
- package/dist-ts/dist/realtime/delta-sync.manager.js +260 -0
- package/dist-ts/dist/realtime/features/dm-sender.js +94 -0
- package/dist-ts/dist/realtime/features/error-handler.js +167 -0
- package/dist-ts/dist/realtime/features/gap-handler.js +60 -0
- package/dist-ts/dist/realtime/features/persistent-logger.js +174 -0
- package/dist-ts/dist/realtime/features/presence.manager.js +68 -0
- package/dist-ts/dist/realtime/features/session-health-monitor.js +327 -0
- package/dist-ts/dist/realtime/index.js +21 -0
- package/dist-ts/dist/realtime/messages/app-presence.event.js +2 -0
- package/dist-ts/dist/realtime/messages/index.js +23 -0
- package/dist-ts/dist/realtime/messages/message-sync.message.js +42 -0
- package/dist-ts/dist/realtime/messages/realtime-sub.direct.data.js +2 -0
- package/dist-ts/dist/realtime/messages/thread-update.message.js +2 -0
- package/dist-ts/dist/realtime/mixins/index.js +23 -0
- package/dist-ts/dist/realtime/mixins/message-sync.mixin.js +585 -0
- package/dist-ts/dist/realtime/mixins/mixin.js +40 -0
- package/dist-ts/dist/realtime/mixins/presence-typing.mixin.js +29 -0
- package/dist-ts/dist/realtime/mixins/realtime-sub.mixin.js +171 -0
- package/dist-ts/dist/realtime/parsers/graphql-parser.js +43 -0
- package/dist-ts/dist/realtime/parsers/graphql.parser.js +22 -0
- package/dist-ts/dist/realtime/parsers/index.js +26 -0
- package/dist-ts/dist/realtime/parsers/iris-parser.js +43 -0
- package/dist-ts/dist/realtime/parsers/iris.parser.js +9 -0
- package/dist-ts/dist/realtime/parsers/json-parser.js +43 -0
- package/dist-ts/dist/realtime/parsers/json.parser.js +9 -0
- package/dist-ts/dist/realtime/parsers/parser.js +2 -0
- package/dist-ts/dist/realtime/parsers/region-hint-parser.js +43 -0
- package/dist-ts/dist/realtime/parsers/region-hint.parser.js +14 -0
- package/dist-ts/dist/realtime/parsers/skywalker-parser.js +43 -0
- package/dist-ts/dist/realtime/parsers/skywalker.parser.js +14 -0
- package/dist-ts/dist/realtime/parsers-advanced.js +138 -0
- package/dist-ts/dist/realtime/proto-parser.js +186 -0
- package/dist-ts/dist/realtime/protocols/iris.handshake.js +76 -0
- package/dist-ts/dist/realtime/protocols/skywalker.protocol.js +96 -0
- package/dist-ts/dist/realtime/realtime.client.events.js +2 -0
- package/dist-ts/dist/realtime/realtime.client.js +2117 -0
- package/dist-ts/dist/realtime/realtime.service.js +408 -0
- package/dist-ts/dist/realtime/reconnect.manager.js +72 -0
- package/dist-ts/dist/realtime/session.manager.js +106 -0
- package/dist-ts/dist/realtime/subscriptions/graphql.subscription.js +98 -0
- package/dist-ts/dist/realtime/subscriptions/index.js +22 -0
- package/dist-ts/dist/realtime/subscriptions/skywalker.subscription.js +12 -0
- package/dist-ts/dist/realtime/topic-map.js +57 -0
- package/dist-ts/dist/realtime/topic.js +76 -0
- package/dist-ts/dist/repositories/account.repository.js +1267 -0
- package/dist-ts/dist/repositories/bloks.repository.js +66 -0
- package/dist-ts/dist/repositories/captcha.repository.js +40 -0
- package/dist-ts/dist/repositories/challenge.repository.js +108 -0
- package/dist-ts/dist/repositories/clip.repository.js +134 -0
- package/dist-ts/dist/repositories/close-friends.repository.js +41 -0
- package/dist-ts/dist/repositories/collection.repository.js +64 -0
- package/dist-ts/dist/repositories/direct-thread.repository.js +423 -0
- package/dist-ts/dist/repositories/direct.repository.js +246 -0
- package/dist-ts/dist/repositories/explore.repository.js +60 -0
- package/dist-ts/dist/repositories/fbsearch.repository.js +124 -0
- package/dist-ts/dist/repositories/feed.repository.js +237 -0
- package/dist-ts/dist/repositories/friendship.repository.js +277 -0
- package/dist-ts/dist/repositories/fundraiser.repository.js +38 -0
- package/dist-ts/dist/repositories/hashtag.repository.js +80 -0
- package/dist-ts/dist/repositories/highlights.repository.js +100 -0
- package/dist-ts/dist/repositories/insights.repository.js +66 -0
- package/dist-ts/dist/repositories/location.repository.js +67 -0
- package/dist-ts/dist/repositories/media.repository.js +370 -0
- package/dist-ts/dist/repositories/multiple-accounts.repository.js +36 -0
- package/dist-ts/dist/repositories/news.repository.js +32 -0
- package/dist-ts/dist/repositories/note.repository.js +51 -0
- package/dist-ts/dist/repositories/notification.repository.js +77 -0
- package/dist-ts/dist/repositories/share.repository.js +34 -0
- package/dist-ts/dist/repositories/signup.repository.js +178 -0
- package/dist-ts/dist/repositories/story.repository.js +268 -0
- package/dist-ts/dist/repositories/timeline.repository.js +57 -0
- package/dist-ts/dist/repositories/totp.repository.js +124 -0
- package/dist-ts/dist/repositories/track.repository.js +50 -0
- package/dist-ts/dist/repositories/upload.repository.js +191 -0
- package/dist-ts/dist/repositories/user.repository.js +332 -0
- package/dist-ts/dist/sendmedia/index.js +24 -0
- package/dist-ts/dist/sendmedia/sendFile.js +56 -0
- package/dist-ts/dist/sendmedia/sendPhoto.js +132 -0
- package/dist-ts/dist/sendmedia/sendRavenPhoto.js +133 -0
- package/dist-ts/dist/sendmedia/sendRavenVideo.js +136 -0
- package/dist-ts/dist/sendmedia/uploadPhoto.js +89 -0
- package/dist-ts/dist/sendmedia/uploadfFile.js +108 -0
- package/dist-ts/dist/services/live.service.js +113 -0
- package/dist-ts/dist/services/search.service.js +91 -0
- package/dist-ts/dist/shared/index.js +98 -0
- package/dist-ts/dist/shared/shared.js +85 -0
- package/dist-ts/dist/thrift/index.js +23 -0
- package/dist-ts/dist/thrift/thrift.js +105 -0
- package/dist-ts/dist/thrift/thrift.reading.js +339 -0
- package/dist-ts/dist/thrift/thrift.writing.js +393 -0
- package/dist-ts/dist/types/index.js +276 -0
- package/dist-ts/dist/useMultiFileAuthState.js +1878 -0
- package/dist-ts/dist/utils/index.js +244 -0
- package/dist-ts/examples/listen-to-messages.js +73 -0
- package/package.json +1 -1
- package/src-ts/dist/realtime/protocols/proto-definitions.ts +80 -0
- package/src-ts/dist/utils/helper-1.ts +1 -0
- package/src-ts/dist/utils/helper-10.ts +1 -0
- package/src-ts/dist/utils/helper-11.ts +1 -0
- package/src-ts/dist/utils/helper-12.ts +1 -0
- package/src-ts/dist/utils/helper-13.ts +1 -0
- package/src-ts/dist/utils/helper-14.ts +1 -0
- package/src-ts/dist/utils/helper-15.ts +1 -0
- package/src-ts/dist/utils/helper-16.ts +1 -0
- package/src-ts/dist/utils/helper-17.ts +1 -0
- package/src-ts/dist/utils/helper-18.ts +1 -0
- package/src-ts/dist/utils/helper-19.ts +1 -0
- package/src-ts/dist/utils/helper-2.ts +1 -0
- package/src-ts/dist/utils/helper-20.ts +1 -0
- package/src-ts/dist/utils/helper-21.ts +1 -0
- package/src-ts/dist/utils/helper-22.ts +1 -0
- package/src-ts/dist/utils/helper-23.ts +1 -0
- package/src-ts/dist/utils/helper-24.ts +1 -0
- package/src-ts/dist/utils/helper-25.ts +1 -0
- package/src-ts/dist/utils/helper-26.ts +1 -0
- package/src-ts/dist/utils/helper-27.ts +1 -0
- package/src-ts/dist/utils/helper-28.ts +1 -0
- package/src-ts/dist/utils/helper-29.ts +1 -0
- package/src-ts/dist/utils/helper-3.ts +1 -0
- package/src-ts/dist/utils/helper-30.ts +1 -0
- package/src-ts/dist/utils/helper-4.ts +1 -0
- package/src-ts/dist/utils/helper-5.ts +1 -0
- package/src-ts/dist/utils/helper-6.ts +1 -0
- package/src-ts/dist/utils/helper-7.ts +1 -0
- package/src-ts/dist/utils/helper-8.ts +1 -0
- package/src-ts/dist/utils/helper-9.ts +1 -0
- package/src-ts/dist/utils/insta-mqtt-helper.ts +128 -0
- package/src-ts/examples/listen-to-messages.ts +86 -0
- package/dist/errors/index.d.ts +0 -16
- package/dist/errors/index.js.map +0 -1
- package/dist/fbns/fbns.client.d.ts +0 -32
- package/dist/fbns/fbns.client.events.d.ts +0 -41
- package/dist/fbns/fbns.client.events.js.map +0 -1
- package/dist/fbns/fbns.client.js.map +0 -1
- package/dist/fbns/fbns.device-auth.d.ts +0 -17
- package/dist/fbns/fbns.device-auth.js.map +0 -1
- package/dist/fbns/fbns.types.d.ts +0 -83
- package/dist/fbns/fbns.types.js.map +0 -1
- package/dist/fbns/fbns.utilities.d.ts +0 -2
- package/dist/fbns/fbns.utilities.js.map +0 -1
- package/dist/fbns/index.d.ts +0 -4
- package/dist/fbns/index.js.map +0 -1
- package/dist/mqtt-shim.d.ts +0 -96
- package/dist/mqttot/index.d.ts +0 -4
- package/dist/mqttot/index.js.map +0 -1
- package/dist/mqttot/mqttot.client.d.ts +0 -39
- package/dist/mqttot/mqttot.client.js.map +0 -1
- package/dist/mqttot/mqttot.connect.request.packet.d.ts +0 -7
- package/dist/mqttot/mqttot.connect.request.packet.js.map +0 -1
- package/dist/mqttot/mqttot.connect.response.packet.d.ts +0 -7
- package/dist/mqttot/mqttot.connect.response.packet.js.map +0 -1
- package/dist/mqttot/mqttot.connection.d.ts +0 -57
- package/dist/mqttot/mqttot.connection.js.map +0 -1
- package/dist/package.json +0 -59
- package/dist/realtime/commands/commands.d.ts +0 -15
- package/dist/realtime/commands/commands.js.map +0 -1
- package/dist/realtime/commands/direct.commands.d.ts +0 -75
- package/dist/realtime/commands/direct.commands.js.map +0 -1
- package/dist/realtime/commands/enhanced.direct.commands.js.bak +0 -967
- package/dist/realtime/commands/index.d.ts +0 -2
- package/dist/realtime/commands/index.js.map +0 -1
- package/dist/realtime/messages/app-presence.event.d.ts +0 -9
- package/dist/realtime/messages/app-presence.event.js.map +0 -1
- package/dist/realtime/messages/index.d.ts +0 -3
- package/dist/realtime/messages/index.js.map +0 -1
- package/dist/realtime/messages/message-sync.message.d.ts +0 -222
- package/dist/realtime/messages/message-sync.message.js.map +0 -1
- package/dist/realtime/messages/realtime-sub.direct.data.d.ts +0 -11
- package/dist/realtime/messages/realtime-sub.direct.data.js.map +0 -1
- package/dist/realtime/messages/thread-update.message.d.ts +0 -68
- package/dist/realtime/messages/thread-update.message.js.map +0 -1
- package/dist/realtime/mixins/index.d.ts +0 -3
- package/dist/realtime/mixins/index.js.map +0 -1
- package/dist/realtime/mixins/message-sync.mixin.d.ts +0 -8
- package/dist/realtime/mixins/message-sync.mixin.js.map +0 -1
- package/dist/realtime/mixins/mixin.d.ts +0 -19
- package/dist/realtime/mixins/mixin.js.map +0 -1
- package/dist/realtime/mixins/realtime-sub.mixin.d.ts +0 -8
- package/dist/realtime/mixins/realtime-sub.mixin.js.map +0 -1
- package/dist/realtime/parsers/graphql.parser.d.ts +0 -15
- package/dist/realtime/parsers/graphql.parser.js.map +0 -1
- package/dist/realtime/parsers/index.d.ts +0 -6
- package/dist/realtime/parsers/index.js.map +0 -1
- package/dist/realtime/parsers/iris.parser.d.ts +0 -17
- package/dist/realtime/parsers/iris.parser.js.map +0 -1
- package/dist/realtime/parsers/json.parser.d.ts +0 -6
- package/dist/realtime/parsers/json.parser.js.map +0 -1
- package/dist/realtime/parsers/parser.d.ts +0 -9
- package/dist/realtime/parsers/parser.js.map +0 -1
- package/dist/realtime/parsers/region-hint.parser.d.ts +0 -12
- package/dist/realtime/parsers/region-hint.parser.js.map +0 -1
- package/dist/realtime/parsers/skywalker.parser.d.ts +0 -12
- package/dist/realtime/parsers/skywalker.parser.js.map +0 -1
- package/dist/realtime/proto/common.proto +0 -38
- package/dist/realtime/proto/direct.proto +0 -65
- package/dist/realtime/proto/ig-messages.proto +0 -83
- package/dist/realtime/proto/iris.proto +0 -188
- package/dist/realtime/subscriptions/graphql.subscription.d.ts +0 -47
- package/dist/realtime/subscriptions/graphql.subscription.js.map +0 -1
- package/dist/realtime/subscriptions/index.d.ts +0 -2
- package/dist/realtime/subscriptions/index.js.map +0 -1
- package/dist/realtime/subscriptions/skywalker.subscription.d.ts +0 -4
- package/dist/realtime/subscriptions/skywalker.subscription.js.map +0 -1
- package/dist/thrift/index.d.ts +0 -3
- package/dist/thrift/index.js.map +0 -1
- package/dist/thrift/thrift.d.ts +0 -59
- package/dist/thrift/thrift.js.map +0 -1
- package/dist/thrift/thrift.reading.d.ts +0 -41
- package/dist/thrift/thrift.reading.js.map +0 -1
- package/dist/thrift/thrift.writing.d.ts +0 -44
- package/dist/thrift/thrift.writing.js.map +0 -1
- /package/{dist → dist-ts/dist}/realtime/protocols/proto-definitions.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-1.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-10.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-11.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-12.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-13.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-14.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-15.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-16.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-17.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-18.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-19.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-2.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-20.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-21.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-22.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-23.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-24.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-25.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-26.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-27.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-28.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-29.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-3.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-30.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-4.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-5.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-6.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-7.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-8.js +0 -0
- /package/{dist → dist-ts/dist}/utils/helper-9.js +0 -0
- /package/{dist → dist-ts/dist}/utils/insta-mqtt-helper.js +0 -0
- /package/{dist/constants/constants.js → src-ts/dist/constants/constants.ts} +0 -0
- /package/{dist/constants/index.js → src-ts/dist/constants/index.ts} +0 -0
- /package/{dist/core/client.js → src-ts/dist/core/client.ts} +0 -0
- /package/{dist/core/nav-chain.js → src-ts/dist/core/nav-chain.ts} +0 -0
- /package/{dist/core/repository.js → src-ts/dist/core/repository.ts} +0 -0
- /package/{dist/core/request.js → src-ts/dist/core/request.ts} +0 -0
- /package/{dist/core/state.js → src-ts/dist/core/state.ts} +0 -0
- /package/{dist/core/utils.js → src-ts/dist/core/utils.ts} +0 -0
- /package/{dist/downloadMedia.js → src-ts/dist/downloadMedia.ts} +0 -0
- /package/{dist/errors/index.js → src-ts/dist/errors/index.ts} +0 -0
- /package/{dist/extend.js → src-ts/dist/extend.ts} +0 -0
- /package/{dist/fbns/fbns.client.events.js → src-ts/dist/fbns/fbns.client.events.ts} +0 -0
- /package/{dist/fbns/fbns.client.js → src-ts/dist/fbns/fbns.client.ts} +0 -0
- /package/{dist/fbns/fbns.device-auth.js → src-ts/dist/fbns/fbns.device-auth.ts} +0 -0
- /package/{dist/fbns/fbns.types.js → src-ts/dist/fbns/fbns.types.ts} +0 -0
- /package/{dist/fbns/fbns.utilities.js → src-ts/dist/fbns/fbns.utilities.ts} +0 -0
- /package/{dist/fbns/index.js → src-ts/dist/fbns/index.ts} +0 -0
- /package/{dist/index.js → src-ts/dist/index.ts} +0 -0
- /package/{dist/mqtt-shim.js → src-ts/dist/mqtt-shim.ts} +0 -0
- /package/{dist/mqttot/index.js → src-ts/dist/mqttot/index.ts} +0 -0
- /package/{dist/mqttot/mqttot.client.js → src-ts/dist/mqttot/mqttot.client.ts} +0 -0
- /package/{dist/mqttot/mqttot.connect.request.packet.js → src-ts/dist/mqttot/mqttot.connect.request.packet.ts} +0 -0
- /package/{dist/mqttot/mqttot.connect.response.packet.js → src-ts/dist/mqttot/mqttot.connect.response.packet.ts} +0 -0
- /package/{dist/mqttot/mqttot.connection.js → src-ts/dist/mqttot/mqttot.connection.ts} +0 -0
- /package/{dist/realtime/commands/commands.js → src-ts/dist/realtime/commands/commands.ts} +0 -0
- /package/{dist/realtime/commands/direct.commands.js → src-ts/dist/realtime/commands/direct.commands.ts} +0 -0
- /package/{dist/realtime/commands/enhanced.direct.commands.js → src-ts/dist/realtime/commands/enhanced.direct.commands.ts} +0 -0
- /package/{dist/realtime/commands/index.js → src-ts/dist/realtime/commands/index.ts} +0 -0
- /package/{dist/realtime/delta-sync.manager.js → src-ts/dist/realtime/delta-sync.manager.ts} +0 -0
- /package/{dist/realtime/features/dm-sender.js → src-ts/dist/realtime/features/dm-sender.ts} +0 -0
- /package/{dist/realtime/features/error-handler.js → src-ts/dist/realtime/features/error-handler.ts} +0 -0
- /package/{dist/realtime/features/gap-handler.js → src-ts/dist/realtime/features/gap-handler.ts} +0 -0
- /package/{dist/realtime/features/persistent-logger.js → src-ts/dist/realtime/features/persistent-logger.ts} +0 -0
- /package/{dist/realtime/features/presence.manager.js → src-ts/dist/realtime/features/presence.manager.ts} +0 -0
- /package/{dist/realtime/features/session-health-monitor.js → src-ts/dist/realtime/features/session-health-monitor.ts} +0 -0
- /package/{dist/realtime/index.js → src-ts/dist/realtime/index.ts} +0 -0
- /package/{dist/realtime/messages/app-presence.event.js → src-ts/dist/realtime/messages/app-presence.event.ts} +0 -0
- /package/{dist/realtime/messages/index.js → src-ts/dist/realtime/messages/index.ts} +0 -0
- /package/{dist/realtime/messages/message-sync.message.js → src-ts/dist/realtime/messages/message-sync.message.ts} +0 -0
- /package/{dist/realtime/messages/realtime-sub.direct.data.js → src-ts/dist/realtime/messages/realtime-sub.direct.data.ts} +0 -0
- /package/{dist/realtime/messages/thread-update.message.js → src-ts/dist/realtime/messages/thread-update.message.ts} +0 -0
- /package/{dist/realtime/mixins/index.js → src-ts/dist/realtime/mixins/index.ts} +0 -0
- /package/{dist/realtime/mixins/message-sync.mixin.js → src-ts/dist/realtime/mixins/message-sync.mixin.ts} +0 -0
- /package/{dist/realtime/mixins/mixin.js → src-ts/dist/realtime/mixins/mixin.ts} +0 -0
- /package/{dist/realtime/mixins/presence-typing.mixin.js → src-ts/dist/realtime/mixins/presence-typing.mixin.ts} +0 -0
- /package/{dist/realtime/mixins/realtime-sub.mixin.js → src-ts/dist/realtime/mixins/realtime-sub.mixin.ts} +0 -0
- /package/{dist/realtime/parsers/graphql-parser.js → src-ts/dist/realtime/parsers/graphql-parser.ts} +0 -0
- /package/{dist/realtime/parsers/graphql.parser.js → src-ts/dist/realtime/parsers/graphql.parser.ts} +0 -0
- /package/{dist/realtime/parsers/index.js → src-ts/dist/realtime/parsers/index.ts} +0 -0
- /package/{dist/realtime/parsers/iris-parser.js → src-ts/dist/realtime/parsers/iris-parser.ts} +0 -0
- /package/{dist/realtime/parsers/iris.parser.js → src-ts/dist/realtime/parsers/iris.parser.ts} +0 -0
- /package/{dist/realtime/parsers/json-parser.js → src-ts/dist/realtime/parsers/json-parser.ts} +0 -0
- /package/{dist/realtime/parsers/json.parser.js → src-ts/dist/realtime/parsers/json.parser.ts} +0 -0
- /package/{dist/realtime/parsers/parser.js → src-ts/dist/realtime/parsers/parser.ts} +0 -0
- /package/{dist/realtime/parsers/region-hint-parser.js → src-ts/dist/realtime/parsers/region-hint-parser.ts} +0 -0
- /package/{dist/realtime/parsers/region-hint.parser.js → src-ts/dist/realtime/parsers/region-hint.parser.ts} +0 -0
- /package/{dist/realtime/parsers/skywalker-parser.js → src-ts/dist/realtime/parsers/skywalker-parser.ts} +0 -0
- /package/{dist/realtime/parsers/skywalker.parser.js → src-ts/dist/realtime/parsers/skywalker.parser.ts} +0 -0
- /package/{dist/realtime/parsers-advanced.js → src-ts/dist/realtime/parsers-advanced.ts} +0 -0
- /package/{dist/realtime/proto-parser.js → src-ts/dist/realtime/proto-parser.ts} +0 -0
- /package/{dist/realtime/protocols/iris.handshake.js → src-ts/dist/realtime/protocols/iris.handshake.ts} +0 -0
- /package/{dist/realtime/protocols/skywalker.protocol.js → src-ts/dist/realtime/protocols/skywalker.protocol.ts} +0 -0
- /package/{dist/realtime/realtime.client.events.js → src-ts/dist/realtime/realtime.client.events.ts} +0 -0
- /package/{dist/realtime/realtime.client.js → src-ts/dist/realtime/realtime.client.ts} +0 -0
- /package/{dist/realtime/realtime.service.js → src-ts/dist/realtime/realtime.service.ts} +0 -0
- /package/{dist/realtime/reconnect.manager.js → src-ts/dist/realtime/reconnect.manager.ts} +0 -0
- /package/{dist/realtime/session.manager.js → src-ts/dist/realtime/session.manager.ts} +0 -0
- /package/{dist/realtime/subscriptions/graphql.subscription.js → src-ts/dist/realtime/subscriptions/graphql.subscription.ts} +0 -0
- /package/{dist/realtime/subscriptions/index.js → src-ts/dist/realtime/subscriptions/index.ts} +0 -0
- /package/{dist/realtime/subscriptions/skywalker.subscription.js → src-ts/dist/realtime/subscriptions/skywalker.subscription.ts} +0 -0
- /package/{dist/realtime/topic-map.js → src-ts/dist/realtime/topic-map.ts} +0 -0
- /package/{dist/realtime/topic.js → src-ts/dist/realtime/topic.ts} +0 -0
- /package/{dist/repositories/account.repository.js → src-ts/dist/repositories/account.repository.ts} +0 -0
- /package/{dist/repositories/bloks.repository.js → src-ts/dist/repositories/bloks.repository.ts} +0 -0
- /package/{dist/repositories/captcha.repository.js → src-ts/dist/repositories/captcha.repository.ts} +0 -0
- /package/{dist/repositories/challenge.repository.js → src-ts/dist/repositories/challenge.repository.ts} +0 -0
- /package/{dist/repositories/clip.repository.js → src-ts/dist/repositories/clip.repository.ts} +0 -0
- /package/{dist/repositories/close-friends.repository.js → src-ts/dist/repositories/close-friends.repository.ts} +0 -0
- /package/{dist/repositories/collection.repository.js → src-ts/dist/repositories/collection.repository.ts} +0 -0
- /package/{dist/repositories/direct-thread.repository.js → src-ts/dist/repositories/direct-thread.repository.ts} +0 -0
- /package/{dist/repositories/direct.repository.js → src-ts/dist/repositories/direct.repository.ts} +0 -0
- /package/{dist/repositories/explore.repository.js → src-ts/dist/repositories/explore.repository.ts} +0 -0
- /package/{dist/repositories/fbsearch.repository.js → src-ts/dist/repositories/fbsearch.repository.ts} +0 -0
- /package/{dist/repositories/feed.repository.js → src-ts/dist/repositories/feed.repository.ts} +0 -0
- /package/{dist/repositories/friendship.repository.js → src-ts/dist/repositories/friendship.repository.ts} +0 -0
- /package/{dist/repositories/fundraiser.repository.js → src-ts/dist/repositories/fundraiser.repository.ts} +0 -0
- /package/{dist/repositories/hashtag.repository.js → src-ts/dist/repositories/hashtag.repository.ts} +0 -0
- /package/{dist/repositories/highlights.repository.js → src-ts/dist/repositories/highlights.repository.ts} +0 -0
- /package/{dist/repositories/insights.repository.js → src-ts/dist/repositories/insights.repository.ts} +0 -0
- /package/{dist/repositories/location.repository.js → src-ts/dist/repositories/location.repository.ts} +0 -0
- /package/{dist/repositories/media.repository.js → src-ts/dist/repositories/media.repository.ts} +0 -0
- /package/{dist/repositories/multiple-accounts.repository.js → src-ts/dist/repositories/multiple-accounts.repository.ts} +0 -0
- /package/{dist/repositories/news.repository.js → src-ts/dist/repositories/news.repository.ts} +0 -0
- /package/{dist/repositories/note.repository.js → src-ts/dist/repositories/note.repository.ts} +0 -0
- /package/{dist/repositories/notification.repository.js → src-ts/dist/repositories/notification.repository.ts} +0 -0
- /package/{dist/repositories/share.repository.js → src-ts/dist/repositories/share.repository.ts} +0 -0
- /package/{dist/repositories/signup.repository.js → src-ts/dist/repositories/signup.repository.ts} +0 -0
- /package/{dist/repositories/story.repository.js → src-ts/dist/repositories/story.repository.ts} +0 -0
- /package/{dist/repositories/timeline.repository.js → src-ts/dist/repositories/timeline.repository.ts} +0 -0
- /package/{dist/repositories/totp.repository.js → src-ts/dist/repositories/totp.repository.ts} +0 -0
- /package/{dist/repositories/track.repository.js → src-ts/dist/repositories/track.repository.ts} +0 -0
- /package/{dist/repositories/upload.repository.js → src-ts/dist/repositories/upload.repository.ts} +0 -0
- /package/{dist/repositories/user.repository.js → src-ts/dist/repositories/user.repository.ts} +0 -0
- /package/{dist/sendmedia/index.js → src-ts/dist/sendmedia/index.ts} +0 -0
- /package/{dist/sendmedia/sendFile.js → src-ts/dist/sendmedia/sendFile.ts} +0 -0
- /package/{dist/sendmedia/sendPhoto.js → src-ts/dist/sendmedia/sendPhoto.ts} +0 -0
- /package/{dist/sendmedia/sendRavenPhoto.js → src-ts/dist/sendmedia/sendRavenPhoto.ts} +0 -0
- /package/{dist/sendmedia/sendRavenVideo.js → src-ts/dist/sendmedia/sendRavenVideo.ts} +0 -0
- /package/{dist/sendmedia/uploadPhoto.js → src-ts/dist/sendmedia/uploadPhoto.ts} +0 -0
- /package/{dist/sendmedia/uploadfFile.js → src-ts/dist/sendmedia/uploadfFile.ts} +0 -0
- /package/{dist/services/live.service.js → src-ts/dist/services/live.service.ts} +0 -0
- /package/{dist/services/search.service.js → src-ts/dist/services/search.service.ts} +0 -0
- /package/{dist/shared/index.js → src-ts/dist/shared/index.ts} +0 -0
- /package/{dist/shared/shared.js → src-ts/dist/shared/shared.ts} +0 -0
- /package/{dist/thrift/index.js → src-ts/dist/thrift/index.ts} +0 -0
- /package/{dist/thrift/thrift.reading.js → src-ts/dist/thrift/thrift.reading.ts} +0 -0
- /package/{dist/thrift/thrift.js → src-ts/dist/thrift/thrift.ts} +0 -0
- /package/{dist/thrift/thrift.writing.js → src-ts/dist/thrift/thrift.writing.ts} +0 -0
- /package/{dist/types/index.js → src-ts/dist/types/index.ts} +0 -0
- /package/{dist/useMultiFileAuthState.js → src-ts/dist/useMultiFileAuthState.ts} +0 -0
- /package/{dist/utils/index.js → src-ts/dist/utils/index.ts} +0 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* RealtimeSubMixin - ENHANCED VERSION
|
|
4
|
+
*
|
|
5
|
+
* This file has been modified to include all MQTT features from instagram_mqtt library.
|
|
6
|
+
*
|
|
7
|
+
* CHANGES MADE (from instagram_mqtt compatibility):
|
|
8
|
+
* 1. Added import for subscriptions (QueryIDs) - was MISSING
|
|
9
|
+
* 2. Added client.mqtt.listen() approach for REALTIME_SUB topic - was MISSING
|
|
10
|
+
* 3. Added 'realtimeSub' event emission - was MISSING (only had 'subscription')
|
|
11
|
+
* 4. Added 'direct' topic processing - was MISSING
|
|
12
|
+
* 5. Added emitDirectEvent() method - was MISSING
|
|
13
|
+
* 6. Added QueryIDs-based event emission (directTyping, appPresence, etc.) - was MISSING
|
|
14
|
+
*
|
|
15
|
+
* PRESERVED:
|
|
16
|
+
* - Original 'subscription' event emission (for backwards compatibility)
|
|
17
|
+
* - Original on('message') approach with topicMap (extended, not replaced)
|
|
18
|
+
* - All existing retry logic and error handling
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.RealtimeSubMixin = void 0;
|
|
22
|
+
const mixin_1 = require("./mixin");
|
|
23
|
+
const constants_1 = require("../../constants");
|
|
24
|
+
const shared_1 = require("../../shared");
|
|
25
|
+
// ADDED: Import subscriptions for QueryIDs (was MISSING in nodejs-insta-private-api-mqt)
|
|
26
|
+
const subscriptions_1 = require("../subscriptions");
|
|
27
|
+
const mqtts_1 = require("mqtts");
|
|
28
|
+
class RealtimeSubMixin extends mixin_1.Mixin {
|
|
29
|
+
apply(client) {
|
|
30
|
+
(0, mixin_1.hook)(client, 'connect', {
|
|
31
|
+
post: async () => {
|
|
32
|
+
// Wait for MQTT client to be ready (PRESERVED from original)
|
|
33
|
+
let retries = 0;
|
|
34
|
+
while (!client.mqtt && retries < 50) {
|
|
35
|
+
await new Promise(r => setTimeout(r, 100));
|
|
36
|
+
retries++;
|
|
37
|
+
}
|
|
38
|
+
if (!client.mqtt) {
|
|
39
|
+
throw new mqtts_1.IllegalStateError('No mqtt client created after retries');
|
|
40
|
+
}
|
|
41
|
+
// ADDED: Use client.mqtt.listen() for REALTIME_SUB topic (from instagram_mqtt)
|
|
42
|
+
// This is the approach used by instagram_mqtt for handling realtime subscriptions
|
|
43
|
+
if (client.mqtt.listen) {
|
|
44
|
+
client.mqtt.listen({
|
|
45
|
+
topic: constants_1.Topics.REALTIME_SUB.id,
|
|
46
|
+
transformer: async ({ payload }) => {
|
|
47
|
+
try {
|
|
48
|
+
return constants_1.Topics.REALTIME_SUB.parser.parseMessage(constants_1.Topics.REALTIME_SUB, await (0, shared_1.tryUnzipAsync)(payload));
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
// If transformer fails, return null so handler can skip
|
|
52
|
+
console.warn('[RealtimeSubMixin] transformer parse failed:', (err === null || err === void 0 ? void 0 : err.message) || err);
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
}, data => {
|
|
57
|
+
if (data) {
|
|
58
|
+
// ADDED: Call the instagram_mqtt compatible handler
|
|
59
|
+
this.handleRealtimeSubFromListen(client, data);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
// PRESERVED: Original on('message') approach with topicMap (for backwards compatibility)
|
|
64
|
+
client.mqtt.on('message', async (msg) => {
|
|
65
|
+
var _a;
|
|
66
|
+
const topicMap = (_a = client.mqtt) === null || _a === void 0 ? void 0 : _a.topicMap;
|
|
67
|
+
const topic = topicMap === null || topicMap === void 0 ? void 0 : topicMap.get(msg.topic);
|
|
68
|
+
if (topic && topic.parser && !topic.noParse) {
|
|
69
|
+
try {
|
|
70
|
+
const unzipped = await (0, shared_1.tryUnzipAsync)(msg.payload);
|
|
71
|
+
const parsedMessages = topic.parser.parseMessage(topic, unzipped);
|
|
72
|
+
if (Array.isArray(parsedMessages)) {
|
|
73
|
+
parsedMessages.forEach(m => {
|
|
74
|
+
this.handleRealtimeSub(client, topic, m.data);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
this.handleRealtimeSub(client, topic, parsedMessages.data);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
catch (e) {
|
|
82
|
+
console.error(`RealtimeSub parse error on ${topic.path}:`, e.message);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* ADDED: Handler compatible with instagram_mqtt's listen() approach
|
|
91
|
+
* This method handles data from client.mqtt.listen() and emits instagram_mqtt compatible events
|
|
92
|
+
*
|
|
93
|
+
* @param {Object} client - The realtime client instance
|
|
94
|
+
* @param {Object} param1 - The parsed data object containing { data, topic }
|
|
95
|
+
*/
|
|
96
|
+
handleRealtimeSubFromListen(client, { data, topic: messageTopic }) {
|
|
97
|
+
const { message } = data;
|
|
98
|
+
// ADDED: Emit 'realtimeSub' event (was MISSING - this is what instagram_mqtt does)
|
|
99
|
+
client.emit('realtimeSub', { data, topic: messageTopic });
|
|
100
|
+
// ADDED: Process message based on type (was MISSING)
|
|
101
|
+
if (typeof message === 'string') {
|
|
102
|
+
// If message is a string, parse it and emit direct event
|
|
103
|
+
this.emitDirectEvent(client, JSON.parse(message));
|
|
104
|
+
}
|
|
105
|
+
else if (message) {
|
|
106
|
+
const { topic, payload, json } = message;
|
|
107
|
+
switch (topic) {
|
|
108
|
+
case 'direct': {
|
|
109
|
+
// ADDED: Handle 'direct' topic specifically (was MISSING)
|
|
110
|
+
this.emitDirectEvent(client, json);
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
default: {
|
|
114
|
+
// ADDED: Emit QueryID-based events (was MISSING)
|
|
115
|
+
// This emits events like 'directTyping', 'appPresence', 'directStatus', etc.
|
|
116
|
+
const entries = Object.entries(subscriptions_1.QueryIDs);
|
|
117
|
+
const query = entries.find(e => e[1] === topic);
|
|
118
|
+
if (query) {
|
|
119
|
+
client.emit(query[0], json || payload);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* ADDED: Method to emit direct events (was MISSING from nodejs-insta-private-api-mqt)
|
|
127
|
+
* This method parses string values in parsed.data and emits 'direct' event for each
|
|
128
|
+
*
|
|
129
|
+
* @param {Object} client - The realtime client instance
|
|
130
|
+
* @param {Object} parsed - The parsed message object containing data array
|
|
131
|
+
*/
|
|
132
|
+
emitDirectEvent(client, parsed) {
|
|
133
|
+
if (!parsed || !parsed.data || !Array.isArray(parsed.data)) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
parsed.data = parsed.data.map((e) => {
|
|
137
|
+
if (typeof e.value === 'string') {
|
|
138
|
+
try {
|
|
139
|
+
e.value = JSON.parse(e.value);
|
|
140
|
+
}
|
|
141
|
+
catch (parseErr) {
|
|
142
|
+
// If parsing fails, keep original value
|
|
143
|
+
console.warn('[RealtimeSubMixin] emitDirectEvent JSON parse failed:', parseErr === null || parseErr === void 0 ? void 0 : parseErr.message);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return e;
|
|
147
|
+
});
|
|
148
|
+
// Emit 'direct' event for each data item
|
|
149
|
+
parsed.data.forEach((data) => client.emit('direct', data));
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* PRESERVED: Original handler for on('message') approach (for backwards compatibility)
|
|
153
|
+
* This emits the 'subscription' event that existing code may depend on
|
|
154
|
+
*
|
|
155
|
+
* @param {Object} client - The realtime client instance
|
|
156
|
+
* @param {Object} topic - The topic object from topicMap
|
|
157
|
+
* @param {Object} data - The parsed message data
|
|
158
|
+
*/
|
|
159
|
+
handleRealtimeSub(client, topic, data) {
|
|
160
|
+
// PRESERVED: Emit 'subscription' event (original behavior)
|
|
161
|
+
client.emit('subscription', {
|
|
162
|
+
query: topic.path,
|
|
163
|
+
data: data,
|
|
164
|
+
topic: topic,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
get name() {
|
|
168
|
+
return 'Realtime Sub';
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
exports.RealtimeSubMixin = RealtimeSubMixin;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GraphQL Parser
|
|
3
|
+
*
|
|
4
|
+
* Parses GraphQL messages from Instagram's realtime system.
|
|
5
|
+
* These messages contain GraphQL queries, mutations, and subscriptions.
|
|
6
|
+
*/
|
|
7
|
+
class GraphqlParser {
|
|
8
|
+
/**
|
|
9
|
+
* Parse a GraphQL message
|
|
10
|
+
* @param {Buffer|string} data - The raw message data
|
|
11
|
+
* @returns {Object} Parsed GraphQL data
|
|
12
|
+
*/
|
|
13
|
+
parse(data) {
|
|
14
|
+
try {
|
|
15
|
+
const message = Buffer.isBuffer(data) ? data.toString() : data;
|
|
16
|
+
// Try to parse as JSON first
|
|
17
|
+
try {
|
|
18
|
+
const parsed = JSON.parse(message);
|
|
19
|
+
return {
|
|
20
|
+
type: 'graphql',
|
|
21
|
+
data: parsed,
|
|
22
|
+
raw: message
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
catch (jsonError) {
|
|
26
|
+
// If not JSON, treat as GraphQL query string
|
|
27
|
+
return {
|
|
28
|
+
type: 'graphql',
|
|
29
|
+
data: { query: message },
|
|
30
|
+
raw: message
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
return {
|
|
36
|
+
type: 'graphql',
|
|
37
|
+
data: { error: error.message },
|
|
38
|
+
raw: data.toString()
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
module.exports = GraphqlParser;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GraphqlParser = void 0;
|
|
4
|
+
const thrift_1 = require("../../thrift");
|
|
5
|
+
const shared_1 = require("../../shared");
|
|
6
|
+
class GraphqlParser {
|
|
7
|
+
parseMessage(topic, payload) {
|
|
8
|
+
var _a;
|
|
9
|
+
const message = (0, shared_1.isJson)(payload)
|
|
10
|
+
? payload.toString()
|
|
11
|
+
: (_a = (0, thrift_1.thriftReadToObject)(payload, GraphqlParser.descriptors)) !== null && _a !== void 0 ? _a : '';
|
|
12
|
+
if (message.payload) {
|
|
13
|
+
message.json = JSON.parse(message.payload);
|
|
14
|
+
}
|
|
15
|
+
return { topic, data: { message } };
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.GraphqlParser = GraphqlParser;
|
|
19
|
+
GraphqlParser.descriptors = [
|
|
20
|
+
thrift_1.ThriftDescriptors.binary('topic', 1),
|
|
21
|
+
thrift_1.ThriftDescriptors.binary('payload', 2),
|
|
22
|
+
];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function (o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined)
|
|
4
|
+
k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function () { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function (o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined)
|
|
12
|
+
k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
}));
|
|
15
|
+
var __exportStar = (this && this.__exportStar) || function (m, exports) {
|
|
16
|
+
for (var p in m)
|
|
17
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p))
|
|
18
|
+
__createBinding(exports, m, p);
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
__exportStar(require("./graphql.parser"), exports);
|
|
22
|
+
__exportStar(require("./iris.parser"), exports);
|
|
23
|
+
__exportStar(require("./json.parser"), exports);
|
|
24
|
+
__exportStar(require("./parser"), exports);
|
|
25
|
+
__exportStar(require("./region-hint.parser"), exports);
|
|
26
|
+
__exportStar(require("./skywalker.parser"), exports);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Iris Parser
|
|
3
|
+
*
|
|
4
|
+
* Parses Iris messages from Instagram's realtime system.
|
|
5
|
+
* Iris is Instagram's internal messaging system for real-time updates.
|
|
6
|
+
*/
|
|
7
|
+
class IrisParser {
|
|
8
|
+
/**
|
|
9
|
+
* Parse an Iris message
|
|
10
|
+
* @param {Buffer|string} data - The raw message data
|
|
11
|
+
* @returns {Object} Parsed Iris data
|
|
12
|
+
*/
|
|
13
|
+
parse(data) {
|
|
14
|
+
try {
|
|
15
|
+
const message = Buffer.isBuffer(data) ? data.toString() : data;
|
|
16
|
+
// Try to parse as JSON first
|
|
17
|
+
try {
|
|
18
|
+
const parsed = JSON.parse(message);
|
|
19
|
+
return {
|
|
20
|
+
type: 'iris',
|
|
21
|
+
data: parsed,
|
|
22
|
+
raw: message
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
catch (jsonError) {
|
|
26
|
+
// If not JSON, treat as plain text
|
|
27
|
+
return {
|
|
28
|
+
type: 'iris',
|
|
29
|
+
data: { message: message },
|
|
30
|
+
raw: message
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
return {
|
|
36
|
+
type: 'iris',
|
|
37
|
+
data: { error: error.message },
|
|
38
|
+
raw: data.toString()
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
module.exports = IrisParser;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IrisParser = void 0;
|
|
4
|
+
class IrisParser {
|
|
5
|
+
parseMessage(topic, payload) {
|
|
6
|
+
return JSON.parse(payload.toString('utf8')).map((x) => ({ topic, data: x }));
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.IrisParser = IrisParser;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON Parser
|
|
3
|
+
*
|
|
4
|
+
* Parses JSON messages from Instagram's realtime system.
|
|
5
|
+
* This is a general-purpose parser for JSON-formatted messages.
|
|
6
|
+
*/
|
|
7
|
+
class JsonParser {
|
|
8
|
+
/**
|
|
9
|
+
* Parse a JSON message
|
|
10
|
+
* @param {Buffer|string} data - The raw message data
|
|
11
|
+
* @returns {Object} Parsed JSON data
|
|
12
|
+
*/
|
|
13
|
+
parse(data) {
|
|
14
|
+
try {
|
|
15
|
+
const message = Buffer.isBuffer(data) ? data.toString() : data;
|
|
16
|
+
// Try to parse as JSON
|
|
17
|
+
try {
|
|
18
|
+
const parsed = JSON.parse(message);
|
|
19
|
+
return {
|
|
20
|
+
type: 'json',
|
|
21
|
+
data: parsed,
|
|
22
|
+
raw: message
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
catch (jsonError) {
|
|
26
|
+
// If not valid JSON, return as plain text
|
|
27
|
+
return {
|
|
28
|
+
type: 'json',
|
|
29
|
+
data: { text: message },
|
|
30
|
+
raw: message
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
return {
|
|
36
|
+
type: 'json',
|
|
37
|
+
data: { error: error.message },
|
|
38
|
+
raw: data.toString()
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
module.exports = JsonParser;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JsonParser = void 0;
|
|
4
|
+
class JsonParser {
|
|
5
|
+
parseMessage(topic, payload) {
|
|
6
|
+
return { topic, data: payload.length > 0 ? JSON.parse(payload.toString()) : {} };
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.JsonParser = JsonParser;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Region Hint Parser
|
|
3
|
+
*
|
|
4
|
+
* Parses region hint messages from Instagram's realtime system.
|
|
5
|
+
* These messages contain information about the user's region/location.
|
|
6
|
+
*/
|
|
7
|
+
class RegionHintParser {
|
|
8
|
+
/**
|
|
9
|
+
* Parse a region hint message
|
|
10
|
+
* @param {Buffer|string} data - The raw message data
|
|
11
|
+
* @returns {Object} Parsed region hint data
|
|
12
|
+
*/
|
|
13
|
+
parse(data) {
|
|
14
|
+
try {
|
|
15
|
+
const message = Buffer.isBuffer(data) ? data.toString() : data;
|
|
16
|
+
// Try to parse as JSON first
|
|
17
|
+
try {
|
|
18
|
+
const parsed = JSON.parse(message);
|
|
19
|
+
return {
|
|
20
|
+
type: 'region_hint',
|
|
21
|
+
data: parsed,
|
|
22
|
+
raw: message
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
catch (jsonError) {
|
|
26
|
+
// If not JSON, treat as plain text
|
|
27
|
+
return {
|
|
28
|
+
type: 'region_hint',
|
|
29
|
+
data: { hint: message },
|
|
30
|
+
raw: message
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
return {
|
|
36
|
+
type: 'region_hint',
|
|
37
|
+
data: { error: error.message },
|
|
38
|
+
raw: data.toString()
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
module.exports = RegionHintParser;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RegionHintParser = void 0;
|
|
4
|
+
const thrift_1 = require("../../thrift");
|
|
5
|
+
class RegionHintParser {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.parseMessage = (topic, payload) => ({
|
|
8
|
+
topic,
|
|
9
|
+
data: (0, thrift_1.thriftReadToObject)(payload, RegionHintParser.descriptors),
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.RegionHintParser = RegionHintParser;
|
|
14
|
+
RegionHintParser.descriptors = [thrift_1.ThriftDescriptors.binary('hint', 1)];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skywalker Parser
|
|
3
|
+
*
|
|
4
|
+
* Parses Skywalker messages from Instagram's realtime system.
|
|
5
|
+
* Skywalker is Instagram's pub/sub system for real-time updates.
|
|
6
|
+
*/
|
|
7
|
+
class SkywalkerParser {
|
|
8
|
+
/**
|
|
9
|
+
* Parse a Skywalker message
|
|
10
|
+
* @param {Buffer|string} data - The raw message data
|
|
11
|
+
* @returns {Object} Parsed Skywalker data
|
|
12
|
+
*/
|
|
13
|
+
parse(data) {
|
|
14
|
+
try {
|
|
15
|
+
const message = Buffer.isBuffer(data) ? data.toString() : data;
|
|
16
|
+
// Try to parse as JSON first
|
|
17
|
+
try {
|
|
18
|
+
const parsed = JSON.parse(message);
|
|
19
|
+
return {
|
|
20
|
+
type: 'skywalker',
|
|
21
|
+
data: parsed,
|
|
22
|
+
raw: message
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
catch (jsonError) {
|
|
26
|
+
// If not JSON, treat as plain text
|
|
27
|
+
return {
|
|
28
|
+
type: 'skywalker',
|
|
29
|
+
data: { message: message },
|
|
30
|
+
raw: message
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
return {
|
|
36
|
+
type: 'skywalker',
|
|
37
|
+
data: { error: error.message },
|
|
38
|
+
raw: data.toString()
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
module.exports = SkywalkerParser;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SkywalkerParser = void 0;
|
|
4
|
+
const thrift_1 = require("../../thrift");
|
|
5
|
+
class SkywalkerParser {
|
|
6
|
+
parseMessage(topic, payload) {
|
|
7
|
+
return {
|
|
8
|
+
topic,
|
|
9
|
+
data: (0, thrift_1.thriftReadToObject)(payload, SkywalkerParser.descriptors),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.SkywalkerParser = SkywalkerParser;
|
|
14
|
+
SkywalkerParser.descriptors = [thrift_1.ThriftDescriptors.int32('topic', 1), thrift_1.ThriftDescriptors.binary('payload', 2)];
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
const debug = require('debug')('ig:parsers');
|
|
2
|
+
const ProtoParser = require('./proto-parser');
|
|
3
|
+
const protoParser = new ProtoParser();
|
|
4
|
+
/**
|
|
5
|
+
* Advanced Topic-Specific Parsers
|
|
6
|
+
*/
|
|
7
|
+
// Parse Iris (Direct Messages)
|
|
8
|
+
function parseIris(topicId, payload) {
|
|
9
|
+
const result = protoParser.decode(topicId, payload);
|
|
10
|
+
if (result.success && result.messages) {
|
|
11
|
+
return {
|
|
12
|
+
type: 'iris',
|
|
13
|
+
messages: result.messages.filter(m => m.type === 'message' || !m.type),
|
|
14
|
+
threads: result.messages.filter(m => m.type === 'thread').map(m => m.thread),
|
|
15
|
+
typing: result.messages.filter(m => m.type === 'typing').map(m => m.typing)
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return { type: 'iris', error: result.error, raw: result.raw };
|
|
19
|
+
}
|
|
20
|
+
// Parse GraphQL (Presence, Typing)
|
|
21
|
+
function parseGraphQL(topicId, payload) {
|
|
22
|
+
const result = protoParser.decode(topicId, payload);
|
|
23
|
+
if (result.success) {
|
|
24
|
+
return {
|
|
25
|
+
type: 'graphql',
|
|
26
|
+
data: result.decoded,
|
|
27
|
+
messages: result.messages
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
return { type: 'graphql', error: result.error };
|
|
31
|
+
}
|
|
32
|
+
// Parse Delta (Sync updates)
|
|
33
|
+
function parseDelta(topicId, payload) {
|
|
34
|
+
const result = protoParser.decode(topicId, payload);
|
|
35
|
+
if (result.success && result.decoded) {
|
|
36
|
+
return {
|
|
37
|
+
type: 'delta',
|
|
38
|
+
seqId: result.decoded.seq_id,
|
|
39
|
+
action: result.decoded.action,
|
|
40
|
+
items: result.messages,
|
|
41
|
+
metadata: result.decoded.metadata
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return { type: 'delta', error: result.error };
|
|
45
|
+
}
|
|
46
|
+
// Parse Presence
|
|
47
|
+
function parsePresence(topicId, payload) {
|
|
48
|
+
const result = protoParser.decode(topicId, payload);
|
|
49
|
+
if (result.success) {
|
|
50
|
+
return {
|
|
51
|
+
type: 'presence',
|
|
52
|
+
items: result.messages.map(m => {
|
|
53
|
+
var _a;
|
|
54
|
+
return ({
|
|
55
|
+
userId: m.id,
|
|
56
|
+
status: ((_a = m.typing) === null || _a === void 0 ? void 0 : _a.state) || 'unknown',
|
|
57
|
+
timestamp: m.timestamp
|
|
58
|
+
});
|
|
59
|
+
})
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
return { type: 'presence', error: result.error };
|
|
63
|
+
}
|
|
64
|
+
// Parse Feed
|
|
65
|
+
function parseFeed(topicId, payload) {
|
|
66
|
+
const result = protoParser.decode(topicId, payload);
|
|
67
|
+
return {
|
|
68
|
+
type: 'feed',
|
|
69
|
+
decoded: result.decoded,
|
|
70
|
+
items: result.messages,
|
|
71
|
+
error: result.error
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
// Parse Live
|
|
75
|
+
function parseLive(topicId, payload) {
|
|
76
|
+
const result = protoParser.decode(topicId, payload);
|
|
77
|
+
return {
|
|
78
|
+
type: 'live',
|
|
79
|
+
decoded: result.decoded,
|
|
80
|
+
items: result.messages,
|
|
81
|
+
error: result.error
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
// Parse Region Hint
|
|
85
|
+
function parseRegionHint(topicId, payload) {
|
|
86
|
+
try {
|
|
87
|
+
const text = payload.toString('utf-8');
|
|
88
|
+
const hint = JSON.parse(text);
|
|
89
|
+
return {
|
|
90
|
+
type: 'region-hint',
|
|
91
|
+
region: hint.region,
|
|
92
|
+
endpoint: hint.endpoint,
|
|
93
|
+
data: hint
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
catch (e) {
|
|
97
|
+
return {
|
|
98
|
+
type: 'region-hint',
|
|
99
|
+
raw: payload.toString('utf-8', 0, 200),
|
|
100
|
+
error: e.message
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// Unified router
|
|
105
|
+
const PARSERS = {
|
|
106
|
+
iris: parseIris,
|
|
107
|
+
graphql: parseGraphQL,
|
|
108
|
+
delta: parseDelta,
|
|
109
|
+
presence: parsePresence,
|
|
110
|
+
feed: parseFeed,
|
|
111
|
+
live: parseLive,
|
|
112
|
+
'region-hint': parseRegionHint
|
|
113
|
+
};
|
|
114
|
+
function parseByType(topicType, topicId, payload) {
|
|
115
|
+
const parser = PARSERS[topicType];
|
|
116
|
+
if (!parser) {
|
|
117
|
+
debug(`⚠️ Unknown topic type: ${topicType}`);
|
|
118
|
+
return { type: topicType, error: 'Unknown parser', raw: payload.toString('utf-8', 0, 200) };
|
|
119
|
+
}
|
|
120
|
+
try {
|
|
121
|
+
return parser(topicId, payload);
|
|
122
|
+
}
|
|
123
|
+
catch (e) {
|
|
124
|
+
debug(`Parse error for ${topicType}:`, e.message);
|
|
125
|
+
return { type: topicType, error: e.message };
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
module.exports = {
|
|
129
|
+
parseIris,
|
|
130
|
+
parseGraphQL,
|
|
131
|
+
parseDelta,
|
|
132
|
+
parsePresence,
|
|
133
|
+
parseFeed,
|
|
134
|
+
parseLive,
|
|
135
|
+
parseRegionHint,
|
|
136
|
+
parseByType,
|
|
137
|
+
ProtoParser
|
|
138
|
+
};
|