@lhremote/core 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdp/app-discovery.d.ts +57 -0
- package/dist/cdp/app-discovery.d.ts.map +1 -1
- package/dist/cdp/app-discovery.js +90 -7
- package/dist/cdp/app-discovery.js.map +1 -1
- package/dist/cdp/app-discovery.test.js +180 -9
- package/dist/cdp/app-discovery.test.js.map +1 -1
- package/dist/cdp/client.d.ts +8 -1
- package/dist/cdp/client.d.ts.map +1 -1
- package/dist/cdp/client.js +8 -1
- package/dist/cdp/client.js.map +1 -1
- package/dist/cdp/discovery.d.ts.map +1 -1
- package/dist/cdp/discovery.js +5 -1
- package/dist/cdp/discovery.js.map +1 -1
- package/dist/cdp/discovery.test.js +7 -0
- package/dist/cdp/discovery.test.js.map +1 -1
- package/dist/cdp/index.d.ts +1 -1
- package/dist/cdp/index.d.ts.map +1 -1
- package/dist/cdp/index.js +1 -1
- package/dist/cdp/index.js.map +1 -1
- package/dist/cdp/instance-discovery.d.ts.map +1 -1
- package/dist/cdp/instance-discovery.js +25 -10
- package/dist/cdp/instance-discovery.js.map +1 -1
- package/dist/cdp/instance-discovery.test.js +17 -0
- package/dist/cdp/instance-discovery.test.js.map +1 -1
- package/dist/cdp/testing/launch-chromium.d.ts +1 -1
- package/dist/cdp/testing/launch-chromium.js +2 -2
- package/dist/db/client.d.ts.map +1 -1
- package/dist/db/client.js +3 -0
- package/dist/db/client.js.map +1 -1
- package/dist/db/repositories/campaign-hard-delete.integration.test.js +4 -1
- package/dist/db/repositories/campaign-hard-delete.integration.test.js.map +1 -1
- package/dist/db/repositories/campaign.d.ts.map +1 -1
- package/dist/db/repositories/campaign.js +81 -33
- package/dist/db/repositories/campaign.js.map +1 -1
- package/dist/db/repositories/campaign.test.js +2 -2
- package/dist/db/repositories/collection-list.d.ts +11 -0
- package/dist/db/repositories/collection-list.d.ts.map +1 -1
- package/dist/db/repositories/collection-list.integration.test.js +6 -4
- package/dist/db/repositories/collection-list.integration.test.js.map +1 -1
- package/dist/db/repositories/collection-list.js +92 -2
- package/dist/db/repositories/collection-list.js.map +1 -1
- package/dist/db/testing/create-fixture.js +36 -2
- package/dist/db/testing/create-fixture.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/linkedin/dom-automation-retry.test.d.ts +2 -0
- package/dist/linkedin/dom-automation-retry.test.d.ts.map +1 -0
- package/dist/linkedin/dom-automation-retry.test.js +51 -0
- package/dist/linkedin/dom-automation-retry.test.js.map +1 -0
- package/dist/linkedin/dom-automation.d.ts +166 -6
- package/dist/linkedin/dom-automation.d.ts.map +1 -1
- package/dist/linkedin/dom-automation.js +496 -21
- package/dist/linkedin/dom-automation.js.map +1 -1
- package/dist/linkedin/humanized-mouse.d.ts +69 -0
- package/dist/linkedin/humanized-mouse.d.ts.map +1 -0
- package/dist/linkedin/humanized-mouse.js +109 -0
- package/dist/linkedin/humanized-mouse.js.map +1 -0
- package/dist/linkedin/index.d.ts +3 -2
- package/dist/linkedin/index.d.ts.map +1 -1
- package/dist/linkedin/index.js +3 -2
- package/dist/linkedin/index.js.map +1 -1
- package/dist/linkedin/selectors.d.ts +74 -48
- package/dist/linkedin/selectors.d.ts.map +1 -1
- package/dist/linkedin/selectors.js +64 -41
- package/dist/linkedin/selectors.js.map +1 -1
- package/dist/operations/add-people-to-collection.d.ts +1 -1
- package/dist/operations/add-people-to-collection.d.ts.map +1 -1
- package/dist/operations/add-people-to-collection.js +3 -6
- package/dist/operations/add-people-to-collection.js.map +1 -1
- package/dist/operations/build-linkedin-url.test.d.ts +2 -0
- package/dist/operations/build-linkedin-url.test.d.ts.map +1 -0
- package/dist/operations/build-linkedin-url.test.js +158 -0
- package/dist/operations/build-linkedin-url.test.js.map +1 -0
- package/dist/operations/campaign-add-action.d.ts +1 -1
- package/dist/operations/campaign-add-action.d.ts.map +1 -1
- package/dist/operations/campaign-add-action.js +3 -6
- package/dist/operations/campaign-add-action.js.map +1 -1
- package/dist/operations/campaign-create.d.ts +1 -1
- package/dist/operations/campaign-create.d.ts.map +1 -1
- package/dist/operations/campaign-create.js +3 -6
- package/dist/operations/campaign-create.js.map +1 -1
- package/dist/operations/campaign-delete.d.ts +1 -1
- package/dist/operations/campaign-delete.d.ts.map +1 -1
- package/dist/operations/campaign-delete.js +3 -6
- package/dist/operations/campaign-delete.js.map +1 -1
- package/dist/operations/campaign-erase.d.ts +1 -1
- package/dist/operations/campaign-erase.d.ts.map +1 -1
- package/dist/operations/campaign-erase.js +3 -6
- package/dist/operations/campaign-erase.js.map +1 -1
- package/dist/operations/campaign-exclude-add.d.ts +1 -1
- package/dist/operations/campaign-exclude-add.d.ts.map +1 -1
- package/dist/operations/campaign-exclude-add.js +3 -6
- package/dist/operations/campaign-exclude-add.js.map +1 -1
- package/dist/operations/campaign-exclude-list.d.ts +1 -1
- package/dist/operations/campaign-exclude-list.d.ts.map +1 -1
- package/dist/operations/campaign-exclude-list.js +3 -6
- package/dist/operations/campaign-exclude-list.js.map +1 -1
- package/dist/operations/campaign-exclude-remove.d.ts +1 -1
- package/dist/operations/campaign-exclude-remove.d.ts.map +1 -1
- package/dist/operations/campaign-exclude-remove.js +3 -6
- package/dist/operations/campaign-exclude-remove.js.map +1 -1
- package/dist/operations/campaign-export.d.ts +1 -1
- package/dist/operations/campaign-export.d.ts.map +1 -1
- package/dist/operations/campaign-export.js +3 -6
- package/dist/operations/campaign-export.js.map +1 -1
- package/dist/operations/campaign-get.d.ts +1 -1
- package/dist/operations/campaign-get.d.ts.map +1 -1
- package/dist/operations/campaign-get.js +3 -6
- package/dist/operations/campaign-get.js.map +1 -1
- package/dist/operations/campaign-list-people.d.ts +1 -1
- package/dist/operations/campaign-list-people.d.ts.map +1 -1
- package/dist/operations/campaign-list-people.js +3 -6
- package/dist/operations/campaign-list-people.js.map +1 -1
- package/dist/operations/campaign-list.d.ts +1 -1
- package/dist/operations/campaign-list.d.ts.map +1 -1
- package/dist/operations/campaign-list.js +3 -6
- package/dist/operations/campaign-list.js.map +1 -1
- package/dist/operations/campaign-move-next.d.ts +1 -1
- package/dist/operations/campaign-move-next.d.ts.map +1 -1
- package/dist/operations/campaign-move-next.js +3 -6
- package/dist/operations/campaign-move-next.js.map +1 -1
- package/dist/operations/campaign-remove-action.d.ts +1 -1
- package/dist/operations/campaign-remove-action.d.ts.map +1 -1
- package/dist/operations/campaign-remove-action.js +3 -6
- package/dist/operations/campaign-remove-action.js.map +1 -1
- package/dist/operations/campaign-remove-people.d.ts +1 -1
- package/dist/operations/campaign-remove-people.d.ts.map +1 -1
- package/dist/operations/campaign-remove-people.js +3 -6
- package/dist/operations/campaign-remove-people.js.map +1 -1
- package/dist/operations/campaign-reorder-actions.d.ts +1 -1
- package/dist/operations/campaign-reorder-actions.d.ts.map +1 -1
- package/dist/operations/campaign-reorder-actions.js +3 -6
- package/dist/operations/campaign-reorder-actions.js.map +1 -1
- package/dist/operations/campaign-retry.d.ts +1 -1
- package/dist/operations/campaign-retry.d.ts.map +1 -1
- package/dist/operations/campaign-retry.js +3 -6
- package/dist/operations/campaign-retry.js.map +1 -1
- package/dist/operations/campaign-start.d.ts +1 -1
- package/dist/operations/campaign-start.d.ts.map +1 -1
- package/dist/operations/campaign-start.js +3 -6
- package/dist/operations/campaign-start.js.map +1 -1
- package/dist/operations/campaign-statistics.d.ts +1 -1
- package/dist/operations/campaign-statistics.d.ts.map +1 -1
- package/dist/operations/campaign-statistics.js +3 -6
- package/dist/operations/campaign-statistics.js.map +1 -1
- package/dist/operations/campaign-status.d.ts +1 -1
- package/dist/operations/campaign-status.d.ts.map +1 -1
- package/dist/operations/campaign-status.js +3 -6
- package/dist/operations/campaign-status.js.map +1 -1
- package/dist/operations/campaign-stop.d.ts +1 -1
- package/dist/operations/campaign-stop.d.ts.map +1 -1
- package/dist/operations/campaign-stop.js +3 -6
- package/dist/operations/campaign-stop.js.map +1 -1
- package/dist/operations/campaign-update-action.d.ts +1 -1
- package/dist/operations/campaign-update-action.d.ts.map +1 -1
- package/dist/operations/campaign-update-action.js +3 -6
- package/dist/operations/campaign-update-action.js.map +1 -1
- package/dist/operations/campaign-update.d.ts +1 -1
- package/dist/operations/campaign-update.d.ts.map +1 -1
- package/dist/operations/campaign-update.js +3 -6
- package/dist/operations/campaign-update.js.map +1 -1
- package/dist/operations/check-replies.d.ts +3 -1
- package/dist/operations/check-replies.d.ts.map +1 -1
- package/dist/operations/check-replies.js +124 -17
- package/dist/operations/check-replies.js.map +1 -1
- package/dist/operations/check-replies.test.js +152 -17
- package/dist/operations/check-replies.test.js.map +1 -1
- package/dist/operations/collect-people.d.ts +1 -1
- package/dist/operations/collect-people.d.ts.map +1 -1
- package/dist/operations/collect-people.js +18 -12
- package/dist/operations/collect-people.js.map +1 -1
- package/dist/operations/collect-people.test.js +21 -5
- package/dist/operations/collect-people.test.js.map +1 -1
- package/dist/operations/comment-on-post.d.ts +4 -1
- package/dist/operations/comment-on-post.d.ts.map +1 -1
- package/dist/operations/comment-on-post.js +15 -19
- package/dist/operations/comment-on-post.js.map +1 -1
- package/dist/operations/comment-on-post.test.js +8 -6
- package/dist/operations/comment-on-post.test.js.map +1 -1
- package/dist/operations/create-collection.d.ts +1 -1
- package/dist/operations/create-collection.d.ts.map +1 -1
- package/dist/operations/create-collection.js +5 -7
- package/dist/operations/create-collection.js.map +1 -1
- package/dist/operations/create-collection.test.js +3 -1
- package/dist/operations/create-collection.test.js.map +1 -1
- package/dist/operations/delete-collection.d.ts +1 -1
- package/dist/operations/delete-collection.d.ts.map +1 -1
- package/dist/operations/delete-collection.js +3 -6
- package/dist/operations/delete-collection.js.map +1 -1
- package/dist/operations/dismiss-errors.d.ts +11 -5
- package/dist/operations/dismiss-errors.d.ts.map +1 -1
- package/dist/operations/dismiss-errors.js +68 -34
- package/dist/operations/dismiss-errors.js.map +1 -1
- package/dist/operations/dismiss-errors.test.js +129 -8
- package/dist/operations/dismiss-errors.test.js.map +1 -1
- package/dist/operations/endorse-skills.test.d.ts +2 -0
- package/dist/operations/endorse-skills.test.d.ts.map +1 -0
- package/dist/operations/endorse-skills.test.js +70 -0
- package/dist/operations/endorse-skills.test.js.map +1 -0
- package/dist/operations/enrich-profile.test.d.ts +2 -0
- package/dist/operations/enrich-profile.test.d.ts.map +1 -0
- package/dist/operations/enrich-profile.test.js +73 -0
- package/dist/operations/enrich-profile.test.js.map +1 -0
- package/dist/operations/ephemeral-action.d.ts +2 -1
- package/dist/operations/ephemeral-action.d.ts.map +1 -1
- package/dist/operations/ephemeral-action.js +5 -7
- package/dist/operations/ephemeral-action.js.map +1 -1
- package/dist/operations/ephemeral-action.test.d.ts +2 -0
- package/dist/operations/ephemeral-action.test.d.ts.map +1 -0
- package/dist/operations/ephemeral-action.test.js +159 -0
- package/dist/operations/ephemeral-action.test.js.map +1 -0
- package/dist/operations/follow-person.test.d.ts +2 -0
- package/dist/operations/follow-person.test.d.ts.map +1 -0
- package/dist/operations/follow-person.test.js +57 -0
- package/dist/operations/follow-person.test.js.map +1 -0
- package/dist/operations/get-action-budget.d.ts +1 -1
- package/dist/operations/get-action-budget.d.ts.map +1 -1
- package/dist/operations/get-action-budget.js +3 -6
- package/dist/operations/get-action-budget.js.map +1 -1
- package/dist/operations/get-errors.d.ts +5 -1
- package/dist/operations/get-errors.d.ts.map +1 -1
- package/dist/operations/get-errors.js +55 -33
- package/dist/operations/get-errors.js.map +1 -1
- package/dist/operations/get-errors.test.js +54 -55
- package/dist/operations/get-errors.test.js.map +1 -1
- package/dist/operations/get-feed.d.ts +83 -4
- package/dist/operations/get-feed.d.ts.map +1 -1
- package/dist/operations/get-feed.js +400 -153
- package/dist/operations/get-feed.js.map +1 -1
- package/dist/operations/get-feed.test.js +416 -190
- package/dist/operations/get-feed.test.js.map +1 -1
- package/dist/operations/get-post-engagers.d.ts +6 -3
- package/dist/operations/get-post-engagers.d.ts.map +1 -1
- package/dist/operations/get-post-engagers.js +278 -78
- package/dist/operations/get-post-engagers.js.map +1 -1
- package/dist/operations/get-post-engagers.test.js +292 -14
- package/dist/operations/get-post-engagers.test.js.map +1 -1
- package/dist/operations/get-post-stats.d.ts +8 -3
- package/dist/operations/get-post-stats.d.ts.map +1 -1
- package/dist/operations/get-post-stats.js +101 -37
- package/dist/operations/get-post-stats.js.map +1 -1
- package/dist/operations/get-post-stats.test.js +137 -2
- package/dist/operations/get-post-stats.test.js.map +1 -1
- package/dist/operations/get-post.d.ts +9 -150
- package/dist/operations/get-post.d.ts.map +1 -1
- package/dist/operations/get-post.js +356 -210
- package/dist/operations/get-post.js.map +1 -1
- package/dist/operations/get-post.test.js +210 -387
- package/dist/operations/get-post.test.js.map +1 -1
- package/dist/operations/get-profile-activity.d.ts +13 -92
- package/dist/operations/get-profile-activity.d.ts.map +1 -1
- package/dist/operations/get-profile-activity.js +305 -105
- package/dist/operations/get-profile-activity.js.map +1 -1
- package/dist/operations/get-profile-activity.test.js +277 -158
- package/dist/operations/get-profile-activity.test.js.map +1 -1
- package/dist/operations/get-throttle-status.d.ts +1 -1
- package/dist/operations/get-throttle-status.d.ts.map +1 -1
- package/dist/operations/get-throttle-status.js +4 -10
- package/dist/operations/get-throttle-status.js.map +1 -1
- package/dist/operations/import-people-from-collection.d.ts +1 -1
- package/dist/operations/import-people-from-collection.d.ts.map +1 -1
- package/dist/operations/import-people-from-collection.js +3 -6
- package/dist/operations/import-people-from-collection.js.map +1 -1
- package/dist/operations/import-people-from-urls.d.ts +1 -1
- package/dist/operations/import-people-from-urls.d.ts.map +1 -1
- package/dist/operations/import-people-from-urls.js +3 -6
- package/dist/operations/import-people-from-urls.js.map +1 -1
- package/dist/operations/index.d.ts +2 -2
- package/dist/operations/index.d.ts.map +1 -1
- package/dist/operations/index.js +2 -1
- package/dist/operations/index.js.map +1 -1
- package/dist/operations/like-person-posts.test.d.ts +2 -0
- package/dist/operations/like-person-posts.test.d.ts.map +1 -0
- package/dist/operations/like-person-posts.test.js +103 -0
- package/dist/operations/like-person-posts.test.js.map +1 -0
- package/dist/operations/list-collections.d.ts +1 -1
- package/dist/operations/list-collections.d.ts.map +1 -1
- package/dist/operations/list-collections.js +3 -6
- package/dist/operations/list-collections.js.map +1 -1
- package/dist/operations/message-person.test.d.ts +2 -0
- package/dist/operations/message-person.test.d.ts.map +1 -0
- package/dist/operations/message-person.test.js +108 -0
- package/dist/operations/message-person.test.js.map +1 -0
- package/dist/operations/navigate-away.d.ts +14 -0
- package/dist/operations/navigate-away.d.ts.map +1 -0
- package/dist/operations/navigate-away.js +24 -0
- package/dist/operations/navigate-away.js.map +1 -0
- package/dist/operations/navigate-away.test.d.ts +2 -0
- package/dist/operations/navigate-away.test.d.ts.map +1 -0
- package/dist/operations/navigate-away.test.js +51 -0
- package/dist/operations/navigate-away.test.js.map +1 -0
- package/dist/operations/query-messages.d.ts +1 -1
- package/dist/operations/query-messages.d.ts.map +1 -1
- package/dist/operations/query-messages.js +3 -6
- package/dist/operations/query-messages.js.map +1 -1
- package/dist/operations/react-to-post.d.ts +16 -4
- package/dist/operations/react-to-post.d.ts.map +1 -1
- package/dist/operations/react-to-post.js +86 -24
- package/dist/operations/react-to-post.js.map +1 -1
- package/dist/operations/react-to-post.test.js +55 -5
- package/dist/operations/react-to-post.test.js.map +1 -1
- package/dist/operations/remove-connection.test.d.ts +2 -0
- package/dist/operations/remove-connection.test.d.ts.map +1 -0
- package/dist/operations/remove-connection.test.js +45 -0
- package/dist/operations/remove-connection.test.js.map +1 -0
- package/dist/operations/remove-people-from-collection.d.ts +1 -1
- package/dist/operations/remove-people-from-collection.d.ts.map +1 -1
- package/dist/operations/remove-people-from-collection.js +3 -6
- package/dist/operations/remove-people-from-collection.js.map +1 -1
- package/dist/operations/resolve-linkedin-entity.d.ts.map +1 -1
- package/dist/operations/resolve-linkedin-entity.js +2 -2
- package/dist/operations/resolve-linkedin-entity.js.map +1 -1
- package/dist/operations/resolve-linkedin-entity.test.d.ts +2 -0
- package/dist/operations/resolve-linkedin-entity.test.d.ts.map +1 -0
- package/dist/operations/resolve-linkedin-entity.test.js +343 -0
- package/dist/operations/resolve-linkedin-entity.test.js.map +1 -0
- package/dist/operations/scrape-messaging-history.d.ts +2 -1
- package/dist/operations/scrape-messaging-history.d.ts.map +1 -1
- package/dist/operations/scrape-messaging-history.js +113 -18
- package/dist/operations/scrape-messaging-history.js.map +1 -1
- package/dist/operations/scrape-messaging-history.test.js +109 -12
- package/dist/operations/scrape-messaging-history.test.js.map +1 -1
- package/dist/operations/search-posts.d.ts +20 -112
- package/dist/operations/search-posts.d.ts.map +1 -1
- package/dist/operations/search-posts.js +369 -170
- package/dist/operations/search-posts.js.map +1 -1
- package/dist/operations/search-posts.test.js +273 -234
- package/dist/operations/search-posts.test.js.map +1 -1
- package/dist/operations/send-inmail.test.d.ts +2 -0
- package/dist/operations/send-inmail.test.d.ts.map +1 -0
- package/dist/operations/send-inmail.test.js +108 -0
- package/dist/operations/send-inmail.test.js.map +1 -0
- package/dist/operations/send-invite.test.d.ts +2 -0
- package/dist/operations/send-invite.test.d.ts.map +1 -0
- package/dist/operations/send-invite.test.js +59 -0
- package/dist/operations/send-invite.test.js.map +1 -0
- package/dist/operations/types.d.ts +27 -1
- package/dist/operations/types.d.ts.map +1 -1
- package/dist/operations/types.js +14 -1
- package/dist/operations/types.js.map +1 -1
- package/dist/operations/visit-profile.d.ts +1 -1
- package/dist/operations/visit-profile.d.ts.map +1 -1
- package/dist/operations/visit-profile.js +3 -6
- package/dist/operations/visit-profile.js.map +1 -1
- package/dist/services/account-resolution.d.ts +10 -4
- package/dist/services/account-resolution.d.ts.map +1 -1
- package/dist/services/account-resolution.js +63 -5
- package/dist/services/account-resolution.js.map +1 -1
- package/dist/services/app.d.ts +6 -2
- package/dist/services/app.d.ts.map +1 -1
- package/dist/services/app.js +18 -6
- package/dist/services/app.js.map +1 -1
- package/dist/services/app.test.js +41 -7
- package/dist/services/app.test.js.map +1 -1
- package/dist/services/campaign.d.ts +40 -4
- package/dist/services/campaign.d.ts.map +1 -1
- package/dist/services/campaign.js +176 -10
- package/dist/services/campaign.js.map +1 -1
- package/dist/services/campaign.test.js +53 -15
- package/dist/services/campaign.test.js.map +1 -1
- package/dist/services/collection.d.ts +16 -21
- package/dist/services/collection.d.ts.map +1 -1
- package/dist/services/collection.js +34 -47
- package/dist/services/collection.js.map +1 -1
- package/dist/services/collection.test.js +30 -91
- package/dist/services/collection.test.js.map +1 -1
- package/dist/services/ephemeral-campaign.d.ts +6 -0
- package/dist/services/ephemeral-campaign.d.ts.map +1 -1
- package/dist/services/ephemeral-campaign.js +54 -10
- package/dist/services/ephemeral-campaign.js.map +1 -1
- package/dist/services/ephemeral-campaign.test.js +23 -10
- package/dist/services/ephemeral-campaign.test.js.map +1 -1
- package/dist/services/errors.d.ts +2 -1
- package/dist/services/errors.d.ts.map +1 -1
- package/dist/services/errors.js +6 -3
- package/dist/services/errors.js.map +1 -1
- package/dist/services/index.d.ts +1 -2
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +1 -2
- package/dist/services/index.js.map +1 -1
- package/dist/services/instance-context.d.ts +5 -1
- package/dist/services/instance-context.d.ts.map +1 -1
- package/dist/services/instance-context.js +87 -28
- package/dist/services/instance-context.js.map +1 -1
- package/dist/services/instance-context.test.js +5 -1
- package/dist/services/instance-context.test.js.map +1 -1
- package/dist/services/instance-lifecycle.d.ts.map +1 -1
- package/dist/services/instance-lifecycle.js +32 -1
- package/dist/services/instance-lifecycle.js.map +1 -1
- package/dist/services/instance-lifecycle.test.js +52 -1
- package/dist/services/instance-lifecycle.test.js.map +1 -1
- package/dist/services/instance.d.ts +37 -9
- package/dist/services/instance.d.ts.map +1 -1
- package/dist/services/instance.js +100 -25
- package/dist/services/instance.js.map +1 -1
- package/dist/services/instance.test.js +157 -0
- package/dist/services/instance.test.js.map +1 -1
- package/dist/services/launcher.d.ts +47 -3
- package/dist/services/launcher.d.ts.map +1 -1
- package/dist/services/launcher.js +205 -33
- package/dist/services/launcher.js.map +1 -1
- package/dist/services/launcher.test.js +133 -6
- package/dist/services/launcher.test.js.map +1 -1
- package/dist/services/source-type-registry.d.ts +8 -0
- package/dist/services/source-type-registry.d.ts.map +1 -1
- package/dist/services/source-type-registry.js +39 -0
- package/dist/services/source-type-registry.js.map +1 -1
- package/dist/services/source-type-registry.test.js +31 -1
- package/dist/services/source-type-registry.test.js.map +1 -1
- package/dist/services/status.d.ts +6 -2
- package/dist/services/status.d.ts.map +1 -1
- package/dist/services/status.js +67 -34
- package/dist/services/status.js.map +1 -1
- package/dist/services/status.test.js +9 -2
- package/dist/services/status.test.js.map +1 -1
- package/dist/testing/e2e-helpers.d.ts +47 -1
- package/dist/testing/e2e-helpers.d.ts.map +1 -1
- package/dist/testing/e2e-helpers.js +244 -7
- package/dist/testing/e2e-helpers.js.map +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/types/account.d.ts +1 -1
- package/dist/types/campaign.d.ts +1 -1
- package/dist/types/campaign.d.ts.map +1 -1
- package/dist/types/feed.d.ts +1 -3
- package/dist/types/feed.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/cdp-port.d.ts.map +1 -1
- package/dist/utils/cdp-port.js +3 -1
- package/dist/utils/cdp-port.js.map +1 -1
- package/dist/utils/cdp-port.test.js +1 -1
- package/dist/utils/cdp-port.test.js.map +1 -1
- package/dist/utils/delay.d.ts +79 -0
- package/dist/utils/delay.d.ts.map +1 -1
- package/dist/utils/delay.js +118 -0
- package/dist/utils/delay.js.map +1 -1
- package/dist/utils/delay.test.js +111 -1
- package/dist/utils/delay.test.js.map +1 -1
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/session-pacer.d.ts +27 -0
- package/dist/utils/session-pacer.d.ts.map +1 -0
- package/dist/utils/session-pacer.js +55 -0
- package/dist/utils/session-pacer.js.map +1 -0
- package/dist/utils/session-pacer.test.d.ts +2 -0
- package/dist/utils/session-pacer.test.d.ts.map +1 -0
- package/dist/utils/session-pacer.test.js +111 -0
- package/dist/utils/session-pacer.test.js.map +1 -0
- package/package.json +1 -1
- package/dist/linkedin/__tests__/selectors.integration.test.d.ts +0 -2
- package/dist/linkedin/__tests__/selectors.integration.test.d.ts.map +0 -1
- package/dist/linkedin/__tests__/selectors.integration.test.js +0 -258
- package/dist/linkedin/__tests__/selectors.integration.test.js.map +0 -1
- package/dist/types/search-posts.d.ts +0 -22
- package/dist/types/search-posts.d.ts.map +0 -1
- package/dist/types/search-posts.js +0 -4
- package/dist/types/search-posts.js.map +0 -1
- package/dist/voyager/index.d.ts +0 -2
- package/dist/voyager/index.d.ts.map +0 -1
- package/dist/voyager/index.js +0 -4
- package/dist/voyager/index.js.map +0 -1
- package/dist/voyager/interceptor.d.ts +0 -100
- package/dist/voyager/interceptor.d.ts.map +0 -1
- package/dist/voyager/interceptor.integration.test.d.ts +0 -2
- package/dist/voyager/interceptor.integration.test.d.ts.map +0 -1
- package/dist/voyager/interceptor.integration.test.js +0 -89
- package/dist/voyager/interceptor.integration.test.js.map +0 -1
- package/dist/voyager/interceptor.js +0 -235
- package/dist/voyager/interceptor.js.map +0 -1
- package/dist/voyager/interceptor.test.d.ts +0 -2
- package/dist/voyager/interceptor.test.d.ts.map +0 -1
- package/dist/voyager/interceptor.test.js +0 -372
- package/dist/voyager/interceptor.test.js.map +0 -1
|
@@ -7,6 +7,12 @@ import type { Account, InstanceIssue, InstanceStatus, PopupState, UIHealthStatus
|
|
|
7
7
|
* methods to start/stop instances and query accounts.
|
|
8
8
|
*/
|
|
9
9
|
export declare class LauncherService {
|
|
10
|
+
/**
|
|
11
|
+
* CDP expression snippet that waits for the webpack module registry
|
|
12
|
+
* and sets `wpRequire` in the enclosing scope. Callers must check
|
|
13
|
+
* `wpRequire` for null and handle the failure case themselves.
|
|
14
|
+
*/
|
|
15
|
+
private static readonly WEBPACK_INIT;
|
|
10
16
|
private readonly port;
|
|
11
17
|
private readonly host;
|
|
12
18
|
private readonly allowRemote;
|
|
@@ -29,6 +35,16 @@ export declare class LauncherService {
|
|
|
29
35
|
/**
|
|
30
36
|
* Start a LinkedHelper instance for the given account.
|
|
31
37
|
*
|
|
38
|
+
* Replicates the data-fetching sequence that the LinkedHelper UI
|
|
39
|
+
* performs before calling `mainWindow.startInstance()`:
|
|
40
|
+
*
|
|
41
|
+
* 1. Resolve renderer-side services via the webpack module registry.
|
|
42
|
+
* 2. Refetch the full account object (with license, proxy, instance data).
|
|
43
|
+
* 3. Read `userId` from the auth service and user profile from the user service.
|
|
44
|
+
* 4. Fetch `frontendSettings` from the frontend-settings service.
|
|
45
|
+
* 5. Transform the license into the format expected by the instance.
|
|
46
|
+
* 6. Call `startInstance` with all populated fields.
|
|
47
|
+
*
|
|
32
48
|
* @throws {StartInstanceError} if the instance fails to start.
|
|
33
49
|
*/
|
|
34
50
|
startInstance(accountId: number): Promise<void>;
|
|
@@ -41,10 +57,13 @@ export declare class LauncherService {
|
|
|
41
57
|
*/
|
|
42
58
|
getInstanceStatus(accountId: number): Promise<InstanceStatus>;
|
|
43
59
|
/**
|
|
44
|
-
* List all accounts configured in
|
|
60
|
+
* List all accounts configured in LinkedHelper.
|
|
45
61
|
*
|
|
46
|
-
* Accounts are
|
|
47
|
-
*
|
|
62
|
+
* Accounts are read from the renderer-side webpack service cache
|
|
63
|
+
* (`runningLiAccountsService.extendedLinkedInAccountsBS`). The
|
|
64
|
+
* launcher populates this cache on startup via IPC; we poll until
|
|
65
|
+
* it becomes available rather than calling `refetchLinkedInAccounts`
|
|
66
|
+
* (whose backend API now rejects the old embed format with 400).
|
|
48
67
|
*/
|
|
49
68
|
listAccounts(): Promise<Account[]>;
|
|
50
69
|
/**
|
|
@@ -70,6 +89,31 @@ export declare class LauncherService {
|
|
|
70
89
|
* dismissable popup was present.
|
|
71
90
|
*/
|
|
72
91
|
dismissPopup(): Promise<boolean>;
|
|
92
|
+
/**
|
|
93
|
+
* Dismiss an active dialog issue on a LinkedHelper instance.
|
|
94
|
+
*
|
|
95
|
+
* Dialogs appear as "issues" on the instance (e.g. when the launcher
|
|
96
|
+
* sends a close command). Each dialog exposes one or more control
|
|
97
|
+
* buttons identified by `buttonId`. This method programmatically
|
|
98
|
+
* clicks the specified button to dismiss the dialog.
|
|
99
|
+
*
|
|
100
|
+
* @param liId LinkedIn account ID that owns the instance.
|
|
101
|
+
* @param dialogId The dialog issue ID (from {@link InstanceIssue}).
|
|
102
|
+
* @param buttonId The control button ID to click (from `DialogIssueData.options.controls[].id`).
|
|
103
|
+
*/
|
|
104
|
+
dismissInstanceDialog(liId: number, dialogId: string, buttonId: string): Promise<void>;
|
|
105
|
+
/**
|
|
106
|
+
* Stop a running instance, automatically dismissing the confirmation
|
|
107
|
+
* dialog that LinkedHelper may show.
|
|
108
|
+
*
|
|
109
|
+
* Calls {@link stopInstance}, then polls {@link getInstanceIssues} at
|
|
110
|
+
* 500 ms intervals for up to 10 s. When a dialog issue appears, its
|
|
111
|
+
* first control button is clicked via {@link dismissInstanceDialog}.
|
|
112
|
+
* If no dialog surfaces within the timeout the method returns normally.
|
|
113
|
+
*
|
|
114
|
+
* @param liId LinkedIn account ID that owns the instance.
|
|
115
|
+
*/
|
|
116
|
+
stopInstanceWithDialogDismissal(liId: number): Promise<void>;
|
|
73
117
|
/**
|
|
74
118
|
* Check the overall UI health of a LinkedHelper instance.
|
|
75
119
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../../src/services/launcher.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,OAAO,EACP,aAAa,EACb,cAAc,EACd,UAAU,EAEV,cAAc,EACf,MAAM,mBAAmB,CAAC;AAU3B;;;;;;GAMG;AACH,qBAAa,eA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,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAcpD;;OAEG;IACG,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAoBnE;;;;;;;;OAQG;IACG,YAAY,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAyCxC;;;;;;OAMG;IACG,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAwB/D;;;;;;OAMG;IACG,aAAa,IAAI,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAoBjD;;;;;OAKG;IACG,YAAY,IAAI,OAAO,CAAC,OAAO,CAAC;IAgBtC;;;;;;;;;;;OAWG;IACG,qBAAqB,CACzB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC;IAkBhB;;;;;;;;;;OAUG;IACG,+BAA+B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBlE;;;;;OAKG;IACG,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAW1D,kEAAkE;IAClE,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED,OAAO,CAAC,eAAe;YAOT,gBAAgB;IAQ9B;;;;;;;;;;;;;OAaG;YACW,oBAAoB;CAsDnC"}
|
|
@@ -11,6 +11,22 @@ import { LinkedHelperNotRunningError, LinkedHelperUnreachableError, NodeIntegrat
|
|
|
11
11
|
* methods to start/stop instances and query accounts.
|
|
12
12
|
*/
|
|
13
13
|
export class LauncherService {
|
|
14
|
+
/**
|
|
15
|
+
* CDP expression snippet that waits for the webpack module registry
|
|
16
|
+
* and sets `wpRequire` in the enclosing scope. Callers must check
|
|
17
|
+
* `wpRequire` for null and handle the failure case themselves.
|
|
18
|
+
*/
|
|
19
|
+
static WEBPACK_INIT = `
|
|
20
|
+
const _wpDeadline = Date.now() + 15000;
|
|
21
|
+
while (!window.webpackChunk_linked_helper_front && Date.now() < _wpDeadline) {
|
|
22
|
+
await new Promise(r => setTimeout(r, 250));
|
|
23
|
+
}
|
|
24
|
+
let wpRequire = null;
|
|
25
|
+
if (window.webpackChunk_linked_helper_front) {
|
|
26
|
+
window.webpackChunk_linked_helper_front.push(
|
|
27
|
+
[[Symbol()], {}, (req) => { wpRequire = req; }]
|
|
28
|
+
);
|
|
29
|
+
}`;
|
|
14
30
|
port;
|
|
15
31
|
host;
|
|
16
32
|
allowRemote;
|
|
@@ -41,8 +57,29 @@ export class LauncherService {
|
|
|
41
57
|
}
|
|
42
58
|
throw error;
|
|
43
59
|
}
|
|
60
|
+
let nodeContextId;
|
|
61
|
+
try {
|
|
62
|
+
nodeContextId = await this.resolveNodeContextId(client);
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
// No Node.js context — likely a LinkedIn page on the instance port.
|
|
66
|
+
client.disconnect();
|
|
67
|
+
throw new WrongPortError(this.port);
|
|
68
|
+
}
|
|
69
|
+
// Validate that the target is the launcher (has electronStore),
|
|
70
|
+
// not an instance UI page that happens to have Node.js access.
|
|
71
|
+
const isLauncher = await client.evaluate(`(() => {
|
|
72
|
+
try {
|
|
73
|
+
const r = require('@electron/remote');
|
|
74
|
+
return typeof r.getGlobal('mainWindow')?.electronStore?.get === 'function';
|
|
75
|
+
} catch { return false; }
|
|
76
|
+
})()`, false, nodeContextId);
|
|
77
|
+
if (!isLauncher) {
|
|
78
|
+
client.disconnect();
|
|
79
|
+
throw new WrongPortError(this.port);
|
|
80
|
+
}
|
|
44
81
|
this.client = client;
|
|
45
|
-
this.nodeContextId =
|
|
82
|
+
this.nodeContextId = nodeContextId;
|
|
46
83
|
}
|
|
47
84
|
/**
|
|
48
85
|
* Disconnect from the launcher.
|
|
@@ -55,6 +92,16 @@ export class LauncherService {
|
|
|
55
92
|
/**
|
|
56
93
|
* Start a LinkedHelper instance for the given account.
|
|
57
94
|
*
|
|
95
|
+
* Replicates the data-fetching sequence that the LinkedHelper UI
|
|
96
|
+
* performs before calling `mainWindow.startInstance()`:
|
|
97
|
+
*
|
|
98
|
+
* 1. Resolve renderer-side services via the webpack module registry.
|
|
99
|
+
* 2. Refetch the full account object (with license, proxy, instance data).
|
|
100
|
+
* 3. Read `userId` from the auth service and user profile from the user service.
|
|
101
|
+
* 4. Fetch `frontendSettings` from the frontend-settings service.
|
|
102
|
+
* 5. Transform the license into the format expected by the instance.
|
|
103
|
+
* 6. Call `startInstance` with all populated fields.
|
|
104
|
+
*
|
|
58
105
|
* @throws {StartInstanceError} if the instance fails to start.
|
|
59
106
|
*/
|
|
60
107
|
async startInstance(accountId) {
|
|
@@ -63,15 +110,79 @@ export class LauncherService {
|
|
|
63
110
|
try {
|
|
64
111
|
const remote = require('@electron/remote');
|
|
65
112
|
const mainWindow = remote.getGlobal('mainWindow');
|
|
113
|
+
|
|
114
|
+
${LauncherService.WEBPACK_INIT}
|
|
115
|
+
if (!wpRequire) {
|
|
116
|
+
return { success: false, error: 'webpack module registry not available' };
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const authService = wpRequire(2742).authService;
|
|
120
|
+
const userService = wpRequire(75381).userService;
|
|
121
|
+
const liAccountsSvc = wpRequire(44354).runningLiAccountsService;
|
|
122
|
+
const feSettingsSvc = wpRequire(81954).frontendSettingsService;
|
|
123
|
+
|
|
124
|
+
// 2. Get the account object from the service cache.
|
|
125
|
+
// Using refetch: false because the LH backend API now
|
|
126
|
+
// rejects the embed format used by refetchLinkedInAccounts.
|
|
127
|
+
// The cache is populated by the launcher on startup, but
|
|
128
|
+
// may not be ready immediately — poll until available.
|
|
129
|
+
let account = null;
|
|
130
|
+
const cacheDeadline = Date.now() + 30000;
|
|
131
|
+
while (Date.now() < cacheDeadline) {
|
|
132
|
+
try {
|
|
133
|
+
account = await liAccountsSvc.getLinkedInAccount({
|
|
134
|
+
id: ${String(accountId)},
|
|
135
|
+
refetch: false,
|
|
136
|
+
});
|
|
137
|
+
break;
|
|
138
|
+
} catch {
|
|
139
|
+
await new Promise(r => setTimeout(r, 500));
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (!account) {
|
|
143
|
+
return { success: false, error: 'Account not found in cache after 30s' };
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// 3. Read userId and user profile
|
|
147
|
+
const userId = authService.userId;
|
|
148
|
+
const currentUser = userService.currentUserBS?.value
|
|
149
|
+
?? await userService.fetchUser(userId);
|
|
150
|
+
|
|
151
|
+
// 4. Fetch frontend settings
|
|
152
|
+
const frontendSettings = await feSettingsSvc.getFrontendSettings();
|
|
153
|
+
|
|
154
|
+
// 5. Transform the license
|
|
155
|
+
let license = null;
|
|
156
|
+
if (account.license) {
|
|
157
|
+
const lic = account.license;
|
|
158
|
+
const ownerUid = lic.organizationId
|
|
159
|
+
? 'lh2:org:' + lic.organizationId
|
|
160
|
+
: 'lh2:user:' + (lic.userId ?? userId);
|
|
161
|
+
license = {
|
|
162
|
+
id: lic.id,
|
|
163
|
+
ownerUid: ownerUid,
|
|
164
|
+
days: lic.days,
|
|
165
|
+
expireAt: lic.expireAt,
|
|
166
|
+
featureSet: lic.featureSet,
|
|
167
|
+
subscriptionId: lic.subscriptionId,
|
|
168
|
+
addedExpiryTimeAsSubscriptionGracePeriodMs:
|
|
169
|
+
lic.addedExpiryTimeAsSubscriptionGracePeriodMs,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// 6. Call startInstance with all populated fields
|
|
66
174
|
await mainWindow.startInstance({
|
|
67
|
-
linkedInAccount:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
175
|
+
linkedInAccount: account,
|
|
176
|
+
instanceId: account.instance?.[0]?.id,
|
|
177
|
+
proxy: account.proxy ?? null,
|
|
178
|
+
license: license,
|
|
179
|
+
userId: userId,
|
|
180
|
+
frontendSettings: frontendSettings ?? {},
|
|
181
|
+
lhAccount: {
|
|
182
|
+
email: currentUser?.email ?? '',
|
|
183
|
+
fullName: [currentUser?.firstName, currentUser?.lastName]
|
|
184
|
+
.filter(Boolean).join(' '),
|
|
185
|
+
},
|
|
75
186
|
zoomDefault: 0.9,
|
|
76
187
|
shouldBringToFront: true,
|
|
77
188
|
shouldStartRunningCampaigns: false,
|
|
@@ -114,34 +225,42 @@ export class LauncherService {
|
|
|
114
225
|
return status;
|
|
115
226
|
}
|
|
116
227
|
/**
|
|
117
|
-
* List all accounts configured in
|
|
228
|
+
* List all accounts configured in LinkedHelper.
|
|
118
229
|
*
|
|
119
|
-
* Accounts are
|
|
120
|
-
*
|
|
230
|
+
* Accounts are read from the renderer-side webpack service cache
|
|
231
|
+
* (`runningLiAccountsService.extendedLinkedInAccountsBS`). The
|
|
232
|
+
* launcher populates this cache on startup via IPC; we poll until
|
|
233
|
+
* it becomes available rather than calling `refetchLinkedInAccounts`
|
|
234
|
+
* (whose backend API now rejects the old embed format with 400).
|
|
121
235
|
*/
|
|
122
236
|
async listAccounts() {
|
|
123
237
|
const client = this.ensureConnected();
|
|
124
|
-
const accounts = await this.launcherEvaluate(client, `(() => {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
238
|
+
const accounts = await this.launcherEvaluate(client, `(async () => {
|
|
239
|
+
${LauncherService.WEBPACK_INIT}
|
|
240
|
+
if (!wpRequire) return null;
|
|
241
|
+
|
|
242
|
+
const svc = wpRequire(44354).runningLiAccountsService;
|
|
243
|
+
|
|
244
|
+
// Poll until the cache is populated by the launcher's startup
|
|
245
|
+
// process (same pattern as startInstance's account polling).
|
|
246
|
+
const cacheDeadline = Date.now() + 30000;
|
|
247
|
+
while (Date.now() < cacheDeadline) {
|
|
248
|
+
const raw = svc.extendedLinkedInAccountsBS?.value;
|
|
249
|
+
if (raw) {
|
|
250
|
+
const entries = Array.isArray(raw) ? raw : Object.values(raw);
|
|
251
|
+
if (entries.length > 0) {
|
|
252
|
+
return entries.map(a => ({
|
|
253
|
+
id: a.id,
|
|
254
|
+
liId: a.id,
|
|
255
|
+
name: a.fullName ?? '',
|
|
256
|
+
email: a.email ?? undefined,
|
|
257
|
+
}));
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
await new Promise(r => setTimeout(r, 500));
|
|
261
|
+
}
|
|
262
|
+
return [];
|
|
263
|
+
})()`, true);
|
|
145
264
|
if (accounts === null) {
|
|
146
265
|
throw new WrongPortError(this.port);
|
|
147
266
|
}
|
|
@@ -211,6 +330,59 @@ export class LauncherService {
|
|
|
211
330
|
return true;
|
|
212
331
|
})()`);
|
|
213
332
|
}
|
|
333
|
+
/**
|
|
334
|
+
* Dismiss an active dialog issue on a LinkedHelper instance.
|
|
335
|
+
*
|
|
336
|
+
* Dialogs appear as "issues" on the instance (e.g. when the launcher
|
|
337
|
+
* sends a close command). Each dialog exposes one or more control
|
|
338
|
+
* buttons identified by `buttonId`. This method programmatically
|
|
339
|
+
* clicks the specified button to dismiss the dialog.
|
|
340
|
+
*
|
|
341
|
+
* @param liId LinkedIn account ID that owns the instance.
|
|
342
|
+
* @param dialogId The dialog issue ID (from {@link InstanceIssue}).
|
|
343
|
+
* @param buttonId The control button ID to click (from `DialogIssueData.options.controls[].id`).
|
|
344
|
+
*/
|
|
345
|
+
async dismissInstanceDialog(liId, dialogId, buttonId) {
|
|
346
|
+
const client = this.ensureConnected();
|
|
347
|
+
await this.launcherEvaluate(client, `(async () => {
|
|
348
|
+
const remote = require('@electron/remote');
|
|
349
|
+
const mainWindow = remote.getGlobal('mainWindow');
|
|
350
|
+
return await mainWindow.instanceManager.closeInstanceDialog(
|
|
351
|
+
${String(liId)},
|
|
352
|
+
${JSON.stringify(dialogId)},
|
|
353
|
+
{ buttonId: ${JSON.stringify(buttonId)} }
|
|
354
|
+
);
|
|
355
|
+
})()`, true);
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Stop a running instance, automatically dismissing the confirmation
|
|
359
|
+
* dialog that LinkedHelper may show.
|
|
360
|
+
*
|
|
361
|
+
* Calls {@link stopInstance}, then polls {@link getInstanceIssues} at
|
|
362
|
+
* 500 ms intervals for up to 10 s. When a dialog issue appears, its
|
|
363
|
+
* first control button is clicked via {@link dismissInstanceDialog}.
|
|
364
|
+
* If no dialog surfaces within the timeout the method returns normally.
|
|
365
|
+
*
|
|
366
|
+
* @param liId LinkedIn account ID that owns the instance.
|
|
367
|
+
*/
|
|
368
|
+
async stopInstanceWithDialogDismissal(liId) {
|
|
369
|
+
await this.stopInstance(liId);
|
|
370
|
+
const POLL_INTERVAL = 500;
|
|
371
|
+
const POLL_TIMEOUT = 10_000;
|
|
372
|
+
const deadline = Date.now() + POLL_TIMEOUT;
|
|
373
|
+
while (Date.now() < deadline) {
|
|
374
|
+
const issues = await this.getInstanceIssues(liId);
|
|
375
|
+
const dialog = issues.find((i) => i.type === "dialog");
|
|
376
|
+
if (dialog) {
|
|
377
|
+
const firstControl = dialog.data.options.controls[0];
|
|
378
|
+
if (firstControl) {
|
|
379
|
+
await this.dismissInstanceDialog(liId, dialog.id, firstControl.id);
|
|
380
|
+
}
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
await new Promise((r) => setTimeout(r, POLL_INTERVAL));
|
|
384
|
+
}
|
|
385
|
+
}
|
|
214
386
|
/**
|
|
215
387
|
* Check the overall UI health of a LinkedHelper instance.
|
|
216
388
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launcher.js","sourceRoot":"","sources":["../../src/services/launcher.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAEpC,OAAO,EAAE,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ACtC,CAAC;gBAAS,CAAC;YACT,MAAM,CAAC,GAAG,CAAC,iCAAiC,EAAE,OAAO,CAAC,CAAC;QACzD,CAAC;QAED,IAAI,CAAC;YACH,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;gBAC3B,IAAI,GAAG,CAAC,OAAO,EAAE,SAAS;oBAAE,SAAS;gBACrC,IAAI,CAAC;oBACH,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,QAAQ,CACtC,+BAA+B,EAC/B,KAAK,EACL,GAAG,CAAC,EAAE,CACP,CAAC;oBACF,IAAI,UAAU;wBAAE,OAAO,GAAG,CAAC,EAAE,CAAC;gBAChC,CAAC;gBAAC,MAAM,CAAC;oBACP,mDAAmD;gBACrD,CAAC;YACH,CAAC;QACH,CAAC;gBAAS,CAAC;YACT,MAAM,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QACvD,CAAC;QAED,MAAM,IAAI,+BAA+B,EAAE,CAAC;IAC9C,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
2
|
// Copyright (C) 2026 Oleksii PELYKH
|
|
3
3
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
4
|
-
import { LinkedHelperNotRunningError,
|
|
4
|
+
import { LinkedHelperNotRunningError, ServiceError, StartInstanceError, WrongPortError, } from "./errors.js";
|
|
5
5
|
import { LauncherService } from "./launcher.js";
|
|
6
6
|
/**
|
|
7
7
|
* Shared CDPClient mocks — LauncherService creates exactly one CDPClient,
|
|
@@ -46,12 +46,16 @@ describe("LauncherService", () => {
|
|
|
46
46
|
service = new LauncherService(9222);
|
|
47
47
|
mockConnect.mockResolvedValue(undefined);
|
|
48
48
|
nextEvaluateResult = undefined;
|
|
49
|
-
// Default: require is available in the default context
|
|
50
|
-
//
|
|
49
|
+
// Default: require is available in the default context, and the
|
|
50
|
+
// launcher validation (electronStore probe) succeeds.
|
|
51
|
+
// All other calls return nextEvaluateResult.
|
|
51
52
|
mockEvaluate.mockImplementation((expression) => {
|
|
52
53
|
if (expression === "typeof require === 'function'") {
|
|
53
54
|
return Promise.resolve(true);
|
|
54
55
|
}
|
|
56
|
+
if (expression.includes("electronStore?.get")) {
|
|
57
|
+
return Promise.resolve(true);
|
|
58
|
+
}
|
|
55
59
|
return Promise.resolve(nextEvaluateResult);
|
|
56
60
|
});
|
|
57
61
|
});
|
|
@@ -73,6 +77,19 @@ describe("LauncherService", () => {
|
|
|
73
77
|
mockConnect.mockRejectedValue(new TypeError("unexpected"));
|
|
74
78
|
await expect(service.connect()).rejects.toThrow(TypeError);
|
|
75
79
|
});
|
|
80
|
+
it("throws WrongPortError when electronStore validation fails", async () => {
|
|
81
|
+
mockEvaluate.mockImplementation((expression) => {
|
|
82
|
+
if (expression === "typeof require === 'function'") {
|
|
83
|
+
return Promise.resolve(true);
|
|
84
|
+
}
|
|
85
|
+
if (expression.includes("electronStore?.get")) {
|
|
86
|
+
return Promise.resolve(false);
|
|
87
|
+
}
|
|
88
|
+
return Promise.resolve(undefined);
|
|
89
|
+
});
|
|
90
|
+
await expect(service.connect()).rejects.toThrow(WrongPortError);
|
|
91
|
+
expect(mockDisconnect).toHaveBeenCalled();
|
|
92
|
+
});
|
|
76
93
|
});
|
|
77
94
|
describe("connect with context fallback", () => {
|
|
78
95
|
it("falls back to preload context when default lacks require", async () => {
|
|
@@ -84,6 +101,9 @@ describe("LauncherService", () => {
|
|
|
84
101
|
// Second probe (preload context id=2): has require
|
|
85
102
|
return Promise.resolve(probeCount >= 2 && contextId === 2);
|
|
86
103
|
}
|
|
104
|
+
if (expression.includes("electronStore?.get")) {
|
|
105
|
+
return Promise.resolve(true);
|
|
106
|
+
}
|
|
87
107
|
return Promise.resolve(undefined);
|
|
88
108
|
});
|
|
89
109
|
mockOn.mockImplementation((event, handler) => {
|
|
@@ -98,7 +118,7 @@ describe("LauncherService", () => {
|
|
|
98
118
|
expect(mockSend).toHaveBeenCalledWith("Runtime.enable");
|
|
99
119
|
expect(mockSend).toHaveBeenCalledWith("Runtime.disable");
|
|
100
120
|
});
|
|
101
|
-
it("throws
|
|
121
|
+
it("throws WrongPortError when no context has require (instance port)", async () => {
|
|
102
122
|
mockEvaluate.mockImplementation((expression) => {
|
|
103
123
|
if (expression === "typeof require === 'function'") {
|
|
104
124
|
return Promise.resolve(false);
|
|
@@ -112,7 +132,8 @@ describe("LauncherService", () => {
|
|
|
112
132
|
}
|
|
113
133
|
});
|
|
114
134
|
mockSend.mockResolvedValue(undefined);
|
|
115
|
-
await expect(service.connect()).rejects.toThrow(
|
|
135
|
+
await expect(service.connect()).rejects.toThrow(WrongPortError);
|
|
136
|
+
expect(mockDisconnect).toHaveBeenCalled();
|
|
116
137
|
});
|
|
117
138
|
it("uses preload context for subsequent evaluations", async () => {
|
|
118
139
|
const PRELOAD_CONTEXT_ID = 42;
|
|
@@ -122,6 +143,9 @@ describe("LauncherService", () => {
|
|
|
122
143
|
probeCount++;
|
|
123
144
|
return Promise.resolve(probeCount >= 2 && contextId === PRELOAD_CONTEXT_ID);
|
|
124
145
|
}
|
|
146
|
+
if (expression.includes("electronStore?.get")) {
|
|
147
|
+
return Promise.resolve(true);
|
|
148
|
+
}
|
|
125
149
|
return Promise.resolve(nextEvaluateResult);
|
|
126
150
|
});
|
|
127
151
|
mockOn.mockImplementation((event, handler) => {
|
|
@@ -223,11 +247,114 @@ describe("LauncherService", () => {
|
|
|
223
247
|
});
|
|
224
248
|
await expect(service.listAccounts()).rejects.toThrow(CDPEvaluationError);
|
|
225
249
|
});
|
|
226
|
-
it("throws WrongPortError when
|
|
250
|
+
it("throws WrongPortError when webpack is not available", async () => {
|
|
227
251
|
await service.connect();
|
|
228
252
|
nextEvaluateResult = null;
|
|
229
253
|
await expect(service.listAccounts()).rejects.toThrow(WrongPortError);
|
|
230
254
|
});
|
|
255
|
+
it("passes awaitPromise=true for the async expression", async () => {
|
|
256
|
+
await service.connect();
|
|
257
|
+
nextEvaluateResult = [];
|
|
258
|
+
await service.listAccounts();
|
|
259
|
+
const listCall = mockEvaluate.mock.calls.find((c) => typeof c[0] === "string" && c[0].includes("extendedLinkedInAccountsBS"));
|
|
260
|
+
expect(listCall).toBeDefined();
|
|
261
|
+
expect(listCall?.[1]).toBe(true);
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
describe("dismissInstanceDialog", () => {
|
|
265
|
+
it("evaluates the closeInstanceDialog expression", async () => {
|
|
266
|
+
await service.connect();
|
|
267
|
+
await service.dismissInstanceDialog(42, "dlg-1", "btn-ok");
|
|
268
|
+
expect(mockEvaluate).toHaveBeenCalledWith(expect.stringContaining("closeInstanceDialog"), true, undefined);
|
|
269
|
+
expect(mockEvaluate).toHaveBeenCalledWith(expect.stringContaining("42"), true, undefined);
|
|
270
|
+
expect(mockEvaluate).toHaveBeenCalledWith(expect.stringContaining('"dlg-1"'), true, undefined);
|
|
271
|
+
expect(mockEvaluate).toHaveBeenCalledWith(expect.stringContaining('"btn-ok"'), true, undefined);
|
|
272
|
+
});
|
|
273
|
+
it("throws ServiceError when not connected", async () => {
|
|
274
|
+
await expect(service.dismissInstanceDialog(42, "dlg-1", "btn-ok")).rejects.toThrow(ServiceError);
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
describe("stopInstanceWithDialogDismissal", () => {
|
|
278
|
+
it("calls stopInstance then polls and dismisses a dialog", async () => {
|
|
279
|
+
await service.connect();
|
|
280
|
+
let pollCount = 0;
|
|
281
|
+
mockEvaluate.mockImplementation((expression) => {
|
|
282
|
+
if (expression === "typeof require === 'function'") {
|
|
283
|
+
return Promise.resolve(true);
|
|
284
|
+
}
|
|
285
|
+
if (expression.includes("electronStore?.get")) {
|
|
286
|
+
return Promise.resolve(true);
|
|
287
|
+
}
|
|
288
|
+
// stopInstance call
|
|
289
|
+
if (expression.includes("stopInstance")) {
|
|
290
|
+
return Promise.resolve(undefined);
|
|
291
|
+
}
|
|
292
|
+
// getInstanceIssues — return a dialog on the second poll
|
|
293
|
+
if (expression.includes("issues?.items")) {
|
|
294
|
+
pollCount++;
|
|
295
|
+
if (pollCount >= 2) {
|
|
296
|
+
return Promise.resolve([
|
|
297
|
+
{
|
|
298
|
+
type: "dialog",
|
|
299
|
+
id: "dlg-close",
|
|
300
|
+
data: {
|
|
301
|
+
id: "dlg-close",
|
|
302
|
+
options: {
|
|
303
|
+
message: "Are you sure?",
|
|
304
|
+
controls: [{ id: "btn-yes", text: "Yes" }],
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
},
|
|
308
|
+
]);
|
|
309
|
+
}
|
|
310
|
+
return Promise.resolve([]);
|
|
311
|
+
}
|
|
312
|
+
// dismissInstanceDialog call
|
|
313
|
+
if (expression.includes("closeInstanceDialog")) {
|
|
314
|
+
return Promise.resolve(undefined);
|
|
315
|
+
}
|
|
316
|
+
return Promise.resolve(undefined);
|
|
317
|
+
});
|
|
318
|
+
await service.stopInstanceWithDialogDismissal(42);
|
|
319
|
+
// Verify stopInstance was called
|
|
320
|
+
expect(mockEvaluate).toHaveBeenCalledWith(expect.stringContaining("stopInstance"), true, undefined);
|
|
321
|
+
// Verify dismissInstanceDialog was called with the dialog's first button
|
|
322
|
+
expect(mockEvaluate).toHaveBeenCalledWith(expect.stringContaining("closeInstanceDialog"), true, undefined);
|
|
323
|
+
expect(mockEvaluate).toHaveBeenCalledWith(expect.stringContaining('"dlg-close"'), true, undefined);
|
|
324
|
+
expect(mockEvaluate).toHaveBeenCalledWith(expect.stringContaining('"btn-yes"'), true, undefined);
|
|
325
|
+
});
|
|
326
|
+
it("returns normally when no dialog appears within timeout", async () => {
|
|
327
|
+
await service.connect();
|
|
328
|
+
mockEvaluate.mockImplementation((expression) => {
|
|
329
|
+
if (expression === "typeof require === 'function'") {
|
|
330
|
+
return Promise.resolve(true);
|
|
331
|
+
}
|
|
332
|
+
if (expression.includes("electronStore?.get")) {
|
|
333
|
+
return Promise.resolve(true);
|
|
334
|
+
}
|
|
335
|
+
if (expression.includes("stopInstance")) {
|
|
336
|
+
return Promise.resolve(undefined);
|
|
337
|
+
}
|
|
338
|
+
// Always return empty issues
|
|
339
|
+
if (expression.includes("issues?.items")) {
|
|
340
|
+
return Promise.resolve([]);
|
|
341
|
+
}
|
|
342
|
+
return Promise.resolve(undefined);
|
|
343
|
+
});
|
|
344
|
+
// Use fake timers to avoid waiting 10s
|
|
345
|
+
vi.useFakeTimers();
|
|
346
|
+
const promise = service.stopInstanceWithDialogDismissal(42);
|
|
347
|
+
// Advance past the polling timeout
|
|
348
|
+
await vi.advanceTimersByTimeAsync(11_000);
|
|
349
|
+
await promise;
|
|
350
|
+
vi.useRealTimers();
|
|
351
|
+
// Verify stopInstance was called but dismissInstanceDialog was not
|
|
352
|
+
expect(mockEvaluate).toHaveBeenCalledWith(expect.stringContaining("stopInstance"), true, undefined);
|
|
353
|
+
expect(mockEvaluate).not.toHaveBeenCalledWith(expect.stringContaining("closeInstanceDialog"), expect.anything(), expect.anything());
|
|
354
|
+
});
|
|
355
|
+
it("throws ServiceError when not connected", async () => {
|
|
356
|
+
await expect(service.stopInstanceWithDialogDismissal(42)).rejects.toThrow(ServiceError);
|
|
357
|
+
});
|
|
231
358
|
});
|
|
232
359
|
});
|
|
233
360
|
//# sourceMappingURL=launcher.test.js.map
|