@lhremote/core 0.6.0 → 0.8.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.
Files changed (356) hide show
  1. package/README.md +39 -0
  2. package/dist/cdp/client.d.ts +5 -1
  3. package/dist/cdp/client.d.ts.map +1 -1
  4. package/dist/cdp/client.js +11 -3
  5. package/dist/cdp/client.js.map +1 -1
  6. package/dist/data/index.d.ts +1 -0
  7. package/dist/data/index.d.ts.map +1 -1
  8. package/dist/data/index.js +1 -0
  9. package/dist/data/index.js.map +1 -1
  10. package/dist/data/linkedin-reference.d.ts +44 -0
  11. package/dist/data/linkedin-reference.d.ts.map +1 -0
  12. package/dist/data/linkedin-reference.js +316 -0
  13. package/dist/data/linkedin-reference.js.map +1 -0
  14. package/dist/data/linkedin-reference.test.d.ts +2 -0
  15. package/dist/data/linkedin-reference.test.d.ts.map +1 -0
  16. package/dist/data/linkedin-reference.test.js +124 -0
  17. package/dist/data/linkedin-reference.test.js.map +1 -0
  18. package/dist/db/index.d.ts +1 -1
  19. package/dist/db/index.d.ts.map +1 -1
  20. package/dist/db/index.js +1 -1
  21. package/dist/db/index.js.map +1 -1
  22. package/dist/db/repositories/action-budget.d.ts +29 -0
  23. package/dist/db/repositories/action-budget.d.ts.map +1 -0
  24. package/dist/db/repositories/action-budget.js +100 -0
  25. package/dist/db/repositories/action-budget.js.map +1 -0
  26. package/dist/db/repositories/action-budget.test.d.ts +2 -0
  27. package/dist/db/repositories/action-budget.test.d.ts.map +1 -0
  28. package/dist/db/repositories/action-budget.test.js +181 -0
  29. package/dist/db/repositories/action-budget.test.js.map +1 -0
  30. package/dist/db/repositories/campaign-hard-delete.integration.test.d.ts +2 -0
  31. package/dist/db/repositories/campaign-hard-delete.integration.test.d.ts.map +1 -0
  32. package/dist/db/repositories/campaign-hard-delete.integration.test.js +78 -0
  33. package/dist/db/repositories/campaign-hard-delete.integration.test.js.map +1 -0
  34. package/dist/db/repositories/campaign.d.ts +14 -0
  35. package/dist/db/repositories/campaign.d.ts.map +1 -1
  36. package/dist/db/repositories/campaign.js +125 -0
  37. package/dist/db/repositories/campaign.js.map +1 -1
  38. package/dist/db/repositories/index.d.ts +1 -0
  39. package/dist/db/repositories/index.d.ts.map +1 -1
  40. package/dist/db/repositories/index.js +1 -0
  41. package/dist/db/repositories/index.js.map +1 -1
  42. package/dist/index.d.ts +6 -5
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +28 -6
  45. package/dist/index.js.map +1 -1
  46. package/dist/linkedin/__tests__/dom-automation.integration.test.d.ts +2 -0
  47. package/dist/linkedin/__tests__/dom-automation.integration.test.d.ts.map +1 -0
  48. package/dist/linkedin/__tests__/dom-automation.integration.test.js +160 -0
  49. package/dist/linkedin/__tests__/dom-automation.integration.test.js.map +1 -0
  50. package/dist/linkedin/__tests__/selectors.integration.test.d.ts +2 -0
  51. package/dist/linkedin/__tests__/selectors.integration.test.d.ts.map +1 -0
  52. package/dist/linkedin/__tests__/selectors.integration.test.js +258 -0
  53. package/dist/linkedin/__tests__/selectors.integration.test.js.map +1 -0
  54. package/dist/linkedin/dom-automation.d.ts +67 -0
  55. package/dist/linkedin/dom-automation.d.ts.map +1 -0
  56. package/dist/linkedin/dom-automation.js +139 -0
  57. package/dist/linkedin/dom-automation.js.map +1 -0
  58. package/dist/linkedin/index.d.ts +3 -0
  59. package/dist/linkedin/index.d.ts.map +1 -0
  60. package/dist/linkedin/index.js +5 -0
  61. package/dist/linkedin/index.js.map +1 -0
  62. package/dist/linkedin/selectors.d.ts +67 -0
  63. package/dist/linkedin/selectors.d.ts.map +1 -0
  64. package/dist/linkedin/selectors.js +74 -0
  65. package/dist/linkedin/selectors.js.map +1 -0
  66. package/dist/operations/build-linkedin-url.d.ts +39 -0
  67. package/dist/operations/build-linkedin-url.d.ts.map +1 -0
  68. package/dist/operations/build-linkedin-url.js +72 -0
  69. package/dist/operations/build-linkedin-url.js.map +1 -0
  70. package/dist/operations/campaign-delete.d.ts +6 -2
  71. package/dist/operations/campaign-delete.d.ts.map +1 -1
  72. package/dist/operations/campaign-delete.js +9 -2
  73. package/dist/operations/campaign-delete.js.map +1 -1
  74. package/dist/operations/campaign-delete.test.js +41 -1
  75. package/dist/operations/campaign-delete.test.js.map +1 -1
  76. package/dist/operations/campaign-erase.d.ts +19 -0
  77. package/dist/operations/campaign-erase.d.ts.map +1 -0
  78. package/dist/operations/campaign-erase.js +22 -0
  79. package/dist/operations/campaign-erase.js.map +1 -0
  80. package/dist/operations/campaign-erase.test.d.ts +2 -0
  81. package/dist/operations/campaign-erase.test.d.ts.map +1 -0
  82. package/dist/operations/campaign-erase.test.js +101 -0
  83. package/dist/operations/campaign-erase.test.js.map +1 -0
  84. package/dist/operations/comment-on-post.d.ts +34 -0
  85. package/dist/operations/comment-on-post.d.ts.map +1 -0
  86. package/dist/operations/comment-on-post.js +108 -0
  87. package/dist/operations/comment-on-post.js.map +1 -0
  88. package/dist/operations/comment-on-post.test.d.ts +2 -0
  89. package/dist/operations/comment-on-post.test.d.ts.map +1 -0
  90. package/dist/operations/comment-on-post.test.js +240 -0
  91. package/dist/operations/comment-on-post.test.js.map +1 -0
  92. package/dist/operations/dismiss-errors.d.ts +22 -0
  93. package/dist/operations/dismiss-errors.d.ts.map +1 -0
  94. package/dist/operations/dismiss-errors.js +55 -0
  95. package/dist/operations/dismiss-errors.js.map +1 -0
  96. package/dist/operations/dismiss-errors.test.d.ts +2 -0
  97. package/dist/operations/dismiss-errors.test.d.ts.map +1 -0
  98. package/dist/operations/dismiss-errors.test.js +136 -0
  99. package/dist/operations/dismiss-errors.test.js.map +1 -0
  100. package/dist/operations/endorse-skills.d.ts +10 -0
  101. package/dist/operations/endorse-skills.d.ts.map +1 -0
  102. package/dist/operations/endorse-skills.js +12 -0
  103. package/dist/operations/endorse-skills.js.map +1 -0
  104. package/dist/operations/enrich-profile.d.ts +18 -0
  105. package/dist/operations/enrich-profile.d.ts.map +1 -0
  106. package/dist/operations/enrich-profile.js +15 -0
  107. package/dist/operations/enrich-profile.js.map +1 -0
  108. package/dist/operations/ephemeral-action.d.ts +22 -0
  109. package/dist/operations/ephemeral-action.d.ts.map +1 -0
  110. package/dist/operations/ephemeral-action.js +31 -0
  111. package/dist/operations/ephemeral-action.js.map +1 -0
  112. package/dist/operations/follow-person.d.ts +9 -0
  113. package/dist/operations/follow-person.d.ts.map +1 -0
  114. package/dist/operations/follow-person.js +11 -0
  115. package/dist/operations/follow-person.js.map +1 -0
  116. package/dist/operations/get-action-budget.d.ts +6 -0
  117. package/dist/operations/get-action-budget.d.ts.map +1 -0
  118. package/dist/operations/get-action-budget.js +22 -0
  119. package/dist/operations/get-action-budget.js.map +1 -0
  120. package/dist/operations/get-action-budget.test.d.ts +2 -0
  121. package/dist/operations/get-action-budget.test.d.ts.map +1 -0
  122. package/dist/operations/get-action-budget.test.js +79 -0
  123. package/dist/operations/get-action-budget.test.js.map +1 -0
  124. package/dist/operations/get-errors.d.ts +9 -3
  125. package/dist/operations/get-errors.d.ts.map +1 -1
  126. package/dist/operations/get-errors.js +41 -4
  127. package/dist/operations/get-errors.js.map +1 -1
  128. package/dist/operations/get-errors.test.js +108 -42
  129. package/dist/operations/get-errors.test.js.map +1 -1
  130. package/dist/operations/get-feed.d.ts +33 -0
  131. package/dist/operations/get-feed.d.ts.map +1 -0
  132. package/dist/operations/get-feed.js +220 -0
  133. package/dist/operations/get-feed.js.map +1 -0
  134. package/dist/operations/get-feed.test.d.ts +2 -0
  135. package/dist/operations/get-feed.test.d.ts.map +1 -0
  136. package/dist/operations/get-feed.test.js +276 -0
  137. package/dist/operations/get-feed.test.js.map +1 -0
  138. package/dist/operations/get-post-engagers.d.ts +40 -0
  139. package/dist/operations/get-post-engagers.d.ts.map +1 -0
  140. package/dist/operations/get-post-engagers.js +128 -0
  141. package/dist/operations/get-post-engagers.js.map +1 -0
  142. package/dist/operations/get-post-engagers.test.d.ts +2 -0
  143. package/dist/operations/get-post-engagers.test.d.ts.map +1 -0
  144. package/dist/operations/get-post-engagers.test.js +19 -0
  145. package/dist/operations/get-post-engagers.test.js.map +1 -0
  146. package/dist/operations/get-post-stats.d.ts +38 -0
  147. package/dist/operations/get-post-stats.d.ts.map +1 -0
  148. package/dist/operations/get-post-stats.js +100 -0
  149. package/dist/operations/get-post-stats.js.map +1 -0
  150. package/dist/operations/get-post-stats.test.d.ts +2 -0
  151. package/dist/operations/get-post-stats.test.d.ts.map +1 -0
  152. package/dist/operations/get-post-stats.test.js +34 -0
  153. package/dist/operations/get-post-stats.test.js.map +1 -0
  154. package/dist/operations/get-post.d.ts +183 -0
  155. package/dist/operations/get-post.d.ts.map +1 -0
  156. package/dist/operations/get-post.js +270 -0
  157. package/dist/operations/get-post.js.map +1 -0
  158. package/dist/operations/get-post.test.d.ts +2 -0
  159. package/dist/operations/get-post.test.d.ts.map +1 -0
  160. package/dist/operations/get-post.test.js +449 -0
  161. package/dist/operations/get-post.test.js.map +1 -0
  162. package/dist/operations/get-profile-activity.d.ts +129 -0
  163. package/dist/operations/get-profile-activity.d.ts.map +1 -0
  164. package/dist/operations/get-profile-activity.js +181 -0
  165. package/dist/operations/get-profile-activity.js.map +1 -0
  166. package/dist/operations/get-profile-activity.test.d.ts +2 -0
  167. package/dist/operations/get-profile-activity.test.d.ts.map +1 -0
  168. package/dist/operations/get-profile-activity.test.js +205 -0
  169. package/dist/operations/get-profile-activity.test.js.map +1 -0
  170. package/dist/operations/get-throttle-status.d.ts +6 -0
  171. package/dist/operations/get-throttle-status.d.ts.map +1 -0
  172. package/dist/operations/get-throttle-status.js +30 -0
  173. package/dist/operations/get-throttle-status.js.map +1 -0
  174. package/dist/operations/get-throttle-status.test.d.ts +2 -0
  175. package/dist/operations/get-throttle-status.test.d.ts.map +1 -0
  176. package/dist/operations/get-throttle-status.test.js +62 -0
  177. package/dist/operations/get-throttle-status.test.js.map +1 -0
  178. package/dist/operations/index.d.ts +24 -0
  179. package/dist/operations/index.d.ts.map +1 -1
  180. package/dist/operations/index.js +35 -0
  181. package/dist/operations/index.js.map +1 -1
  182. package/dist/operations/like-person-posts.d.ts +14 -0
  183. package/dist/operations/like-person-posts.d.ts.map +1 -0
  184. package/dist/operations/like-person-posts.js +28 -0
  185. package/dist/operations/like-person-posts.js.map +1 -0
  186. package/dist/operations/message-person.d.ts +11 -0
  187. package/dist/operations/message-person.d.ts.map +1 -0
  188. package/dist/operations/message-person.js +19 -0
  189. package/dist/operations/message-person.js.map +1 -0
  190. package/dist/operations/react-to-post.d.ts +38 -0
  191. package/dist/operations/react-to-post.d.ts.map +1 -0
  192. package/dist/operations/react-to-post.js +82 -0
  193. package/dist/operations/react-to-post.js.map +1 -0
  194. package/dist/operations/react-to-post.test.d.ts +2 -0
  195. package/dist/operations/react-to-post.test.d.ts.map +1 -0
  196. package/dist/operations/react-to-post.test.js +154 -0
  197. package/dist/operations/react-to-post.test.js.map +1 -0
  198. package/dist/operations/remove-connection.d.ts +6 -0
  199. package/dist/operations/remove-connection.d.ts.map +1 -0
  200. package/dist/operations/remove-connection.js +7 -0
  201. package/dist/operations/remove-connection.js.map +1 -0
  202. package/dist/operations/resolve-linkedin-entity.d.ts +33 -0
  203. package/dist/operations/resolve-linkedin-entity.d.ts.map +1 -0
  204. package/dist/operations/resolve-linkedin-entity.js +198 -0
  205. package/dist/operations/resolve-linkedin-entity.js.map +1 -0
  206. package/dist/operations/search-posts.d.ts +143 -0
  207. package/dist/operations/search-posts.d.ts.map +1 -0
  208. package/dist/operations/search-posts.js +220 -0
  209. package/dist/operations/search-posts.js.map +1 -0
  210. package/dist/operations/search-posts.test.d.ts +2 -0
  211. package/dist/operations/search-posts.test.d.ts.map +1 -0
  212. package/dist/operations/search-posts.test.js +261 -0
  213. package/dist/operations/search-posts.test.js.map +1 -0
  214. package/dist/operations/send-inmail.d.ts +11 -0
  215. package/dist/operations/send-inmail.d.ts.map +1 -0
  216. package/dist/operations/send-inmail.js +19 -0
  217. package/dist/operations/send-inmail.js.map +1 -0
  218. package/dist/operations/send-invite.d.ts +9 -0
  219. package/dist/operations/send-invite.d.ts.map +1 -0
  220. package/dist/operations/send-invite.js +14 -0
  221. package/dist/operations/send-invite.js.map +1 -0
  222. package/dist/operations/visit-profile.d.ts +14 -0
  223. package/dist/operations/visit-profile.d.ts.map +1 -0
  224. package/dist/operations/visit-profile.js +49 -0
  225. package/dist/operations/visit-profile.js.map +1 -0
  226. package/dist/operations/visit-profile.test.d.ts +2 -0
  227. package/dist/operations/visit-profile.test.d.ts.map +1 -0
  228. package/dist/operations/visit-profile.test.js +193 -0
  229. package/dist/operations/visit-profile.test.js.map +1 -0
  230. package/dist/services/app.d.ts.map +1 -1
  231. package/dist/services/app.js +37 -12
  232. package/dist/services/app.js.map +1 -1
  233. package/dist/services/app.test.js +57 -0
  234. package/dist/services/app.test.js.map +1 -1
  235. package/dist/services/boolean-expression.d.ts +29 -0
  236. package/dist/services/boolean-expression.d.ts.map +1 -0
  237. package/dist/services/boolean-expression.js +79 -0
  238. package/dist/services/boolean-expression.js.map +1 -0
  239. package/dist/services/boolean-expression.test.d.ts +2 -0
  240. package/dist/services/boolean-expression.test.d.ts.map +1 -0
  241. package/dist/services/boolean-expression.test.js +64 -0
  242. package/dist/services/boolean-expression.test.js.map +1 -0
  243. package/dist/services/campaign.d.ts +10 -0
  244. package/dist/services/campaign.d.ts.map +1 -1
  245. package/dist/services/campaign.js +16 -0
  246. package/dist/services/campaign.js.map +1 -1
  247. package/dist/services/collection.d.ts +5 -2
  248. package/dist/services/collection.d.ts.map +1 -1
  249. package/dist/services/collection.js +33 -5
  250. package/dist/services/collection.js.map +1 -1
  251. package/dist/services/collection.test.js +64 -6
  252. package/dist/services/collection.test.js.map +1 -1
  253. package/dist/services/ephemeral-campaign.d.ts +64 -0
  254. package/dist/services/ephemeral-campaign.d.ts.map +1 -0
  255. package/dist/services/ephemeral-campaign.js +210 -0
  256. package/dist/services/ephemeral-campaign.js.map +1 -0
  257. package/dist/services/ephemeral-campaign.test.d.ts +2 -0
  258. package/dist/services/ephemeral-campaign.test.d.ts.map +1 -0
  259. package/dist/services/ephemeral-campaign.test.js +333 -0
  260. package/dist/services/ephemeral-campaign.test.js.map +1 -0
  261. package/dist/services/errors.d.ts +21 -0
  262. package/dist/services/errors.d.ts.map +1 -1
  263. package/dist/services/errors.js +35 -0
  264. package/dist/services/errors.js.map +1 -1
  265. package/dist/services/index.d.ts +7 -1
  266. package/dist/services/index.d.ts.map +1 -1
  267. package/dist/services/index.js +7 -1
  268. package/dist/services/index.js.map +1 -1
  269. package/dist/services/instance-context.d.ts.map +1 -1
  270. package/dist/services/instance-context.js +9 -1
  271. package/dist/services/instance-context.js.map +1 -1
  272. package/dist/services/instance-context.test.js +77 -1
  273. package/dist/services/instance-context.test.js.map +1 -1
  274. package/dist/services/instance.d.ts +43 -0
  275. package/dist/services/instance.d.ts.map +1 -1
  276. package/dist/services/instance.js +151 -0
  277. package/dist/services/instance.js.map +1 -1
  278. package/dist/services/instance.test.js +101 -0
  279. package/dist/services/instance.test.js.map +1 -1
  280. package/dist/services/launcher.d.ts +23 -0
  281. package/dist/services/launcher.d.ts.map +1 -1
  282. package/dist/services/launcher.js +81 -11
  283. package/dist/services/launcher.js.map +1 -1
  284. package/dist/services/launcher.test.js +109 -42
  285. package/dist/services/launcher.test.js.map +1 -1
  286. package/dist/services/sn-url-builder.d.ts +21 -0
  287. package/dist/services/sn-url-builder.d.ts.map +1 -0
  288. package/dist/services/sn-url-builder.js +132 -0
  289. package/dist/services/sn-url-builder.js.map +1 -0
  290. package/dist/services/sn-url-builder.test.d.ts +2 -0
  291. package/dist/services/sn-url-builder.test.d.ts.map +1 -0
  292. package/dist/services/sn-url-builder.test.js +130 -0
  293. package/dist/services/sn-url-builder.test.js.map +1 -0
  294. package/dist/services/url-builder.d.ts +12 -0
  295. package/dist/services/url-builder.d.ts.map +1 -0
  296. package/dist/services/url-builder.js +100 -0
  297. package/dist/services/url-builder.js.map +1 -0
  298. package/dist/services/url-builder.test.d.ts +2 -0
  299. package/dist/services/url-builder.test.d.ts.map +1 -0
  300. package/dist/services/url-builder.test.js +79 -0
  301. package/dist/services/url-builder.test.js.map +1 -0
  302. package/dist/services/url-templates.d.ts +41 -0
  303. package/dist/services/url-templates.d.ts.map +1 -0
  304. package/dist/services/url-templates.js +118 -0
  305. package/dist/services/url-templates.js.map +1 -0
  306. package/dist/services/url-templates.test.d.ts +2 -0
  307. package/dist/services/url-templates.test.d.ts.map +1 -0
  308. package/dist/services/url-templates.test.js +159 -0
  309. package/dist/services/url-templates.test.js.map +1 -0
  310. package/dist/types/action-budget.d.ts +52 -0
  311. package/dist/types/action-budget.d.ts.map +1 -0
  312. package/dist/types/action-budget.js +4 -0
  313. package/dist/types/action-budget.js.map +1 -0
  314. package/dist/types/campaign.d.ts +24 -0
  315. package/dist/types/campaign.d.ts.map +1 -1
  316. package/dist/types/feed.d.ts +32 -0
  317. package/dist/types/feed.d.ts.map +1 -0
  318. package/dist/types/feed.js +4 -0
  319. package/dist/types/feed.js.map +1 -0
  320. package/dist/types/index.d.ts +8 -2
  321. package/dist/types/index.d.ts.map +1 -1
  322. package/dist/types/linkedin-url.d.ts +109 -0
  323. package/dist/types/linkedin-url.d.ts.map +1 -0
  324. package/dist/types/linkedin-url.js +4 -0
  325. package/dist/types/linkedin-url.js.map +1 -0
  326. package/dist/types/post-analytics.d.ts +40 -0
  327. package/dist/types/post-analytics.d.ts.map +1 -0
  328. package/dist/types/post-analytics.js +4 -0
  329. package/dist/types/post-analytics.js.map +1 -0
  330. package/dist/types/post.d.ts +43 -0
  331. package/dist/types/post.d.ts.map +1 -0
  332. package/dist/types/post.js +4 -0
  333. package/dist/types/post.js.map +1 -0
  334. package/dist/types/search-posts.d.ts +22 -0
  335. package/dist/types/search-posts.d.ts.map +1 -0
  336. package/dist/types/search-posts.js +4 -0
  337. package/dist/types/search-posts.js.map +1 -0
  338. package/dist/types/ui-health.d.ts +16 -0
  339. package/dist/types/ui-health.d.ts.map +1 -1
  340. package/dist/voyager/index.d.ts +2 -0
  341. package/dist/voyager/index.d.ts.map +1 -0
  342. package/dist/voyager/index.js +4 -0
  343. package/dist/voyager/index.js.map +1 -0
  344. package/dist/voyager/interceptor.d.ts +100 -0
  345. package/dist/voyager/interceptor.d.ts.map +1 -0
  346. package/dist/voyager/interceptor.integration.test.d.ts +2 -0
  347. package/dist/voyager/interceptor.integration.test.d.ts.map +1 -0
  348. package/dist/voyager/interceptor.integration.test.js +89 -0
  349. package/dist/voyager/interceptor.integration.test.js.map +1 -0
  350. package/dist/voyager/interceptor.js +235 -0
  351. package/dist/voyager/interceptor.js.map +1 -0
  352. package/dist/voyager/interceptor.test.d.ts +2 -0
  353. package/dist/voyager/interceptor.test.d.ts.map +1 -0
  354. package/dist/voyager/interceptor.test.js +372 -0
  355. package/dist/voyager/interceptor.test.js.map +1 -0
  356. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endorse-skills.js","sourceRoot":"","sources":["../../src/operations/endorse-skills.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAGpC,OAAO,EACL,sBAAsB,GAEvB,MAAM,uBAAuB,CAAC;AAU/B,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,KAAyB;IAEzB,MAAM,cAAc,GAAmB;QACrC,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,IAAI,IAAI;QACtD,GAAG,CAAC,KAAK,CAAC,UAAU,KAAK,SAAS,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC;QACvE,GAAG,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;KACzD,CAAC;IAEF,OAAO,sBAAsB,CAAC,eAAe,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;AACxE,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { EphemeralActionResult } from "../types/index.js";
