@lhremote/core 0.7.0 → 0.9.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/index.d.ts +1 -1
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +1 -1
- package/dist/db/index.js.map +1 -1
- package/dist/db/repositories/action-budget.d.ts +29 -0
- package/dist/db/repositories/action-budget.d.ts.map +1 -0
- package/dist/db/repositories/action-budget.js +100 -0
- package/dist/db/repositories/action-budget.js.map +1 -0
- package/dist/db/repositories/action-budget.test.d.ts +2 -0
- package/dist/db/repositories/action-budget.test.d.ts.map +1 -0
- package/dist/db/repositories/action-budget.test.js +181 -0
- package/dist/db/repositories/action-budget.test.js.map +1 -0
- package/dist/db/repositories/campaign-hard-delete.integration.test.d.ts +2 -0
- package/dist/db/repositories/campaign-hard-delete.integration.test.d.ts.map +1 -0
- package/dist/db/repositories/campaign-hard-delete.integration.test.js +78 -0
- package/dist/db/repositories/campaign-hard-delete.integration.test.js.map +1 -0
- package/dist/db/repositories/campaign.d.ts +14 -0
- package/dist/db/repositories/campaign.d.ts.map +1 -1
- package/dist/db/repositories/campaign.js +125 -0
- package/dist/db/repositories/campaign.js.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/index.d.ts +1 -0
- package/dist/db/repositories/index.d.ts.map +1 -1
- package/dist/db/repositories/index.js +1 -0
- package/dist/db/repositories/index.js.map +1 -1
- package/dist/index.d.ts +7 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -7
- package/dist/index.js.map +1 -1
- package/dist/linkedin/__tests__/dom-automation.integration.test.d.ts +2 -0
- package/dist/linkedin/__tests__/dom-automation.integration.test.d.ts.map +1 -0
- package/dist/linkedin/__tests__/dom-automation.integration.test.js +160 -0
- package/dist/linkedin/__tests__/dom-automation.integration.test.js.map +1 -0
- 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 +224 -0
- package/dist/linkedin/dom-automation.d.ts.map +1 -0
- package/dist/linkedin/dom-automation.js +614 -0
- package/dist/linkedin/dom-automation.js.map +1 -0
- 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 +4 -0
- package/dist/linkedin/index.d.ts.map +1 -0
- package/dist/linkedin/index.js +6 -0
- package/dist/linkedin/index.js.map +1 -0
- package/dist/linkedin/selectors.d.ts +67 -0
- package/dist/linkedin/selectors.d.ts.map +1 -0
- package/dist/linkedin/selectors.js +74 -0
- package/dist/linkedin/selectors.js.map +1 -0
- 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 +7 -3
- package/dist/operations/campaign-delete.d.ts.map +1 -1
- package/dist/operations/campaign-delete.js +12 -8
- package/dist/operations/campaign-delete.js.map +1 -1
- package/dist/operations/campaign-delete.test.js +41 -1
- package/dist/operations/campaign-delete.test.js.map +1 -1
- package/dist/operations/campaign-erase.d.ts +19 -0
- package/dist/operations/campaign-erase.d.ts.map +1 -0
- package/dist/operations/campaign-erase.js +19 -0
- package/dist/operations/campaign-erase.js.map +1 -0
- package/dist/operations/campaign-erase.test.d.ts +2 -0
- package/dist/operations/campaign-erase.test.d.ts.map +1 -0
- package/dist/operations/campaign-erase.test.js +101 -0
- package/dist/operations/campaign-erase.test.js.map +1 -0
- 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 +132 -17
- package/dist/operations/check-replies.js.map +1 -1
- package/dist/operations/check-replies.test.js +177 -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 +3 -6
- package/dist/operations/collect-people.js.map +1 -1
- package/dist/operations/comment-on-post.d.ts +37 -0
- package/dist/operations/comment-on-post.d.ts.map +1 -0
- package/dist/operations/comment-on-post.js +104 -0
- package/dist/operations/comment-on-post.js.map +1 -0
- package/dist/operations/comment-on-post.test.d.ts +2 -0
- package/dist/operations/comment-on-post.test.d.ts.map +1 -0
- package/dist/operations/comment-on-post.test.js +242 -0
- package/dist/operations/comment-on-post.test.js.map +1 -0
- 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 +3 -6
- package/dist/operations/create-collection.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 +25 -0
- package/dist/operations/dismiss-errors.d.ts.map +1 -0
- package/dist/operations/dismiss-errors.js +74 -0
- package/dist/operations/dismiss-errors.js.map +1 -0
- package/dist/operations/dismiss-errors.test.d.ts +2 -0
- package/dist/operations/dismiss-errors.test.d.ts.map +1 -0
- package/dist/operations/dismiss-errors.test.js +183 -0
- package/dist/operations/dismiss-errors.test.js.map +1 -0
- package/dist/operations/endorse-skills.d.ts +10 -0
- package/dist/operations/endorse-skills.d.ts.map +1 -0
- package/dist/operations/endorse-skills.js +12 -0
- package/dist/operations/endorse-skills.js.map +1 -0
- 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.d.ts +18 -0
- package/dist/operations/enrich-profile.d.ts.map +1 -0
- package/dist/operations/enrich-profile.js +15 -0
- package/dist/operations/enrich-profile.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 +22 -0
- package/dist/operations/ephemeral-action.d.ts.map +1 -0
- package/dist/operations/ephemeral-action.js +28 -0
- package/dist/operations/ephemeral-action.js.map +1 -0
- 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 +140 -0
- package/dist/operations/ephemeral-action.test.js.map +1 -0
- package/dist/operations/follow-person.d.ts +9 -0
- package/dist/operations/follow-person.d.ts.map +1 -0
- package/dist/operations/follow-person.js +11 -0
- package/dist/operations/follow-person.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 +6 -0
- package/dist/operations/get-action-budget.d.ts.map +1 -0
- package/dist/operations/get-action-budget.js +19 -0
- package/dist/operations/get-action-budget.js.map +1 -0
- package/dist/operations/get-action-budget.test.d.ts +2 -0
- package/dist/operations/get-action-budget.test.d.ts.map +1 -0
- package/dist/operations/get-action-budget.test.js +79 -0
- package/dist/operations/get-action-budget.test.js.map +1 -0
- package/dist/operations/get-errors.d.ts +14 -4
- package/dist/operations/get-errors.d.ts.map +1 -1
- package/dist/operations/get-errors.js +72 -13
- package/dist/operations/get-errors.js.map +1 -1
- package/dist/operations/get-errors.test.js +108 -43
- package/dist/operations/get-errors.test.js.map +1 -1
- package/dist/operations/get-feed.d.ts +112 -0
- package/dist/operations/get-feed.d.ts.map +1 -0
- package/dist/operations/get-feed.js +467 -0
- package/dist/operations/get-feed.js.map +1 -0
- package/dist/operations/get-feed.test.d.ts +2 -0
- package/dist/operations/get-feed.test.d.ts.map +1 -0
- package/dist/operations/get-feed.test.js +502 -0
- package/dist/operations/get-feed.test.js.map +1 -0
- package/dist/operations/get-post-engagers.d.ts +43 -0
- package/dist/operations/get-post-engagers.d.ts.map +1 -0
- package/dist/operations/get-post-engagers.js +328 -0
- package/dist/operations/get-post-engagers.js.map +1 -0
- package/dist/operations/get-post-engagers.test.d.ts +2 -0
- package/dist/operations/get-post-engagers.test.d.ts.map +1 -0
- package/dist/operations/get-post-engagers.test.js +297 -0
- package/dist/operations/get-post-engagers.test.js.map +1 -0
- package/dist/operations/get-post-stats.d.ts +43 -0
- package/dist/operations/get-post-stats.d.ts.map +1 -0
- package/dist/operations/get-post-stats.js +164 -0
- package/dist/operations/get-post-stats.js.map +1 -0
- package/dist/operations/get-post-stats.test.d.ts +2 -0
- package/dist/operations/get-post-stats.test.d.ts.map +1 -0
- package/dist/operations/get-post-stats.test.js +169 -0
- package/dist/operations/get-post-stats.test.js.map +1 -0
- package/dist/operations/get-post.d.ts +42 -0
- package/dist/operations/get-post.d.ts.map +1 -0
- package/dist/operations/get-post.js +416 -0
- package/dist/operations/get-post.js.map +1 -0
- package/dist/operations/get-post.test.d.ts +2 -0
- package/dist/operations/get-post.test.d.ts.map +1 -0
- package/dist/operations/get-post.test.js +272 -0
- package/dist/operations/get-post.test.js.map +1 -0
- package/dist/operations/get-profile-activity.d.ts +50 -0
- package/dist/operations/get-profile-activity.d.ts.map +1 -0
- package/dist/operations/get-profile-activity.js +381 -0
- package/dist/operations/get-profile-activity.js.map +1 -0
- package/dist/operations/get-profile-activity.test.d.ts +2 -0
- package/dist/operations/get-profile-activity.test.d.ts.map +1 -0
- package/dist/operations/get-profile-activity.test.js +324 -0
- package/dist/operations/get-profile-activity.test.js.map +1 -0
- package/dist/operations/get-throttle-status.d.ts +6 -0
- package/dist/operations/get-throttle-status.d.ts.map +1 -0
- package/dist/operations/get-throttle-status.js +24 -0
- package/dist/operations/get-throttle-status.js.map +1 -0
- package/dist/operations/get-throttle-status.test.d.ts +2 -0
- package/dist/operations/get-throttle-status.test.d.ts.map +1 -0
- package/dist/operations/get-throttle-status.test.js +62 -0
- package/dist/operations/get-throttle-status.test.js.map +1 -0
- 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 +23 -1
- package/dist/operations/index.d.ts.map +1 -1
- package/dist/operations/index.js +33 -0
- package/dist/operations/index.js.map +1 -1
- package/dist/operations/like-person-posts.d.ts +14 -0
- package/dist/operations/like-person-posts.d.ts.map +1 -0
- package/dist/operations/like-person-posts.js +28 -0
- package/dist/operations/like-person-posts.js.map +1 -0
- 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.d.ts +11 -0
- package/dist/operations/message-person.d.ts.map +1 -0
- package/dist/operations/message-person.js +19 -0
- package/dist/operations/message-person.js.map +1 -0
- 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 +41 -0
- package/dist/operations/react-to-post.d.ts.map +1 -0
- package/dist/operations/react-to-post.js +80 -0
- package/dist/operations/react-to-post.js.map +1 -0
- package/dist/operations/react-to-post.test.d.ts +2 -0
- package/dist/operations/react-to-post.test.d.ts.map +1 -0
- package/dist/operations/react-to-post.test.js +157 -0
- package/dist/operations/react-to-post.test.js.map +1 -0
- package/dist/operations/remove-connection.d.ts +6 -0
- package/dist/operations/remove-connection.d.ts.map +1 -0
- package/dist/operations/remove-connection.js +7 -0
- package/dist/operations/remove-connection.js.map +1 -0
- 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 +121 -18
- package/dist/operations/scrape-messaging-history.js.map +1 -1
- package/dist/operations/scrape-messaging-history.test.js +134 -12
- package/dist/operations/scrape-messaging-history.test.js.map +1 -1
- package/dist/operations/search-posts.d.ts +51 -0
- package/dist/operations/search-posts.d.ts.map +1 -0
- package/dist/operations/search-posts.js +419 -0
- package/dist/operations/search-posts.js.map +1 -0
- package/dist/operations/search-posts.test.d.ts +2 -0
- package/dist/operations/search-posts.test.d.ts.map +1 -0
- package/dist/operations/search-posts.test.js +300 -0
- package/dist/operations/search-posts.test.js.map +1 -0
- package/dist/operations/send-inmail.d.ts +11 -0
- package/dist/operations/send-inmail.d.ts.map +1 -0
- package/dist/operations/send-inmail.js +19 -0
- package/dist/operations/send-inmail.js.map +1 -0
- 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.d.ts +9 -0
- package/dist/operations/send-invite.d.ts.map +1 -0
- package/dist/operations/send-invite.js +14 -0
- package/dist/operations/send-invite.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 +24 -1
- package/dist/operations/types.d.ts.map +1 -1
- package/dist/operations/types.js +13 -1
- package/dist/operations/types.js.map +1 -1
- package/dist/operations/visit-profile.d.ts +14 -0
- package/dist/operations/visit-profile.d.ts.map +1 -0
- package/dist/operations/visit-profile.js +46 -0
- package/dist/operations/visit-profile.js.map +1 -0
- package/dist/operations/visit-profile.test.d.ts +2 -0
- package/dist/operations/visit-profile.test.d.ts.map +1 -0
- package/dist/operations/visit-profile.test.js +193 -0
- package/dist/operations/visit-profile.test.js.map +1 -0
- package/dist/services/account-resolution.d.ts +9 -4
- package/dist/services/account-resolution.d.ts.map +1 -1
- package/dist/services/account-resolution.js +60 -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 +44 -2
- package/dist/services/campaign.d.ts.map +1 -1
- package/dist/services/campaign.js +124 -1
- package/dist/services/campaign.js.map +1 -1
- package/dist/services/collection.d.ts +5 -2
- package/dist/services/collection.d.ts.map +1 -1
- package/dist/services/collection.js +24 -5
- package/dist/services/collection.js.map +1 -1
- package/dist/services/collection.test.js +51 -9
- package/dist/services/collection.test.js.map +1 -1
- package/dist/services/ephemeral-campaign.d.ts +64 -0
- package/dist/services/ephemeral-campaign.d.ts.map +1 -0
- package/dist/services/ephemeral-campaign.js +210 -0
- package/dist/services/ephemeral-campaign.js.map +1 -0
- package/dist/services/ephemeral-campaign.test.d.ts +2 -0
- package/dist/services/ephemeral-campaign.test.d.ts.map +1 -0
- package/dist/services/ephemeral-campaign.test.js +333 -0
- package/dist/services/ephemeral-campaign.test.js.map +1 -0
- package/dist/services/errors.d.ts +12 -1
- package/dist/services/errors.d.ts.map +1 -1
- package/dist/services/errors.js +26 -3
- package/dist/services/errors.js.map +1 -1
- package/dist/services/index.d.ts +2 -1
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +2 -1
- 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 -20
- package/dist/services/instance-context.js.map +1 -1
- package/dist/services/instance-context.test.js +82 -2
- 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 +43 -0
- package/dist/services/instance.d.ts.map +1 -1
- package/dist/services/instance.js +163 -1
- package/dist/services/instance.js.map +1 -1
- package/dist/services/instance.test.js +135 -0
- package/dist/services/instance.test.js.map +1 -1
- package/dist/services/launcher.d.ts +54 -3
- package/dist/services/launcher.d.ts.map +1 -1
- package/dist/services/launcher.js +223 -34
- 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/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 +23 -1
- package/dist/testing/e2e-helpers.d.ts.map +1 -1
- package/dist/testing/e2e-helpers.js +110 -5
- 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/action-budget.d.ts +52 -0
- package/dist/types/action-budget.d.ts.map +1 -0
- package/dist/types/action-budget.js +4 -0
- package/dist/types/action-budget.js.map +1 -0
- package/dist/types/campaign.d.ts +24 -0
- package/dist/types/campaign.d.ts.map +1 -1
- package/dist/types/feed.d.ts +30 -0
- package/dist/types/feed.d.ts.map +1 -0
- package/dist/types/feed.js +4 -0
- package/dist/types/feed.js.map +1 -0
- package/dist/types/index.d.ts +6 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/post-analytics.d.ts +40 -0
- package/dist/types/post-analytics.d.ts.map +1 -0
- package/dist/types/post-analytics.js +4 -0
- package/dist/types/post-analytics.js.map +1 -0
- package/dist/types/post.d.ts +43 -0
- package/dist/types/post.d.ts.map +1 -0
- package/dist/types/post.js +4 -0
- package/dist/types/post.js.map +1 -0
- package/dist/types/ui-health.d.ts +16 -0
- package/dist/types/ui-health.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
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
// Copyright (C) 2026 Oleksii PELYKH
|
|
3
|
+
import { resolveInstancePort } from "../cdp/index.js";
|
|
4
|
+
import { CDPClient } from "../cdp/client.js";
|
|
5
|
+
import { discoverTargets } from "../cdp/discovery.js";
|
|
6
|
+
import { ActionBudgetRepository } from "../db/index.js";
|
|
7
|
+
import { waitForElement, humanizedScrollTo, humanizedClick, typeText } from "../linkedin/dom-automation.js";
|
|
8
|
+
import { COMMENT_INPUT, COMMENT_SUBMIT_BUTTON } from "../linkedin/selectors.js";
|
|
9
|
+
import { resolveAccount } from "../services/account-resolution.js";
|
|
10
|
+
import { BudgetExceededError } from "../services/errors.js";
|
|
11
|
+
import { withDatabase } from "../services/instance-context.js";
|
|
12
|
+
import { gaussianDelay } from "../utils/delay.js";
|
|
13
|
+
import { buildCdpOptions } from "./types.js";
|
|
14
|
+
/** Pattern matching supported LinkedIn post URL formats. */
|
|
15
|
+
const LINKEDIN_POST_URL_RE = /linkedin\.com\/(?:feed\/update\/urn:li:\w+:\d+|posts\/[^/]+)/;
|
|
16
|
+
/** Limit type ID for PostComment in the LinkedHelper budget system. */
|
|
17
|
+
const POST_COMMENT_LIMIT_TYPE_ID = 19;
|
|
18
|
+
/**
|
|
19
|
+
* Post a comment on a LinkedIn post.
|
|
20
|
+
*
|
|
21
|
+
* Navigates the LinkedIn webview to the post URL, finds the comment
|
|
22
|
+
* input via selectors, types the comment text character-by-character
|
|
23
|
+
* for human-like behaviour, and clicks submit.
|
|
24
|
+
*
|
|
25
|
+
* Checks the action budget before attempting the comment and fails
|
|
26
|
+
* with a {@link BudgetExceededError} if the PostComment limit has
|
|
27
|
+
* been reached.
|
|
28
|
+
*
|
|
29
|
+
* @param input - Post URL, comment text, and CDP connection parameters.
|
|
30
|
+
* @returns Success status with the posted comment data.
|
|
31
|
+
*/
|
|
32
|
+
export async function commentOnPost(input) {
|
|
33
|
+
const cdpPort = await resolveInstancePort(input.cdpPort, input.cdpHost);
|
|
34
|
+
const cdpHost = input.cdpHost ?? "127.0.0.1";
|
|
35
|
+
const allowRemote = input.allowRemote ?? false;
|
|
36
|
+
if (!input.text.trim()) {
|
|
37
|
+
throw new Error("Comment text cannot be empty");
|
|
38
|
+
}
|
|
39
|
+
// Validate post URL format
|
|
40
|
+
if (!LINKEDIN_POST_URL_RE.test(input.postUrl)) {
|
|
41
|
+
throw new Error(`Invalid LinkedIn post URL: ${input.postUrl}. ` +
|
|
42
|
+
"Expected a URL like https://www.linkedin.com/feed/update/urn:li:activity:... " +
|
|
43
|
+
"or https://www.linkedin.com/posts/...");
|
|
44
|
+
}
|
|
45
|
+
// Enforce loopback guard
|
|
46
|
+
if (!allowRemote && cdpHost !== "127.0.0.1" && cdpHost !== "localhost") {
|
|
47
|
+
throw new Error(`Non-loopback CDP host "${cdpHost}" requires --allow-remote. ` +
|
|
48
|
+
"This is a security measure to prevent remote code execution.");
|
|
49
|
+
}
|
|
50
|
+
// Check action budget before attempting the comment
|
|
51
|
+
const accountId = await resolveAccount(cdpPort, buildCdpOptions(input));
|
|
52
|
+
await withDatabase(accountId, ({ db }) => {
|
|
53
|
+
const repo = new ActionBudgetRepository(db);
|
|
54
|
+
const entries = repo.getActionBudget();
|
|
55
|
+
const entry = entries.find((e) => e.limitTypeId === POST_COMMENT_LIMIT_TYPE_ID);
|
|
56
|
+
if (entry && entry.remaining !== null && entry.remaining <= 0) {
|
|
57
|
+
throw new BudgetExceededError(entry.limitType, entry.dailyLimit ?? 0, entry.totalUsed);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
// Connect to the LinkedIn webview
|
|
61
|
+
const targets = await discoverTargets(cdpPort, cdpHost);
|
|
62
|
+
const linkedInTarget = targets.find((t) => t.type === "page" && t.url?.includes("linkedin.com"));
|
|
63
|
+
if (!linkedInTarget) {
|
|
64
|
+
throw new Error("No LinkedIn page found in LinkedHelper. " +
|
|
65
|
+
"Ensure LinkedHelper is running with an active LinkedIn session.");
|
|
66
|
+
}
|
|
67
|
+
const client = new CDPClient(cdpPort, { host: cdpHost, allowRemote });
|
|
68
|
+
await client.connect(linkedInTarget.id);
|
|
69
|
+
try {
|
|
70
|
+
// Navigate to the post URL
|
|
71
|
+
await client.send("Page.enable");
|
|
72
|
+
try {
|
|
73
|
+
const loadPromise = client.waitForEvent("Page.loadEventFired");
|
|
74
|
+
await client.navigate(input.postUrl);
|
|
75
|
+
await loadPromise;
|
|
76
|
+
}
|
|
77
|
+
finally {
|
|
78
|
+
await client.send("Page.disable").catch(() => { });
|
|
79
|
+
}
|
|
80
|
+
const mouse = input.mouse;
|
|
81
|
+
// Wait for the comment input and interact
|
|
82
|
+
await waitForElement(client, COMMENT_INPUT, undefined, mouse);
|
|
83
|
+
await humanizedScrollTo(client, COMMENT_INPUT, mouse);
|
|
84
|
+
await humanizedClick(client, COMMENT_INPUT, mouse);
|
|
85
|
+
await gaussianDelay(550, 75, 400, 700);
|
|
86
|
+
// Type comment text character-by-character
|
|
87
|
+
await typeText(client, COMMENT_INPUT, input.text);
|
|
88
|
+
// Wait for submit button and click
|
|
89
|
+
await waitForElement(client, COMMENT_SUBMIT_BUTTON, undefined, mouse);
|
|
90
|
+
await humanizedClick(client, COMMENT_SUBMIT_BUTTON, mouse);
|
|
91
|
+
// Brief wait for the comment to post
|
|
92
|
+
await gaussianDelay(2_000, 250, 1_500, 2_500);
|
|
93
|
+
await gaussianDelay(1_500, 500, 700, 3_500); // Post-action dwell
|
|
94
|
+
return {
|
|
95
|
+
success: true,
|
|
96
|
+
postUrl: input.postUrl,
|
|
97
|
+
commentText: input.text,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
finally {
|
|
101
|
+
client.disconnect();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=comment-on-post.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comment-on-post.js","sourceRoot":"","sources":["../../src/operations/comment-on-post.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAEpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAE5G,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,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ment-on-post.test.d.ts","sourceRoot":"","sources":["../../src/operations/comment-on-post.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
// Copyright (C) 2026 Oleksii PELYKH
|
|
3
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
4
|
+
vi.mock("../services/account-resolution.js", () => ({
|
|
5
|
+
resolveAccount: vi.fn(),
|
|
6
|
+
}));
|
|
7
|
+
vi.mock("../services/instance-context.js", () => ({
|
|
8
|
+
withDatabase: vi.fn(),
|
|
9
|
+
}));
|
|
10
|
+
vi.mock("../db/index.js", () => ({
|
|
11
|
+
ActionBudgetRepository: vi.fn(),
|
|
12
|
+
}));
|
|
13
|
+
vi.mock("../cdp/discovery.js", () => ({
|
|
14
|
+
discoverTargets: vi.fn(),
|
|
15
|
+
}));
|
|
16
|
+
vi.mock("../cdp/client.js", () => ({
|
|
17
|
+
CDPClient: vi.fn(),
|
|
18
|
+
}));
|
|
19
|
+
vi.mock("../linkedin/dom-automation.js", () => ({
|
|
20
|
+
waitForElement: vi.fn(),
|
|
21
|
+
humanizedScrollTo: vi.fn(),
|
|
22
|
+
click: vi.fn(),
|
|
23
|
+
humanizedClick: vi.fn(),
|
|
24
|
+
typeText: vi.fn(),
|
|
25
|
+
}));
|
|
26
|
+
vi.mock("../utils/delay.js", () => ({
|
|
27
|
+
delay: vi.fn().mockResolvedValue(undefined),
|
|
28
|
+
gaussianDelay: vi.fn().mockResolvedValue(undefined),
|
|
29
|
+
}));
|
|
30
|
+
import { resolveAccount } from "../services/account-resolution.js";
|
|
31
|
+
import { withDatabase } from "../services/instance-context.js";
|
|
32
|
+
import { ActionBudgetRepository } from "../db/index.js";
|
|
33
|
+
import { discoverTargets } from "../cdp/discovery.js";
|
|
34
|
+
import { CDPClient } from "../cdp/client.js";
|
|
35
|
+
import { waitForElement, humanizedScrollTo, humanizedClick, typeText } from "../linkedin/dom-automation.js";
|
|
36
|
+
import { BudgetExceededError } from "../services/errors.js";
|
|
37
|
+
import { commentOnPost } from "./comment-on-post.js";
|
|
38
|
+
const MOCK_CDP_PORT = 9222;
|
|
39
|
+
const MOCK_POST_URL = "https://www.linkedin.com/feed/update/urn:li:activity:123/";
|
|
40
|
+
function createMockClient() {
|
|
41
|
+
return {
|
|
42
|
+
connect: vi.fn().mockResolvedValue(undefined),
|
|
43
|
+
disconnect: vi.fn(),
|
|
44
|
+
send: vi.fn().mockResolvedValue(undefined),
|
|
45
|
+
navigate: vi.fn().mockResolvedValue({ frameId: "F1" }),
|
|
46
|
+
waitForEvent: vi.fn().mockResolvedValue(undefined),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function setupMocks(budgetEntries = [
|
|
50
|
+
{
|
|
51
|
+
limitTypeId: 19,
|
|
52
|
+
limitType: "PostComment",
|
|
53
|
+
dailyLimit: 10,
|
|
54
|
+
campaignUsed: 2,
|
|
55
|
+
directUsed: 0,
|
|
56
|
+
totalUsed: 2,
|
|
57
|
+
remaining: 8,
|
|
58
|
+
},
|
|
59
|
+
]) {
|
|
60
|
+
vi.mocked(resolveAccount).mockResolvedValue(1);
|
|
61
|
+
vi.mocked(withDatabase).mockImplementation(async (_accountId, callback) => callback({ db: {} }));
|
|
62
|
+
vi.mocked(ActionBudgetRepository).mockImplementation(function () {
|
|
63
|
+
return {
|
|
64
|
+
getActionBudget: vi.fn().mockReturnValue(budgetEntries),
|
|
65
|
+
getLimitTypes: vi.fn().mockReturnValue([]),
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
vi.mocked(discoverTargets).mockResolvedValue([
|
|
69
|
+
{ id: "T1", type: "page", title: "LinkedIn", url: "https://www.linkedin.com/feed/", description: "", devtoolsFrontendUrl: "" },
|
|
70
|
+
]);
|
|
71
|
+
const mockClient = createMockClient();
|
|
72
|
+
vi.mocked(CDPClient).mockImplementation(function () {
|
|
73
|
+
return mockClient;
|
|
74
|
+
});
|
|
75
|
+
// Reset DOM automation mocks to default resolved state
|
|
76
|
+
vi.mocked(waitForElement).mockResolvedValue(undefined);
|
|
77
|
+
vi.mocked(humanizedScrollTo).mockResolvedValue(undefined);
|
|
78
|
+
vi.mocked(humanizedClick).mockResolvedValue(undefined);
|
|
79
|
+
vi.mocked(typeText).mockResolvedValue(undefined);
|
|
80
|
+
return mockClient;
|
|
81
|
+
}
|
|
82
|
+
describe("commentOnPost", () => {
|
|
83
|
+
beforeEach(() => {
|
|
84
|
+
vi.clearAllMocks();
|
|
85
|
+
});
|
|
86
|
+
afterEach(() => {
|
|
87
|
+
vi.restoreAllMocks();
|
|
88
|
+
});
|
|
89
|
+
it("rejects empty comment text", async () => {
|
|
90
|
+
await expect(commentOnPost({ postUrl: MOCK_POST_URL, text: "", cdpPort: MOCK_CDP_PORT })).rejects.toThrow("Comment text cannot be empty");
|
|
91
|
+
});
|
|
92
|
+
it("rejects whitespace-only comment text", async () => {
|
|
93
|
+
await expect(commentOnPost({ postUrl: MOCK_POST_URL, text: " ", cdpPort: MOCK_CDP_PORT })).rejects.toThrow("Comment text cannot be empty");
|
|
94
|
+
});
|
|
95
|
+
it("rejects invalid LinkedIn post URL", async () => {
|
|
96
|
+
await expect(commentOnPost({ postUrl: "https://example.com/foo", text: "hello", cdpPort: MOCK_CDP_PORT })).rejects.toThrow("Invalid LinkedIn post URL");
|
|
97
|
+
});
|
|
98
|
+
it("accepts /feed/update/ URL format", async () => {
|
|
99
|
+
setupMocks();
|
|
100
|
+
const result = await commentOnPost({
|
|
101
|
+
postUrl: "https://www.linkedin.com/feed/update/urn:li:activity:123456/",
|
|
102
|
+
text: "hello",
|
|
103
|
+
cdpPort: MOCK_CDP_PORT,
|
|
104
|
+
});
|
|
105
|
+
expect(result.success).toBe(true);
|
|
106
|
+
});
|
|
107
|
+
it("accepts /posts/ URL format", async () => {
|
|
108
|
+
setupMocks();
|
|
109
|
+
const result = await commentOnPost({
|
|
110
|
+
postUrl: "https://www.linkedin.com/posts/johndoe_activity-123456-abcd/",
|
|
111
|
+
text: "hello",
|
|
112
|
+
cdpPort: MOCK_CDP_PORT,
|
|
113
|
+
});
|
|
114
|
+
expect(result.success).toBe(true);
|
|
115
|
+
});
|
|
116
|
+
it("rejects non-loopback host without allowRemote", async () => {
|
|
117
|
+
await expect(commentOnPost({
|
|
118
|
+
postUrl: MOCK_POST_URL,
|
|
119
|
+
text: "hello",
|
|
120
|
+
cdpPort: MOCK_CDP_PORT,
|
|
121
|
+
cdpHost: "192.168.1.100",
|
|
122
|
+
})).rejects.toThrow("Non-loopback CDP host");
|
|
123
|
+
});
|
|
124
|
+
it("allows non-loopback host with allowRemote", async () => {
|
|
125
|
+
const mockClient = setupMocks();
|
|
126
|
+
const result = await commentOnPost({
|
|
127
|
+
postUrl: MOCK_POST_URL,
|
|
128
|
+
text: "hello",
|
|
129
|
+
cdpPort: MOCK_CDP_PORT,
|
|
130
|
+
cdpHost: "192.168.1.100",
|
|
131
|
+
allowRemote: true,
|
|
132
|
+
});
|
|
133
|
+
expect(result.success).toBe(true);
|
|
134
|
+
expect(mockClient.connect).toHaveBeenCalled();
|
|
135
|
+
});
|
|
136
|
+
it("throws BudgetExceededError when PostComment limit reached", async () => {
|
|
137
|
+
setupMocks([
|
|
138
|
+
{
|
|
139
|
+
limitTypeId: 19,
|
|
140
|
+
limitType: "PostComment",
|
|
141
|
+
dailyLimit: 10,
|
|
142
|
+
campaignUsed: 10,
|
|
143
|
+
directUsed: 0,
|
|
144
|
+
totalUsed: 10,
|
|
145
|
+
remaining: 0,
|
|
146
|
+
},
|
|
147
|
+
]);
|
|
148
|
+
await expect(commentOnPost({ postUrl: MOCK_POST_URL, text: "hello", cdpPort: MOCK_CDP_PORT })).rejects.toThrow(BudgetExceededError);
|
|
149
|
+
});
|
|
150
|
+
it("proceeds when PostComment has remaining budget", async () => {
|
|
151
|
+
setupMocks();
|
|
152
|
+
const result = await commentOnPost({
|
|
153
|
+
postUrl: MOCK_POST_URL,
|
|
154
|
+
text: "Great post!",
|
|
155
|
+
cdpPort: MOCK_CDP_PORT,
|
|
156
|
+
});
|
|
157
|
+
expect(result.success).toBe(true);
|
|
158
|
+
expect(result.postUrl).toBe(MOCK_POST_URL);
|
|
159
|
+
expect(result.commentText).toBe("Great post!");
|
|
160
|
+
});
|
|
161
|
+
it("proceeds when PostComment has no daily limit (unlimited)", async () => {
|
|
162
|
+
setupMocks([
|
|
163
|
+
{
|
|
164
|
+
limitTypeId: 19,
|
|
165
|
+
limitType: "PostComment",
|
|
166
|
+
dailyLimit: null,
|
|
167
|
+
campaignUsed: 0,
|
|
168
|
+
directUsed: 0,
|
|
169
|
+
totalUsed: 0,
|
|
170
|
+
remaining: null,
|
|
171
|
+
},
|
|
172
|
+
]);
|
|
173
|
+
const result = await commentOnPost({
|
|
174
|
+
postUrl: MOCK_POST_URL,
|
|
175
|
+
text: "hello",
|
|
176
|
+
cdpPort: MOCK_CDP_PORT,
|
|
177
|
+
});
|
|
178
|
+
expect(result.success).toBe(true);
|
|
179
|
+
});
|
|
180
|
+
it("proceeds when PostComment limit type is not in budget", async () => {
|
|
181
|
+
setupMocks([
|
|
182
|
+
{
|
|
183
|
+
limitTypeId: 8,
|
|
184
|
+
limitType: "Invite",
|
|
185
|
+
dailyLimit: 100,
|
|
186
|
+
campaignUsed: 5,
|
|
187
|
+
directUsed: 0,
|
|
188
|
+
totalUsed: 5,
|
|
189
|
+
remaining: 95,
|
|
190
|
+
},
|
|
191
|
+
]);
|
|
192
|
+
const result = await commentOnPost({
|
|
193
|
+
postUrl: MOCK_POST_URL,
|
|
194
|
+
text: "hello",
|
|
195
|
+
cdpPort: MOCK_CDP_PORT,
|
|
196
|
+
});
|
|
197
|
+
expect(result.success).toBe(true);
|
|
198
|
+
});
|
|
199
|
+
it("throws when no LinkedIn page is found", async () => {
|
|
200
|
+
setupMocks();
|
|
201
|
+
vi.mocked(discoverTargets).mockResolvedValue([]);
|
|
202
|
+
await expect(commentOnPost({ postUrl: MOCK_POST_URL, text: "hello", cdpPort: MOCK_CDP_PORT })).rejects.toThrow("No LinkedIn page found");
|
|
203
|
+
});
|
|
204
|
+
it("navigates to post URL and performs DOM automation", async () => {
|
|
205
|
+
const mockClient = setupMocks();
|
|
206
|
+
await commentOnPost({
|
|
207
|
+
postUrl: MOCK_POST_URL,
|
|
208
|
+
text: "Nice!",
|
|
209
|
+
cdpPort: MOCK_CDP_PORT,
|
|
210
|
+
});
|
|
211
|
+
// Verify navigation
|
|
212
|
+
expect(mockClient.send).toHaveBeenCalledWith("Page.enable");
|
|
213
|
+
expect(mockClient.navigate).toHaveBeenCalledWith(MOCK_POST_URL);
|
|
214
|
+
expect(mockClient.waitForEvent).toHaveBeenCalledWith("Page.loadEventFired");
|
|
215
|
+
// Verify DOM automation sequence
|
|
216
|
+
expect(waitForElement).toHaveBeenCalled();
|
|
217
|
+
expect(humanizedScrollTo).toHaveBeenCalled();
|
|
218
|
+
expect(humanizedClick).toHaveBeenCalledTimes(2); // comment input + submit
|
|
219
|
+
expect(typeText).toHaveBeenCalled();
|
|
220
|
+
});
|
|
221
|
+
it("disconnects CDP client even on error", async () => {
|
|
222
|
+
const mockClient = setupMocks();
|
|
223
|
+
vi.mocked(waitForElement).mockRejectedValue(new Error("timeout"));
|
|
224
|
+
await expect(commentOnPost({ postUrl: MOCK_POST_URL, text: "hello", cdpPort: MOCK_CDP_PORT })).rejects.toThrow("timeout");
|
|
225
|
+
expect(mockClient.disconnect).toHaveBeenCalled();
|
|
226
|
+
});
|
|
227
|
+
it("passes connection options to resolveAccount", async () => {
|
|
228
|
+
setupMocks();
|
|
229
|
+
await commentOnPost({
|
|
230
|
+
postUrl: MOCK_POST_URL,
|
|
231
|
+
text: "hello",
|
|
232
|
+
cdpPort: 1234,
|
|
233
|
+
cdpHost: "localhost",
|
|
234
|
+
allowRemote: true,
|
|
235
|
+
});
|
|
236
|
+
expect(resolveAccount).toHaveBeenCalledWith(1234, {
|
|
237
|
+
host: "localhost",
|
|
238
|
+
allowRemote: true,
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
//# sourceMappingURL=comment-on-post.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comment-on-post.test.js","sourceRoot":"","sources":["../../src/operations/comment-on-post.test.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAEpC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAEzE,EAAE,CAAC,IAAI,CAAC,mCAAmC,EAAE,GAAG,EAAE,CAAC,CAAC;IAClD,cAAc,EAAE,EAAE,CAAC,EAAE,EAAE;CACxB,CAAC,CAAC,CAAC;AAEJ,EAAE,CAAC,IAAI,CAAC,iCAAiC,EAAE,GAAG,EAAE,CAAC,CAAC;IAChD,YAAY,EAAE,EAAE,CAAC,EAAE,EAAE;CACtB,CAAC,CAAC,CAAC;AAEJ,EAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,EAAE,CAAC,CAAC;IAC/B,sBAAsB,EAAE,EAAE,CAAC,EAAE,EAAE;CAChC,CAAC,CAAC,CAAC;AAEJ,EAAE,CAAC,IAAI,CAAC,qBAAqB,EAAE,GAAG,EAAE,CAAC,CAAC;IACpC,eAAe,EAAE,EAAE,CAAC,EAAE,EAAE;CACzB,CAAC,CAAC,CAAC;AAEJ,EAAE,CAAC,IAAI,CAAC,kBAAkB,EAAE,GAAG,EAAE,CAAC,CAAC;IACjC,SAAS,EAAE,EAAE,CAAC,EAAE,EAAE;CACnB,CAAC,CAAC,CAAC;AAEJ,EAAE,CAAC,IAAI,CAAC,+BAA+B,EAAE,GAAG,EAAE,CAAC,CAAC;IAC9C,cAAc,EAAE,EAAE,CAAC,EAAE,EAAE;IACvB,iBAAiB,EAAE,EAAE,CAAC,EAAE,EAAE;IAC1B,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE;IACd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,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6CAA6C,EAAE,KAAK,IAAI,EAAE;QAC3D,UAAU,EAAE,CAAC;QAEb,MAAM,aAAa,CAAC;YAClB,OAAO,EAAE,aAAa;YACtB,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,WAAW;YACpB,WAAW,EAAE,IAAI;SAClB,CAAC,CAAC;QAEH,MAAM,CAAC,cAAc,CAAC,CAAC,oBAAoB,CAAC,IAAI,EAAE;YAChD,IAAI,EAAE,WAAW;YACjB,WAAW,EAAE,IAAI;SAClB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-collection.d.ts","sourceRoot":"","sources":["../../src/operations/create-collection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-collection.d.ts","sourceRoot":"","sources":["../../src/operations/create-collection.ts"],"names":[],"mappings":"AAMA,OAAO,EAAmB,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,iBAAiB;IAC9D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC;IACvB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,qBAAqB,GAC3B,OAAO,CAAC,sBAAsB,CAAC,CAcjC"}
|
|
@@ -3,16 +3,13 @@
|
|
|
3
3
|
import { resolveAccount } from "../services/account-resolution.js";
|
|
4
4
|
import { withDatabase } from "../services/instance-context.js";
|
|
5
5
|
import { CollectionListRepository } from "../db/index.js";
|
|
6
|
-
import {
|
|
6
|
+
import { buildCdpOptions } from "./types.js";
|
|
7
7
|
/**
|
|
8
8
|
* Create a new named collection (LH List).
|
|
9
9
|
*/
|
|
10
10
|
export async function createCollection(input) {
|
|
11
|
-
const cdpPort = input.cdpPort
|
|
12
|
-
const accountId = await resolveAccount(cdpPort,
|
|
13
|
-
...(input.cdpHost !== undefined && { host: input.cdpHost }),
|
|
14
|
-
...(input.allowRemote !== undefined && { allowRemote: input.allowRemote }),
|
|
15
|
-
});
|
|
11
|
+
const cdpPort = input.cdpPort;
|
|
12
|
+
const accountId = await resolveAccount(cdpPort, buildCdpOptions(input));
|
|
16
13
|
return withDatabase(accountId, ({ accountId: acctId, db }) => {
|
|
17
14
|
const repo = new CollectionListRepository(db);
|
|
18
15
|
const collectionId = repo.createCollection(acctId, input.name);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-collection.js","sourceRoot":"","sources":["../../src/operations/create-collection.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAEpC,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"create-collection.js","sourceRoot":"","sources":["../../src/operations/create-collection.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAEpC,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAA0B,MAAM,YAAY,CAAC;AAkBrE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,KAA4B;IAE5B,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;IAE9B,MAAM,SAAS,GAAG,MAAM,cAAc,CAAC,OAAO,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;IAExE,OAAO,YAAY,CAAC,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE;QAC3D,MAAM,IAAI,GAAG,IAAI,wBAAwB,CAAC,EAAE,CAAC,CAAC;QAC9C,MAAM,YAAY,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QAC/D,OAAO;YACL,OAAO,EAAE,IAAa;YACtB,YAAY;YACZ,IAAI,EAAE,KAAK,CAAC,IAAI;SACjB,CAAC;IACJ,CAAC,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete-collection.d.ts","sourceRoot":"","sources":["../../src/operations/delete-collection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"delete-collection.d.ts","sourceRoot":"","sources":["../../src/operations/delete-collection.ts"],"names":[],"mappings":"AAMA,OAAO,EAAmB,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,iBAAiB;IAC9D,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC;IACvB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,qBAAqB,GAC3B,OAAO,CAAC,sBAAsB,CAAC,CAcjC"}
|
|
@@ -3,16 +3,13 @@
|
|
|
3
3
|
import { resolveAccount } from "../services/account-resolution.js";
|
|
4
4
|
import { withDatabase } from "../services/instance-context.js";
|
|
5
5
|
import { CollectionListRepository } from "../db/index.js";
|
|
6
|
-
import {
|
|
6
|
+
import { buildCdpOptions } from "./types.js";
|
|
7
7
|
/**
|
|
8
8
|
* Delete a collection and all its people associations.
|
|
9
9
|
*/
|
|
10
10
|
export async function deleteCollection(input) {
|
|
11
|
-
const cdpPort = input.cdpPort
|
|
12
|
-
const accountId = await resolveAccount(cdpPort,
|
|
13
|
-
...(input.cdpHost !== undefined && { host: input.cdpHost }),
|
|
14
|
-
...(input.allowRemote !== undefined && { allowRemote: input.allowRemote }),
|
|
15
|
-
});
|
|
11
|
+
const cdpPort = input.cdpPort;
|
|
12
|
+
const accountId = await resolveAccount(cdpPort, buildCdpOptions(input));
|
|
16
13
|
return withDatabase(accountId, ({ db }) => {
|
|
17
14
|
const repo = new CollectionListRepository(db);
|
|
18
15
|
const deleted = repo.deleteCollection(input.collectionId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete-collection.js","sourceRoot":"","sources":["../../src/operations/delete-collection.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAEpC,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"delete-collection.js","sourceRoot":"","sources":["../../src/operations/delete-collection.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAEpC,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAA0B,MAAM,YAAY,CAAC;AAkBrE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,KAA4B;IAE5B,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;IAE9B,MAAM,SAAS,GAAG,MAAM,cAAc,CAAC,OAAO,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;IAExE,OAAO,YAAY,CAAC,SAAS,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;QACxC,MAAM,IAAI,GAAG,IAAI,wBAAwB,CAAC,EAAE,CAAC,CAAC;QAC9C,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAC1D,OAAO;YACL,OAAO,EAAE,IAAa;YACtB,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,OAAO;SACR,CAAC;IACJ,CAAC,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ConnectionOptions } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Input for the dismiss-errors operation.
|
|
4
|
+
*/
|
|
5
|
+
export type DismissErrorsInput = ConnectionOptions;
|
|
6
|
+
/**
|
|
7
|
+
* Output from the dismiss-errors operation.
|
|
8
|
+
*/
|
|
9
|
+
export interface DismissErrorsOutput {
|
|
10
|
+
readonly accountId: number;
|
|
11
|
+
readonly dismissed: number;
|
|
12
|
+
readonly nonDismissable: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Dismiss closable error popups in the LinkedHelper instance UI.
|
|
16
|
+
*
|
|
17
|
+
* Connects to the launcher and instance UI (LinkedIn webview is not
|
|
18
|
+
* required), finds popup close/OK buttons, and clicks them via CDP.
|
|
19
|
+
* Returns the number of dismissed vs non-dismissable popups.
|
|
20
|
+
*
|
|
21
|
+
* When the launcher is not available (e.g. connecting directly to an
|
|
22
|
+
* instance), launcher popup dismissal is skipped gracefully.
|
|
23
|
+
*/
|
|
24
|
+
export declare function dismissErrors(input: DismissErrorsInput): Promise<DismissErrorsOutput>;
|
|
25
|
+
//# sourceMappingURL=dismiss-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dismiss-errors.d.ts","sourceRoot":"","sources":["../../src/operations/dismiss-errors.ts"],"names":[],"mappings":"AAQA,OAAO,EAAmB,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAErE;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAED;;;;;;;;;GASG;AACH,wBAAsB,aAAa,CACjC,KAAK,EAAE,kBAAkB,GACxB,OAAO,CAAC,mBAAmB,CAAC,CAyD9B"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
// Copyright (C) 2026 Oleksii PELYKH
|
|
3
|
+
import { discoverInstancePort, resolveInstancePort } from "../cdp/index.js";
|
|
4
|
+
import { resolveAccount } from "../services/account-resolution.js";
|
|
5
|
+
import { InstanceService } from "../services/instance.js";
|
|
6
|
+
import { LauncherService } from "../services/launcher.js";
|
|
7
|
+
import { isLoopbackAddress } from "../utils/loopback.js";
|
|
8
|
+
import { buildCdpOptions } from "./types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Dismiss closable error popups in the LinkedHelper instance UI.
|
|
11
|
+
*
|
|
12
|
+
* Connects to the launcher and instance UI (LinkedIn webview is not
|
|
13
|
+
* required), finds popup close/OK buttons, and clicks them via CDP.
|
|
14
|
+
* Returns the number of dismissed vs non-dismissable popups.
|
|
15
|
+
*
|
|
16
|
+
* When the launcher is not available (e.g. connecting directly to an
|
|
17
|
+
* instance), launcher popup dismissal is skipped gracefully.
|
|
18
|
+
*/
|
|
19
|
+
export async function dismissErrors(input) {
|
|
20
|
+
const cdpPort = await resolveInstancePort(input.cdpPort, input.cdpHost);
|
|
21
|
+
const cdpOptions = buildCdpOptions(input);
|
|
22
|
+
const accountId = await resolveAccount(cdpPort, cdpOptions);
|
|
23
|
+
let dismissed = 0;
|
|
24
|
+
let nonDismissable = 0;
|
|
25
|
+
// Dismiss launcher popup (best-effort — skipped when connected
|
|
26
|
+
// directly to an instance or launcher is unreachable)
|
|
27
|
+
let connectedToLauncher = false;
|
|
28
|
+
try {
|
|
29
|
+
const launcher = new LauncherService(cdpPort, cdpOptions);
|
|
30
|
+
try {
|
|
31
|
+
await launcher.connect();
|
|
32
|
+
connectedToLauncher = true;
|
|
33
|
+
const popupDismissed = await launcher.dismissPopup();
|
|
34
|
+
if (popupDismissed) {
|
|
35
|
+
dismissed++;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
// Check if there's a non-dismissable popup
|
|
39
|
+
const popupState = await launcher.getPopupState();
|
|
40
|
+
if (popupState !== null && popupState.blocked) {
|
|
41
|
+
nonDismissable++;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
finally {
|
|
46
|
+
launcher.disconnect();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
// Launcher not available at this port — skip launcher popup dismissal
|
|
51
|
+
}
|
|
52
|
+
// Dismiss instance UI popups.
|
|
53
|
+
// When connected to a launcher, discover the instance's dynamic CDP
|
|
54
|
+
// port — the launcher port does not host instance UI targets.
|
|
55
|
+
// Discovery only works locally (process inspection), so skip for remote hosts.
|
|
56
|
+
const isLocal = input.cdpHost === undefined || isLoopbackAddress(input.cdpHost);
|
|
57
|
+
const instancePort = connectedToLauncher && isLocal
|
|
58
|
+
? await discoverInstancePort(cdpPort).catch(() => null)
|
|
59
|
+
: connectedToLauncher ? null : cdpPort;
|
|
60
|
+
if (instancePort !== null) {
|
|
61
|
+
const instance = new InstanceService(instancePort, cdpOptions);
|
|
62
|
+
try {
|
|
63
|
+
await instance.connectUiOnly();
|
|
64
|
+
const result = await instance.dismissInstancePopups();
|
|
65
|
+
dismissed += result.dismissed;
|
|
66
|
+
nonDismissable += result.nonDismissable;
|
|
67
|
+
}
|
|
68
|
+
finally {
|
|
69
|
+
instance.disconnect();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return { accountId, dismissed, nonDismissable };
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=dismiss-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dismiss-errors.js","sourceRoot":"","sources":["../../src/operations/dismiss-errors.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAEpC,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,eAAe,EAA0B,MAAM,YAAY,CAAC;AAgBrE;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,KAAyB;IAEzB,MAAM,OAAO,GAAG,MAAM,mBAAmB,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAExE,MAAM,UAAU,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IAE1C,MAAM,SAAS,GAAG,MAAM,cAAc,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAE5D,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,IAAI,cAAc,GAAG,CAAC,CAAC;IAEvB,+DAA+D;IAC/D,sDAAsD;IACtD,IAAI,mBA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