2
+ import { type EphemeralActionInput } from "./ephemeral-action.js";
3
+ /** Per-category enrichment toggle. */
4
+ export interface EnrichmentCategory {
5
+ readonly shouldEnrich: boolean;
6
+ readonly actualDate?: number | undefined;
7
+ readonly types?: string[] | undefined;
8
+ }
9
+ export interface EnrichProfileInput extends EphemeralActionInput {
10
+ readonly profileInfo?: EnrichmentCategory | undefined;
11
+ readonly phones?: EnrichmentCategory | undefined;
12
+ readonly emails?: EnrichmentCategory | undefined;
13
+ readonly socials?: EnrichmentCategory | undefined;
14
+ readonly companies?: EnrichmentCategory | undefined;
15
+ }
16
+ export type EnrichProfileOutput = EphemeralActionResult;
17
+ export declare function enrichProfile(input: EnrichProfileInput): Promise<EnrichProfileOutput>;
18
+ //# sourceMappingURL=enrich-profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enrich-profile.d.ts","sourceRoot":"","sources":["../../src/operations/enrich-profile.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAkB,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAC;AAE/B,sCAAsC;AACtC,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CACvC;AAED,MAAM,WAAW,kBAAmB,SAAQ,oBAAoB;IAC9D,QAAQ,CAAC,WAAW,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAC;IACtD,QAAQ,CAAC,MAAM,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAC;IACjD,QAAQ,CAAC,MAAM,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAC;IACjD,QAAQ,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAClD,QAAQ,CAAC,SAAS,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAC;CACrD;AAED,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAExD,wBAAsB,aAAa,CACjC,KAAK,EAAE,kBAAkB,GACxB,OAAO,CAAC,mBAAmB,CAAC,CAW9B"}
@@ -0,0 +1,15 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 Oleksii PELYKH
3
+ import { executeEphemeralAction, } from "./ephemeral-action.js";
4
+ export async function enrichProfile(input) {
5
+ const defaults = { shouldEnrich: false };
6
+ const actionSettings = {
7
+ profileInfo: input.profileInfo ?? defaults,
8
+ phones: input.phones ?? defaults,
9
+ emails: input.emails ?? { ...defaults, types: ["personal", "business"] },
10
+ socials: input.socials ?? defaults,
11
+ companies: input.companies ?? defaults,
12
+ };
13
+ return executeEphemeralAction("DataEnrichment", input, actionSettings);
14
+ }
15
+ //# sourceMappingURL=enrich-profile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enrich-profile.js","sourceRoot":"","sources":["../../src/operations/enrich-profile.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAGpC,OAAO,EACL,sBAAsB,GAEvB,MAAM,uBAAuB,CAAC;AAmB/B,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,KAAyB;IAEzB,MAAM,QAAQ,GAAuB,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;IAC7D,MAAM,cAAc,GAAmB;QACrC,WAAW,EAAE,KAAK,CAAC,WAAW,IAAI,QAAQ;QAC1C,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,QAAQ;QAChC,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,EAAE,GAAG,QAAQ,EAAE,KAAK,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC,EAAE;QACxE,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,QAAQ;QAClC,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,QAAQ;KACvC,CAAC;IAEF,OAAO,sBAAsB,CAAC,gBAAgB,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;AACzE,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { ActionSettings, EphemeralActionResult } from "../types/index.js";
2
+ import type { ConnectionOptions } from "./types.js";
3
+ /**
4
+ * Shared input fields for all ephemeral action operations.
5
+ *
6
+ * Each individual action operation extends this with action-specific
7
+ * parameters.
8
+ */
9
+ export interface EphemeralActionInput extends ConnectionOptions {
10
+ readonly personId?: number | undefined;
11
+ readonly url?: string | undefined;
12
+ readonly keepCampaign?: boolean | undefined;
13
+ }
14
+ /**
15
+ * Execute a single action on a single person via the ephemeral campaign
16
+ * service.
17
+ *
18
+ * Shared helper used by all individual action operations
19
+ * (message-person, send-invite, etc.).
20
+ */
21
+ export declare function executeEphemeralAction(actionType: string, input: EphemeralActionInput, actionSettings?: ActionSettings): Promise<EphemeralActionResult>;
22
+ //# sourceMappingURL=ephemeral-action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ephemeral-action.d.ts","sourceRoot":"","sources":["../../src/operations/ephemeral-action.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAK/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC7C;AAED;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,oBAAoB,EAC3B,cAAc,CAAC,EAAE,cAAc,GAC9B,OAAO,CAAC,qBAAqB,CAAC,CAmBhC"}
@@ -0,0 +1,31 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 Oleksii PELYKH
3
+ import { resolveAccount } from "../services/account-resolution.js";
4
+ import { withInstanceDatabase } from "../services/instance-context.js";
5
+ import { EphemeralCampaignService } from "../services/ephemeral-campaign.js";
6
+ import { DEFAULT_CDP_PORT } from "../constants.js";
7
+ /**
8
+ * Execute a single action on a single person via the ephemeral campaign
9
+ * service.
10
+ *
11
+ * Shared helper used by all individual action operations
12
+ * (message-person, send-invite, etc.).
13
+ */
14
+ export async function executeEphemeralAction(actionType, input, actionSettings) {
15
+ if ((input.personId == null) === (input.url == null)) {
16
+ throw new Error("Exactly one of personId or url must be provided");
17
+ }
18
+ const target = input.personId ?? input.url;
19
+ const cdpPort = input.cdpPort ?? DEFAULT_CDP_PORT;
20
+ const accountId = await resolveAccount(cdpPort, {
21
+ ...(input.cdpHost !== undefined && { host: input.cdpHost }),
22
+ ...(input.allowRemote !== undefined && { allowRemote: input.allowRemote }),
23
+ });
24
+ return withInstanceDatabase(cdpPort, accountId, async ({ instance, db }) => {
25
+ const ephemeral = new EphemeralCampaignService(instance, db);
26
+ return ephemeral.execute(actionType, target, actionSettings, {
27
+ ...(input.keepCampaign !== undefined && { keepCampaign: input.keepCampaign }),
28
+ });
29
+ });
30
+ }
31
+ //# sourceMappingURL=ephemeral-action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ephemeral-action.js","sourceRoot":"","sources":["../../src/operations/ephemeral-action.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAGpC,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAenD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,UAAkB,EAClB,KAA2B,EAC3B,cAA+B;IAE/B,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,EAAE,CAAC;QACrD,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IAED,MAAM,MAAM,GAAoB,KAAK,CAAC,QAAQ,IAAK,KAAK,CAAC,GAAc,CAAC;IACxE,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,gBAAgB,CAAC;IAElD,MAAM,SAAS,GAAG,MAAM,cAAc,CAAC,OAAO,EAAE;QAC9C,GAAG,CAAC,KAAK,CAAC,OAAO,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;QAC3D,GAAG,CAAC,KAAK,CAAC,WAAW,KAAK,SAAS,IAAI,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC;KAC3E,CAAC,CAAC;IAEH,OAAO,oBAAoB,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,EAAE;QACzE,MAAM,SAAS,GAAG,IAAI,wBAAwB,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC7D,OAAO,SAAS,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE;YAC3D,GAAG,CAAC,KAAK,CAAC,YAAY,KAAK,SAAS,IAAI,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC;SAC9E,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { EphemeralActionResult } from "../types/index.js";
2
+ import { type EphemeralActionInput } from "./ephemeral-action.js";
3
+ export interface FollowPersonInput extends EphemeralActionInput {
4
+ readonly mode?: "follow" | "unfollow" | undefined;
5
+ readonly skipIfUnfollowable?: boolean | undefined;
6
+ }
7
+ export type FollowPersonOutput = EphemeralActionResult;
8
+ export declare function followPerson(input: FollowPersonInput): Promise<FollowPersonOutput>;
9
+ //# sourceMappingURL=follow-person.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"follow-person.d.ts","sourceRoot":"","sources":["../../src/operations/follow-person.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAkB,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,iBAAkB,SAAQ,oBAAoB;IAC7D,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;IAClD,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACnD;AAED,MAAM,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AAEvD,wBAAsB,YAAY,CAChC,KAAK,EAAE,iBAAiB,GACvB,OAAO,CAAC,kBAAkB,CAAC,CAO7B"}
@@ -0,0 +1,11 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 Oleksii PELYKH
3
+ import { executeEphemeralAction, } from "./ephemeral-action.js";
4
+ export async function followPerson(input) {
5
+ const actionSettings = {
6
+ skipIfUnfollowable: input.skipIfUnfollowable ?? true,
7
+ ...(input.mode !== undefined && { mode: input.mode }),
8
+ };
9
+ return executeEphemeralAction("Follow", input, actionSettings);
10
+ }
11
+ //# sourceMappingURL=follow-person.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"follow-person.js","sourceRoot":"","sources":["../../src/operations/follow-person.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAGpC,OAAO,EACL,sBAAsB,GAEvB,MAAM,uBAAuB,CAAC;AAS/B,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,KAAwB;IAExB,MAAM,cAAc,GAAmB;QACrC,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,IAAI,IAAI;QACpD,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;KACtD,CAAC;IAEF,OAAO,sBAAsB,CAAC,QAAQ,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;AACjE,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { ActionBudget } from "../types/index.js";
2
+ import type { ConnectionOptions } from "./types.js";
3
+ export type GetActionBudgetInput = ConnectionOptions;
4
+ export type GetActionBudgetOutput = ActionBudget;
5
+ export declare function getActionBudget(input: GetActionBudgetInput): Promise<GetActionBudgetOutput>;
6
+ //# sourceMappingURL=get-action-budget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-action-budget.d.ts","sourceRoot":"","sources":["../../src/operations/get-action-budget.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAKtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,CAAC;AAErD,MAAM,MAAM,qBAAqB,GAAG,YAAY,CAAC;AAEjD,wBAAsB,eAAe,CACnC,KAAK,EAAE,oBAAoB,GAC1B,OAAO,CAAC,qBAAqB,CAAC,CAgBhC"}
@@ -0,0 +1,22 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 Oleksii PELYKH
3
+ import { resolveAccount } from "../services/account-resolution.js";
4
+ import { withDatabase } from "../services/instance-context.js";
5
+ import { ActionBudgetRepository } from "../db/index.js";
6
+ import { DEFAULT_CDP_PORT } from "../constants.js";
7
+ export async function getActionBudget(input) {
8
+ const cdpPort = input.cdpPort ?? DEFAULT_CDP_PORT;
9
+ const accountId = await resolveAccount(cdpPort, {
10
+ ...(input.cdpHost !== undefined && { host: input.cdpHost }),
11
+ ...(input.allowRemote !== undefined && { allowRemote: input.allowRemote }),
12
+ });
13
+ return withDatabase(accountId, ({ db }) => {
14
+ const repo = new ActionBudgetRepository(db);
15
+ const entries = repo.getActionBudget();
16
+ return {
17
+ entries,
18
+ asOf: new Date().toISOString(),
19
+ };
20
+ });
21
+ }
22
+ //# sourceMappingURL=get-action-budget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-action-budget.js","sourceRoot":"","sources":["../../src/operations/get-action-budget.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAGpC,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAOnD,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,KAA2B;IAE3B,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,gBAAgB,CAAC;IAElD,MAAM,SAAS,GAAG,MAAM,cAAc,CAAC,OAAO,EAAE;QAC9C,GAAG,CAAC,KAAK,CAAC,OAAO,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;QAC3D,GAAG,CAAC,KAAK,CAAC,WAAW,KAAK,SAAS,IAAI,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC;KAC3E,CAAC,CAAC;IAEH,OAAO,YAAY,CAAC,SAAS,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;QACxC,MAAM,IAAI,GAAG,IAAI,sBAAsB,CAAC,EAAE,CAAC,CAAC;QAC5C,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QACvC,OAAO;YACL,OAAO;YACP,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SAC/B,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=get-action-budget.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-action-budget.test.d.ts","sourceRoot":"","sources":["../../src/operations/get-action-budget.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,79 @@
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
+ import { resolveAccount } from "../services/account-resolution.js";
14
+ import { withDatabase } from "../services/instance-context.js";
15
+ import { ActionBudgetRepository } from "../db/index.js";
16
+ import { getActionBudget } from "./get-action-budget.js";
17
+ const MOCK_ENTRIES = [
18
+ {
19
+ limitTypeId: 8,
20
+ limitType: "Invite",
21
+ dailyLimit: 100,
22
+ campaignUsed: 5,
23
+ directUsed: 0,
24
+ totalUsed: 5,
25
+ remaining: 95,
26
+ },
27
+ ];
28
+ function setupMocks() {
29
+ vi.mocked(resolveAccount).mockResolvedValue(1);
30
+ vi.mocked(withDatabase).mockImplementation(async (_accountId, callback) => callback({ db: {} }));
31
+ vi.mocked(ActionBudgetRepository).mockImplementation(function () {
32
+ return {
33
+ getActionBudget: vi.fn().mockReturnValue(MOCK_ENTRIES),
34
+ getLimitTypes: vi.fn().mockReturnValue([]),
35
+ };
36
+ });
37
+ }
38
+ describe("getActionBudget", () => {
39
+ beforeEach(() => {
40
+ vi.clearAllMocks();
41
+ });
42
+ afterEach(() => {
43
+ vi.restoreAllMocks();
44
+ });
45
+ it("returns action budget with entries and timestamp", async () => {
46
+ setupMocks();
47
+ const result = await getActionBudget({ cdpPort: 9222 });
48
+ expect(result.entries).toEqual(MOCK_ENTRIES);
49
+ expect(result.asOf).toBeDefined();
50
+ expect(new Date(result.asOf).getTime()).not.toBeNaN();
51
+ });
52
+ it("passes connection options to resolveAccount", async () => {
53
+ setupMocks();
54
+ await getActionBudget({
55
+ cdpPort: 1234,
56
+ cdpHost: "192.168.1.1",
57
+ allowRemote: true,
58
+ });
59
+ expect(resolveAccount).toHaveBeenCalledWith(1234, {
60
+ host: "192.168.1.1",
61
+ allowRemote: true,
62
+ });
63
+ });
64
+ it("omits undefined connection options", async () => {
65
+ setupMocks();
66
+ await getActionBudget({ cdpPort: 9222 });
67
+ expect(resolveAccount).toHaveBeenCalledWith(9222, {});
68
+ });
69
+ it("propagates resolveAccount errors", async () => {
70
+ vi.mocked(resolveAccount).mockRejectedValue(new Error("connection refused"));
71
+ await expect(getActionBudget({ cdpPort: 9222 })).rejects.toThrow("connection refused");
72
+ });
73
+ it("propagates withDatabase errors", async () => {
74
+ vi.mocked(resolveAccount).mockResolvedValue(1);
75
+ vi.mocked(withDatabase).mockRejectedValue(new Error("database not found"));
76
+ await expect(getActionBudget({ cdpPort: 9222 })).rejects.toThrow("database not found");
77
+ });
78
+ });
79
+ //# sourceMappingURL=get-action-budget.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-action-budget.test.js","sourceRoot":"","sources":["../../src/operations/get-action-budget.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;IACh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,EAAE;QAChD,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,iBAAiB,CAAC,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC;QAE7E,MAAM,MAAM,CACV,eAAe,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CACnC,CAAC,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gCAAgC,EAAE,KAAK,IAAI,EAAE;QAC9C,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;QAC/C,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,iBAAiB,CACvC,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAChC,CAAC;QAEF,MAAM,MAAM,CACV,eAAe,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CACnC,CAAC,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { UIHealthStatus } from "../types/index.js";
1
+ import type { InstancePopup, UIHealthStatus } from "../types/index.js";
2
2
  import type { ConnectionOptions } from "./types.js";
3
3
  /**
4
4
  * Input for the get-errors operation.
@@ -9,13 +9,19 @@ export type GetErrorsInput = ConnectionOptions;
9
9
  */
10
10
  export interface GetErrorsOutput extends UIHealthStatus {
11
11
  readonly accountId: number;
12
+ /** Popups detected in the instance UI DOM (behind the LinkedIn webview). */
13
+ readonly instancePopups: readonly InstancePopup[];
12
14
  }
13
15
  /**
14
16
  * Query the current error/dialog/popup state of a LinkedHelper instance.
15
17
  *
16
18
  * Connects to the launcher, resolves the account, and returns the
17
- * aggregated UI health status including active instance issues and
18
- * popup overlay state.
19
+ * aggregated UI health status including active instance issues,
20
+ * popup overlay state, and instance UI popups.
21
+ *
22
+ * Instance popups are detected on a best-effort basis: if the instance
23
+ * is not running or the UI target is unavailable, the operation still
24
+ * succeeds and returns an empty `instancePopups` array.
19
25
  */
20
26
  export declare function getErrors(input: GetErrorsInput): Promise<GetErrorsOutput>;
21
27
  //# sourceMappingURL=get-errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-errors.d.ts","sourceRoot":"","sources":["../../src/operations/get-errors.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAIxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,iBAAiB,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACrD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,wBAAsB,SAAS,CAC7B,KAAK,EAAE,cAAc,GACpB,OAAO,CAAC,eAAe,CAAC,CAkB1B"}
1
+ {"version":3,"file":"get-errors.d.ts","sourceRoot":"","sources":["../../src/operations/get-errors.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAMvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,iBAAiB,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACrD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,4EAA4E;IAC5E,QAAQ,CAAC,cAAc,EAAE,SAAS,aAAa,EAAE,CAAC;CACnD;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,SAAS,CAC7B,KAAK,EAAE,cAAc,GACpB,OAAO,CAAC,eAAe,CAAC,CA8B1B"}
@@ -1,14 +1,20 @@
1
1
  // SPDX-License-Identifier: AGPL-3.0-only
2
2
  // Copyright (C) 2026 Oleksii PELYKH
3
+ import { discoverTargets } from "../cdp/index.js";
3
4
  import { resolveAccount } from "../services/account-resolution.js";
5
+ import { InstanceService } from "../services/instance.js";
4
6
  import { LauncherService } from "../services/launcher.js";
5
7
  import { DEFAULT_CDP_PORT } from "../constants.js";
6
8
  /**
7
9
  * Query the current error/dialog/popup state of a LinkedHelper instance.
8
10
  *
9
11
  * Connects to the launcher, resolves the account, and returns the
10
- * aggregated UI health status including active instance issues and
11
- * popup overlay state.
12
+ * aggregated UI health status including active instance issues,
13
+ * popup overlay state, and instance UI popups.
14
+ *
15
+ * Instance popups are detected on a best-effort basis: if the instance
16
+ * is not running or the UI target is unavailable, the operation still
17
+ * succeeds and returns an empty `instancePopups` array.
12
18
  */
13
19
  export async function getErrors(input) {
14
20
  const cdpPort = input.cdpPort ?? DEFAULT_CDP_PORT;
@@ -18,13 +24,44 @@ export async function getErrors(input) {
18
24
  };
19
25
  const accountId = await resolveAccount(cdpPort, cdpOptions);
20
26
  const launcher = new LauncherService(cdpPort, cdpOptions);
27
+ let health;
21
28
  try {
22
29
  await launcher.connect();
23
- const health = await launcher.checkUIHealth(accountId);
24
- return { accountId, ...health };
30
+ health = await launcher.checkUIHealth(accountId);
25
31
  }
26
32
  finally {
27
33
  launcher.disconnect();
28
34
  }
35
+ // Best-effort: detect instance UI popups if the instance is running.
36
+ const instancePopups = await detectInstancePopups(cdpPort, input.cdpHost, cdpOptions);
37
+ const healthy = health.healthy && instancePopups.length === 0;
38
+ return { accountId, ...health, healthy, instancePopups };
39
+ }
40
+ /**
41
+ * Attempt to detect instance UI popups via a one-shot target discovery.
42
+ *
43
+ * Returns an empty array when the instance is not running or the
44
+ * targets disappear between discovery and connection.
45
+ */
46
+ async function detectInstancePopups(cdpPort, cdpHost, cdpOptions) {
47
+ try {
48
+ const targets = await discoverTargets(cdpPort, cdpHost ?? "127.0.0.1");
49
+ const hasLinkedIn = targets.some((t) => t.type === "page" && t.url.includes("linkedin.com"));
50
+ const hasUI = targets.some((t) => t.type === "page" && t.url.includes("index.html"));
51
+ if (!hasLinkedIn || !hasUI) {
52
+ return [];
53
+ }
54
+ const instance = new InstanceService(cdpPort, cdpOptions);
55
+ try {
56
+ await instance.connect();
57
+ return await instance.getInstancePopups();
58
+ }
59
+ finally {
60
+ instance.disconnect();
61
+ }
62
+ }
63
+ catch {
64
+ return [];
65
+ }
29
66
  }
30
67
  //# sourceMappingURL=get-errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-errors.js","sourceRoot":"","sources":["../../src/operations/get-errors.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAGpC,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAenD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,KAAqB;IAErB,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,gBAAgB,CAAC;IAElD,MAAM,UAAU,GAAG;QACjB,GAAG,CAAC,KAAK,CAAC,OAAO,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;QAC3D,GAAG,CAAC,KAAK,CAAC,WAAW,KAAK,SAAS,IAAI,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC;KAC3E,CAAC;IAEF,MAAM,SAAS,GAAG,MAAM,cAAc,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAE5D,MAAM,QAAQ,GAAG,IAAI,eAAe,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAC1D,IAAI,CAAC;QACH,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;QACvD,OAAO,EAAE,SAAS,EAAE,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AAC"}
@@ -7,40 +7,50 @@ vi.mock("../services/account-resolution.js", () => ({
7
7
  vi.mock("../services/launcher.js", () => ({
8
8
  LauncherService: vi.fn(),
9
9
  }));
10
+ vi.mock("../cdp/index.js", () => ({
11
+ discoverTargets: vi.fn(),
12
+ }));
13
+ vi.mock("../services/instance.js", () => ({
14
+ InstanceService: vi.fn(),
15
+ }));
16
+ import { discoverTargets } from "../cdp/index.js";
10
17
  import { resolveAccount } from "../services/account-resolution.js";
18
+ import { InstanceService } from "../services/instance.js";
11
19
  import { LauncherService } from "../services/launcher.js";
12
20
  import { getErrors } from "./get-errors.js";
13
21
  describe("getErrors", () => {
14
22
  beforeEach(() => {
15
23
  vi.clearAllMocks();
24
+ // Default: no instance targets
25
+ vi.mocked(discoverTargets).mockResolvedValue([]);
16
26
  });
17
27
  afterEach(() => {
18
28
  vi.restoreAllMocks();
19
29
  });
20
- it("returns healthy status when no issues or popups", async () => {
21
- vi.mocked(resolveAccount).mockResolvedValue(1);
22
- const health = {
23
- healthy: true,
24
- issues: [],
25
- popup: null,
26
- };
27
- const mockLauncher = {
30
+ function mockLauncher(health) {
31
+ const mock = {
28
32
  connect: vi.fn().mockResolvedValue(undefined),
29
33
  disconnect: vi.fn(),
30
34
  checkUIHealth: vi.fn().mockResolvedValue(health),
31
35
  };
32
36
  vi.mocked(LauncherService).mockImplementation(function () {
33
- return mockLauncher;
37
+ return mock;
34
38
  });
39
+ return mock;
40
+ }
41
+ it("returns healthy status when no issues, popups, or instance popups", async () => {
42
+ vi.mocked(resolveAccount).mockResolvedValue(1);
43
+ mockLauncher({ healthy: true, issues: [], popup: null, instancePopups: [] });
35
44
  const result = await getErrors({ cdpPort: 9222 });
36
45
  expect(result.healthy).toBe(true);
37
46
  expect(result.accountId).toBe(1);
38
47
  expect(result.issues).toEqual([]);
39
48
  expect(result.popup).toBeNull();
49
+ expect(result.instancePopups).toEqual([]);
40
50
  });
41
51
  it("returns blocked status with dialog issues", async () => {
42
52
  vi.mocked(resolveAccount).mockResolvedValue(1);
43
- const health = {
53
+ mockLauncher({
44
54
  healthy: false,
45
55
  issues: [
46
56
  {
@@ -56,14 +66,7 @@ describe("getErrors", () => {
56
66
  },
57
67
  ],
58
68
  popup: null,
59
- };
60
- const mockLauncher = {
61
- connect: vi.fn().mockResolvedValue(undefined),
62
- disconnect: vi.fn(),
63
- checkUIHealth: vi.fn().mockResolvedValue(health),
64
- };
65
- vi.mocked(LauncherService).mockImplementation(function () {
66
- return mockLauncher;
69
+ instancePopups: [],
67
70
  });
68
71
  const result = await getErrors({ cdpPort: 9222 });
69
72
  expect(result.healthy).toBe(false);
@@ -72,18 +75,11 @@ describe("getErrors", () => {
72
75
  });
73
76
  it("returns blocked status with popup overlay", async () => {
74
77
  vi.mocked(resolveAccount).mockResolvedValue(1);
75
- const health = {
78
+ mockLauncher({
76
79
  healthy: false,
77
80
  issues: [],
78
81
  popup: { blocked: true, message: "Network issue", closable: false },
79
- };
80
- const mockLauncher = {
81
- connect: vi.fn().mockResolvedValue(undefined),
82
- disconnect: vi.fn(),
83
- checkUIHealth: vi.fn().mockResolvedValue(health),
84
- };
85
- vi.mocked(LauncherService).mockImplementation(function () {
86
- return mockLauncher;
82
+ instancePopups: [],
87
83
  });
88
84
  const result = await getErrors({ cdpPort: 9222 });
89
85
  expect(result.healthy).toBe(false);
@@ -92,18 +88,7 @@ describe("getErrors", () => {
92
88
  });
93
89
  it("passes connection options to resolveAccount", async () => {
94
90
  vi.mocked(resolveAccount).mockResolvedValue(1);
95
- const mockLauncher = {
96
- connect: vi.fn().mockResolvedValue(undefined),
97
- disconnect: vi.fn(),
98
- checkUIHealth: vi.fn().mockResolvedValue({
99
- healthy: true,
100
- issues: [],
101
- popup: null,
102
- }),
103
- };
104
- vi.mocked(LauncherService).mockImplementation(function () {
105
- return mockLauncher;
106
- });
91
+ mockLauncher({ healthy: true, issues: [], popup: null, instancePopups: [] });
107
92
  await getErrors({
108
93
  cdpPort: 1234,
109
94
  cdpHost: "192.168.1.1",
@@ -116,20 +101,101 @@ describe("getErrors", () => {
116
101
  });
117
102
  it("disconnects launcher even on error", async () => {
118
103
  vi.mocked(resolveAccount).mockResolvedValue(1);
119
- const mockLauncher = {
104
+ const mock = {
120
105
  connect: vi.fn().mockResolvedValue(undefined),
121
106
  disconnect: vi.fn(),
122
107
  checkUIHealth: vi.fn().mockRejectedValue(new Error("CDP failure")),
123
108
  };
124
109
  vi.mocked(LauncherService).mockImplementation(function () {
125
- return mockLauncher;
110
+ return mock;
126
111
  });
127
112
  await expect(getErrors({ cdpPort: 9222 })).rejects.toThrow("CDP failure");
128
- expect(mockLauncher.disconnect).toHaveBeenCalledOnce();
113
+ expect(mock.disconnect).toHaveBeenCalledOnce();
129
114
  });
130
115
  it("propagates resolveAccount errors", async () => {
131
116
  vi.mocked(resolveAccount).mockRejectedValue(new Error("connection refused"));
132
117
  await expect(getErrors({ cdpPort: 9222 })).rejects.toThrow("connection refused");
133
118
  });
119
+ it("includes instance popups when instance is running", async () => {
120
+ vi.mocked(resolveAccount).mockResolvedValue(1);
121
+ mockLauncher({ healthy: true, issues: [], popup: null, instancePopups: [] });
122
+ vi.mocked(discoverTargets).mockResolvedValue([
123
+ { id: "t1", type: "page", title: "LinkedIn", url: "https://www.linkedin.com/feed/", description: "", devtoolsFrontendUrl: "", webSocketDebuggerUrl: "" },
124
+ { id: "t2", type: "page", title: "LH", url: "file:///index.html", description: "", devtoolsFrontendUrl: "", webSocketDebuggerUrl: "" },
125
+ ]);
126
+ const mockInstance = {
127
+ connect: vi.fn().mockResolvedValue(undefined),
128
+ disconnect: vi.fn(),
129
+ getInstancePopups: vi.fn().mockResolvedValue([
130
+ { title: "Failed to initialize UI", description: "AsyncHandlerError", closable: true },
131
+ ]),
132
+ };
133
+ vi.mocked(InstanceService).mockImplementation(function () {
134
+ return mockInstance;
135
+ });
136
+ const result = await getErrors({ cdpPort: 9222 });
137
+ expect(result.instancePopups).toHaveLength(1);
138
+ expect(result.instancePopups[0]?.title).toBe("Failed to initialize UI");
139
+ expect(result.healthy).toBe(false);
140
+ });
141
+ it("marks unhealthy when instance popups are present even if launcher is healthy", async () => {
142
+ vi.mocked(resolveAccount).mockResolvedValue(1);
143
+ mockLauncher({ healthy: true, issues: [], popup: null, instancePopups: [] });
144
+ vi.mocked(discoverTargets).mockResolvedValue([
145
+ { id: "t1", type: "page", title: "LinkedIn", url: "https://www.linkedin.com/feed/", description: "", devtoolsFrontendUrl: "", webSocketDebuggerUrl: "" },
146
+ { id: "t2", type: "page", title: "LH", url: "file:///index.html", description: "", devtoolsFrontendUrl: "", webSocketDebuggerUrl: "" },
147
+ ]);
148
+ const mockInstance = {
149
+ connect: vi.fn().mockResolvedValue(undefined),
150
+ disconnect: vi.fn(),
151
+ getInstancePopups: vi.fn().mockResolvedValue([
152
+ { title: "Error popup", closable: false },
153
+ ]),
154
+ };
155
+ vi.mocked(InstanceService).mockImplementation(function () {
156
+ return mockInstance;
157
+ });
158
+ const result = await getErrors({ cdpPort: 9222 });
159
+ expect(result.healthy).toBe(false);
160
+ expect(result.instancePopups).toHaveLength(1);
161
+ });
162
+ it("returns empty instancePopups when instance is not running", async () => {
163
+ vi.mocked(resolveAccount).mockResolvedValue(1);
164
+ mockLauncher({ healthy: true, issues: [], popup: null, instancePopups: [] });
165
+ // Only launcher target, no instance targets
166
+ vi.mocked(discoverTargets).mockResolvedValue([
167
+ { id: "t1", type: "page", title: "Launcher", url: "file:///launcher.html", description: "", devtoolsFrontendUrl: "", webSocketDebuggerUrl: "" },
168
+ ]);
169
+ const result = await getErrors({ cdpPort: 9222 });
170
+ expect(result.instancePopups).toEqual([]);
171
+ expect(result.healthy).toBe(true);
172
+ });
173
+ it("returns empty instancePopups when target discovery fails", async () => {
174
+ vi.mocked(resolveAccount).mockResolvedValue(1);
175
+ mockLauncher({ healthy: true, issues: [], popup: null, instancePopups: [] });
176
+ vi.mocked(discoverTargets).mockRejectedValue(new Error("connection reset"));
177
+ const result = await getErrors({ cdpPort: 9222 });
178
+ expect(result.instancePopups).toEqual([]);
179
+ expect(result.healthy).toBe(true);
180
+ });
181
+ it("disconnects instance service even when getInstancePopups fails", async () => {
182
+ vi.mocked(resolveAccount).mockResolvedValue(1);
183
+ mockLauncher({ healthy: true, issues: [], popup: null, instancePopups: [] });
184
+ vi.mocked(discoverTargets).mockResolvedValue([
185
+ { id: "t1", type: "page", title: "LinkedIn", url: "https://www.linkedin.com/feed/", description: "", devtoolsFrontendUrl: "", webSocketDebuggerUrl: "" },
186
+ { id: "t2", type: "page", title: "LH", url: "file:///index.html", description: "", devtoolsFrontendUrl: "", webSocketDebuggerUrl: "" },
187
+ ]);
188
+ const mockInstance = {
189
+ connect: vi.fn().mockResolvedValue(undefined),
190
+ disconnect: vi.fn(),
191
+ getInstancePopups: vi.fn().mockRejectedValue(new Error("DOM error")),
192
+ };
193
+ vi.mocked(InstanceService).mockImplementation(function () {
194
+ return mockInstance;
195
+ });
196
+ const result = await getErrors({ cdpPort: 9222 });
197
+ expect(result.instancePopups).toEqual([]);
198
+ expect(mockInstance.disconnect).toHaveBeenCalledOnce();
199
+ });
134
200
  });
135
201
  //# sourceMappingURL=get-errors.test.js.map