@vforsh/argus-watcher 0.1.8 → 0.1.10

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 (249) hide show
  1. package/README.md +5 -1
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/buffer/NetBuffer.d.ts +35 -11
  4. package/dist/buffer/NetBuffer.d.ts.map +1 -1
  5. package/dist/buffer/NetBuffer.js +64 -55
  6. package/dist/buffer/NetBuffer.js.map +1 -1
  7. package/dist/cdp/accessibility.d.ts +12 -1
  8. package/dist/cdp/accessibility.d.ts.map +1 -1
  9. package/dist/cdp/accessibility.js +88 -45
  10. package/dist/cdp/accessibility.js.map +1 -1
  11. package/dist/cdp/auth.d.ts +31 -1
  12. package/dist/cdp/auth.d.ts.map +1 -1
  13. package/dist/cdp/auth.js +299 -10
  14. package/dist/cdp/auth.js.map +1 -1
  15. package/dist/cdp/authState.d.ts +9 -0
  16. package/dist/cdp/authState.d.ts.map +1 -0
  17. package/dist/cdp/authState.js +44 -0
  18. package/dist/cdp/authState.js.map +1 -0
  19. package/dist/cdp/browserCookies.d.ts +8 -0
  20. package/dist/cdp/browserCookies.d.ts.map +1 -0
  21. package/dist/cdp/browserCookies.js +160 -0
  22. package/dist/cdp/browserCookies.js.map +1 -0
  23. package/dist/cdp/dom/fill.d.ts +2 -1
  24. package/dist/cdp/dom/fill.d.ts.map +1 -1
  25. package/dist/cdp/dom/fill.js +7 -7
  26. package/dist/cdp/dom/fill.js.map +1 -1
  27. package/dist/cdp/dom/info.d.ts +4 -2
  28. package/dist/cdp/dom/info.d.ts.map +1 -1
  29. package/dist/cdp/dom/info.js +20 -11
  30. package/dist/cdp/dom/info.js.map +1 -1
  31. package/dist/cdp/dom/selector.d.ts +45 -0
  32. package/dist/cdp/dom/selector.d.ts.map +1 -1
  33. package/dist/cdp/dom/selector.js +130 -25
  34. package/dist/cdp/dom/selector.js.map +1 -1
  35. package/dist/cdp/dom/types.d.ts +1 -0
  36. package/dist/cdp/dom/types.d.ts.map +1 -1
  37. package/dist/cdp/editor.d.ts.map +1 -1
  38. package/dist/cdp/editor.js +55 -3
  39. package/dist/cdp/editor.js.map +1 -1
  40. package/dist/cdp/elementRefs.d.ts +15 -0
  41. package/dist/cdp/elementRefs.d.ts.map +1 -0
  42. package/dist/cdp/elementRefs.js +30 -0
  43. package/dist/cdp/elementRefs.js.map +1 -0
  44. package/dist/cdp/locate.d.ts +7 -0
  45. package/dist/cdp/locate.d.ts.map +1 -0
  46. package/dist/cdp/locate.js +68 -0
  47. package/dist/cdp/locate.js.map +1 -0
  48. package/dist/cdp/mouse.d.ts +8 -7
  49. package/dist/cdp/mouse.d.ts.map +1 -1
  50. package/dist/cdp/mouse.js +42 -49
  51. package/dist/cdp/mouse.js.map +1 -1
  52. package/dist/cdp/networkBody.d.ts +19 -0
  53. package/dist/cdp/networkBody.d.ts.map +1 -0
  54. package/dist/cdp/networkBody.js +70 -0
  55. package/dist/cdp/networkBody.js.map +1 -0
  56. package/dist/cdp/networkCapture.d.ts +4 -0
  57. package/dist/cdp/networkCapture.d.ts.map +1 -1
  58. package/dist/cdp/networkCapture.js +307 -35
  59. package/dist/cdp/networkCapture.js.map +1 -1
  60. package/dist/cdp/pageIndicator.d.ts +1 -1
  61. package/dist/cdp/pageIndicator.d.ts.map +1 -1
  62. package/dist/cdp/redaction.d.ts +4 -0
  63. package/dist/cdp/redaction.d.ts.map +1 -1
  64. package/dist/cdp/redaction.js +37 -1
  65. package/dist/cdp/redaction.js.map +1 -1
  66. package/dist/cdp/screenshot.d.ts +1 -0
  67. package/dist/cdp/screenshot.d.ts.map +1 -1
  68. package/dist/cdp/screenshot.js +66 -15
  69. package/dist/cdp/screenshot.js.map +1 -1
  70. package/dist/cdp/storage.d.ts +8 -0
  71. package/dist/cdp/storage.d.ts.map +1 -0
  72. package/dist/cdp/storage.js +70 -0
  73. package/dist/cdp/storage.js.map +1 -0
  74. package/dist/cdp/watcher.d.ts +4 -21
  75. package/dist/cdp/watcher.d.ts.map +1 -1
  76. package/dist/cdp/watcher.js +7 -279
  77. package/dist/cdp/watcher.js.map +1 -1
  78. package/dist/cdp/watcherEvents.d.ts +18 -0
  79. package/dist/cdp/watcherEvents.d.ts.map +1 -0
  80. package/dist/cdp/watcherEvents.js +169 -0
  81. package/dist/cdp/watcherEvents.js.map +1 -0
  82. package/dist/cdp/watcherTargets.d.ts +18 -0
  83. package/dist/cdp/watcherTargets.d.ts.map +1 -0
  84. package/dist/cdp/watcherTargets.js +95 -0
  85. package/dist/cdp/watcherTargets.js.map +1 -0
  86. package/dist/dialogs/DialogTracker.d.ts +13 -0
  87. package/dist/dialogs/DialogTracker.d.ts.map +1 -0
  88. package/dist/dialogs/DialogTracker.js +22 -0
  89. package/dist/dialogs/DialogTracker.js.map +1 -0
  90. package/dist/events.d.ts +7 -2
  91. package/dist/events.d.ts.map +1 -1
  92. package/dist/http/router.d.ts.map +1 -1
  93. package/dist/http/router.js +3 -77
  94. package/dist/http/router.js.map +1 -1
  95. package/dist/http/routes/authCookies.d.ts +11 -0
  96. package/dist/http/routes/authCookies.d.ts.map +1 -0
  97. package/dist/http/routes/authCookies.js +142 -0
  98. package/dist/http/routes/authCookies.js.map +1 -0
  99. package/dist/http/routes/domSelectorRoute.d.ts +8 -0
  100. package/dist/http/routes/domSelectorRoute.d.ts.map +1 -1
  101. package/dist/http/routes/domSelectorRoute.js +28 -3
  102. package/dist/http/routes/domSelectorRoute.js.map +1 -1
  103. package/dist/http/routes/getAuthState.d.ts +3 -0
  104. package/dist/http/routes/getAuthState.d.ts.map +1 -0
  105. package/dist/http/routes/getAuthState.js +24 -0
  106. package/dist/http/routes/getAuthState.js.map +1 -0
  107. package/dist/http/routes/getDialog.d.ts +3 -0
  108. package/dist/http/routes/getDialog.d.ts.map +1 -0
  109. package/dist/http/routes/getDialog.js +11 -0
  110. package/dist/http/routes/getDialog.js.map +1 -0
  111. package/dist/http/routes/getNet.d.ts.map +1 -1
  112. package/dist/http/routes/getNet.js +14 -8
  113. package/dist/http/routes/getNet.js.map +1 -1
  114. package/dist/http/routes/getNetRequest.d.ts +3 -0
  115. package/dist/http/routes/getNetRequest.d.ts.map +1 -0
  116. package/dist/http/routes/getNetRequest.js +23 -0
  117. package/dist/http/routes/getNetRequest.js.map +1 -0
  118. package/dist/http/routes/getNetRequestBody.d.ts +3 -0
  119. package/dist/http/routes/getNetRequestBody.d.ts.map +1 -0
  120. package/dist/http/routes/getNetRequestBody.js +80 -0
  121. package/dist/http/routes/getNetRequestBody.js.map +1 -0
  122. package/dist/http/routes/getNetRequests.d.ts +3 -0
  123. package/dist/http/routes/getNetRequests.d.ts.map +1 -0
  124. package/dist/http/routes/getNetRequests.js +23 -0
  125. package/dist/http/routes/getNetRequests.js.map +1 -0
  126. package/dist/http/routes/getNetTail.d.ts.map +1 -1
  127. package/dist/http/routes/getNetTail.js +44 -9
  128. package/dist/http/routes/getNetTail.js.map +1 -1
  129. package/dist/http/routes/getStatus.js +1 -0
  130. package/dist/http/routes/getStatus.js.map +1 -1
  131. package/dist/http/routes/index.d.ts +9 -0
  132. package/dist/http/routes/index.d.ts.map +1 -0
  133. package/dist/http/routes/index.js +105 -0
  134. package/dist/http/routes/index.js.map +1 -0
  135. package/dist/http/routes/netFilters.d.ts +29 -0
  136. package/dist/http/routes/netFilters.d.ts.map +1 -0
  137. package/dist/http/routes/netFilters.js +160 -0
  138. package/dist/http/routes/netFilters.js.map +1 -0
  139. package/dist/http/routes/netRequestLookup.d.ts +14 -0
  140. package/dist/http/routes/netRequestLookup.d.ts.map +1 -0
  141. package/dist/http/routes/netRequestLookup.js +39 -0
  142. package/dist/http/routes/netRequestLookup.js.map +1 -0
  143. package/dist/http/routes/postAuthStateLoad.d.ts +3 -0
  144. package/dist/http/routes/postAuthStateLoad.d.ts.map +1 -0
  145. package/dist/http/routes/postAuthStateLoad.js +37 -0
  146. package/dist/http/routes/postAuthStateLoad.js.map +1 -0
  147. package/dist/http/routes/postDialog.d.ts +3 -0
  148. package/dist/http/routes/postDialog.d.ts.map +1 -0
  149. package/dist/http/routes/postDialog.js +39 -0
  150. package/dist/http/routes/postDialog.js.map +1 -0
  151. package/dist/http/routes/postDomClick.d.ts.map +1 -1
  152. package/dist/http/routes/postDomClick.js +39 -27
  153. package/dist/http/routes/postDomClick.js.map +1 -1
  154. package/dist/http/routes/postDomFill.d.ts.map +1 -1
  155. package/dist/http/routes/postDomFill.js +23 -27
  156. package/dist/http/routes/postDomFill.js.map +1 -1
  157. package/dist/http/routes/postDomFocus.d.ts.map +1 -1
  158. package/dist/http/routes/postDomFocus.js +22 -9
  159. package/dist/http/routes/postDomFocus.js.map +1 -1
  160. package/dist/http/routes/postDomHover.d.ts.map +1 -1
  161. package/dist/http/routes/postDomHover.js +22 -9
  162. package/dist/http/routes/postDomHover.js.map +1 -1
  163. package/dist/http/routes/postDomInfo.d.ts.map +1 -1
  164. package/dist/http/routes/postDomInfo.js +7 -3
  165. package/dist/http/routes/postDomInfo.js.map +1 -1
  166. package/dist/http/routes/postDomScroll.d.ts.map +1 -1
  167. package/dist/http/routes/postDomScroll.js +3 -8
  168. package/dist/http/routes/postDomScroll.js.map +1 -1
  169. package/dist/http/routes/postDomScrollTo.d.ts.map +1 -1
  170. package/dist/http/routes/postDomScrollTo.js +3 -8
  171. package/dist/http/routes/postDomScrollTo.js.map +1 -1
  172. package/dist/http/routes/postDomSetFile.d.ts.map +1 -1
  173. package/dist/http/routes/postDomSetFile.js +9 -23
  174. package/dist/http/routes/postDomSetFile.js.map +1 -1
  175. package/dist/http/routes/postLocate.d.ts +5 -0
  176. package/dist/http/routes/postLocate.d.ts.map +1 -0
  177. package/dist/http/routes/postLocate.js +67 -0
  178. package/dist/http/routes/postLocate.js.map +1 -0
  179. package/dist/http/routes/postNetClear.d.ts +3 -0
  180. package/dist/http/routes/postNetClear.d.ts.map +1 -0
  181. package/dist/http/routes/postNetClear.js +14 -0
  182. package/dist/http/routes/postNetClear.js.map +1 -0
  183. package/dist/http/routes/postSnapshot.d.ts.map +1 -1
  184. package/dist/http/routes/postSnapshot.js +1 -1
  185. package/dist/http/routes/postSnapshot.js.map +1 -1
  186. package/dist/http/routes/postStorageLocal.d.ts +1 -2
  187. package/dist/http/routes/postStorageLocal.d.ts.map +1 -1
  188. package/dist/http/routes/postStorageLocal.js +2 -30
  189. package/dist/http/routes/postStorageLocal.js.map +1 -1
  190. package/dist/http/routes/postStorageSession.d.ts +2 -0
  191. package/dist/http/routes/postStorageSession.d.ts.map +1 -0
  192. package/dist/http/routes/postStorageSession.js +3 -0
  193. package/dist/http/routes/postStorageSession.js.map +1 -0
  194. package/dist/http/routes/storage.d.ts +5 -0
  195. package/dist/http/routes/storage.d.ts.map +1 -0
  196. package/dist/http/routes/storage.js +43 -0
  197. package/dist/http/routes/storage.js.map +1 -0
  198. package/dist/http/server.d.ts +27 -3
  199. package/dist/http/server.d.ts.map +1 -1
  200. package/dist/http/server.js.map +1 -1
  201. package/dist/native-messaging/session-manager.d.ts +14 -1
  202. package/dist/native-messaging/session-manager.d.ts.map +1 -1
  203. package/dist/native-messaging/session-manager.js +56 -23
  204. package/dist/native-messaging/session-manager.js.map +1 -1
  205. package/dist/native-messaging/types.d.ts +28 -2
  206. package/dist/native-messaging/types.d.ts.map +1 -1
  207. package/dist/net/filtering.d.ts +32 -0
  208. package/dist/net/filtering.d.ts.map +1 -0
  209. package/dist/net/filtering.js +144 -0
  210. package/dist/net/filtering.js.map +1 -0
  211. package/dist/runtime/watcherInject.d.ts +15 -0
  212. package/dist/runtime/watcherInject.d.ts.map +1 -0
  213. package/dist/runtime/watcherInject.js +21 -0
  214. package/dist/runtime/watcherInject.js.map +1 -0
  215. package/dist/runtime/watcherServices.d.ts +32 -0
  216. package/dist/runtime/watcherServices.d.ts.map +1 -0
  217. package/dist/runtime/watcherServices.js +68 -0
  218. package/dist/runtime/watcherServices.js.map +1 -0
  219. package/dist/runtime/watcherSetup.d.ts +35 -0
  220. package/dist/runtime/watcherSetup.d.ts.map +1 -0
  221. package/dist/runtime/watcherSetup.js +96 -0
  222. package/dist/runtime/watcherSetup.js.map +1 -0
  223. package/dist/sources/cdp-source.d.ts.map +1 -1
  224. package/dist/sources/cdp-source.js +13 -0
  225. package/dist/sources/cdp-source.js.map +1 -1
  226. package/dist/sources/extension-frame-runtime.d.ts +11 -0
  227. package/dist/sources/extension-frame-runtime.d.ts.map +1 -0
  228. package/dist/sources/extension-frame-runtime.js +150 -0
  229. package/dist/sources/extension-frame-runtime.js.map +1 -0
  230. package/dist/sources/extension-frame-state.d.ts +3 -2
  231. package/dist/sources/extension-frame-state.d.ts.map +1 -1
  232. package/dist/sources/extension-frame-state.js +29 -8
  233. package/dist/sources/extension-frame-state.js.map +1 -1
  234. package/dist/sources/extension-session-events.d.ts.map +1 -1
  235. package/dist/sources/extension-session-events.js +4 -2
  236. package/dist/sources/extension-session-events.js.map +1 -1
  237. package/dist/sources/extension-source.d.ts.map +1 -1
  238. package/dist/sources/extension-source.js +134 -140
  239. package/dist/sources/extension-source.js.map +1 -1
  240. package/dist/sources/types.d.ts +15 -1
  241. package/dist/sources/types.d.ts.map +1 -1
  242. package/dist/startWatcherRuntime.d.ts.map +1 -1
  243. package/dist/startWatcherRuntime.js +78 -177
  244. package/dist/startWatcherRuntime.js.map +1 -1
  245. package/package.json +1 -1
  246. package/dist/cdp/storageLocal.d.ts +0 -8
  247. package/dist/cdp/storageLocal.d.ts.map +0 -1
  248. package/dist/cdp/storageLocal.js +0 -70
  249. package/dist/cdp/storageLocal.js.map +0 -1
@@ -0,0 +1,18 @@
1
+ import type { LogEvent } from '@vforsh/argus-core';
2
+ import type { IgnoreMatcher } from './ignoreList.js';
3
+ import type { CdpSessionHandle } from './connection.js';
4
+ import type { CdpTarget } from './watcherTargets.js';
5
+ export type PageIntlInfo = {
6
+ timezone: string | null;
7
+ locale: string | null;
8
+ };
9
+ type WatcherEventConfig = {
10
+ ignoreMatcher?: IgnoreMatcher | null;
11
+ stripUrlPrefixes?: string[];
12
+ cdp?: CdpSessionHandle;
13
+ };
14
+ export declare const toConsoleEvent: (params: unknown, target: CdpTarget, config: WatcherEventConfig) => Promise<Omit<LogEvent, "id">>;
15
+ export declare const toExceptionEvent: (params: unknown, target: CdpTarget, config: WatcherEventConfig) => Promise<Omit<LogEvent, "id">>;
16
+ export declare const fetchPageIntl: (session: CdpSessionHandle) => Promise<PageIntlInfo | null>;
17
+ export {};
18
+ //# sourceMappingURL=watcherEvents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watcherEvents.d.ts","sourceRoot":"","sources":["../../src/cdp/watcherEvents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAY,MAAM,oBAAoB,CAAA;AAE5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAKpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAEvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAEpD,MAAM,MAAM,YAAY,GAAG;IAC1B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB,CAAA;AAED,KAAK,kBAAkB,GAAG;IACzB,aAAa,CAAC,EAAE,aAAa,GAAG,IAAI,CAAA;IACpC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B,GAAG,CAAC,EAAE,gBAAgB,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,cAAc,GAAU,QAAQ,OAAO,EAAE,QAAQ,SAAS,EAAE,QAAQ,kBAAkB,KAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CA8BjI,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAU,QAAQ,OAAO,EAAE,QAAQ,SAAS,EAAE,QAAQ,kBAAkB,KAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAmCnI,CAAA;AAED,eAAO,MAAM,aAAa,GAAU,SAAS,gBAAgB,KAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAmB1F,CAAA"}
@@ -0,0 +1,169 @@
1
+ import { previewStringify } from '@vforsh/argus-core';
2
+ import { stripUrlPrefixes } from './locationCleanup.js';
3
+ import { selectBestFrame } from './selectBestFrame.js';
4
+ import { resolveSourcemappedLocation } from '../sourcemaps/resolveLocation.js';
5
+ import { serializeRemoteObject, serializeRemoteObjects } from './remoteObject.js';
6
+ export const toConsoleEvent = async (params, target, config) => {
7
+ const record = params;
8
+ const cdp = config.cdp;
9
+ const runtimeClient = cdp ? { sendAndWait: (method, params) => cdp.sendAndWait(method, params) } : undefined;
10
+ const args = Array.isArray(record.args) ? await serializeRemoteObjects(record.args, runtimeClient) : [];
11
+ const text = formatArgs(args);
12
+ const baseEvent = {
13
+ ts: Date.now(),
14
+ level: normalizeLevel(record.type ?? 'log'),
15
+ text,
16
+ args,
17
+ file: null,
18
+ line: null,
19
+ column: null,
20
+ pageUrl: target.url ?? null,
21
+ pageTitle: target.title ?? null,
22
+ source: 'console',
23
+ };
24
+ const selected = await selectLocationFromFrames(record.stackTrace?.callFrames, config.ignoreMatcher ?? null);
25
+ if (selected) {
26
+ return applyLocationCleanup({ ...baseEvent, ...selected }, config.stripUrlPrefixes);
27
+ }
28
+ const fallback = await applySourcemap(applyFirstFrame(baseEvent, record.stackTrace?.callFrames));
29
+ return applyLocationCleanup(fallback, config.stripUrlPrefixes);
30
+ };
31
+ export const toExceptionEvent = async (params, target, config) => {
32
+ const record = params;
33
+ const details = record.exceptionDetails;
34
+ const cdp = config.cdp;
35
+ const runtimeClient = cdp ? { sendAndWait: (method, params) => cdp.sendAndWait(method, params) } : undefined;
36
+ const exceptionValue = details?.exception ? await serializeRemoteObject(details.exception, runtimeClient) : null;
37
+ const args = exceptionValue != null ? [exceptionValue] : [];
38
+ const exceptionDescription = describeExceptionValue(exceptionValue);
39
+ const text = formatExceptionText(details?.text, exceptionDescription);
40
+ const baseEvent = {
41
+ ts: Date.now(),
42
+ level: 'exception',
43
+ text,
44
+ args,
45
+ file: null,
46
+ line: null,
47
+ column: null,
48
+ pageUrl: target.url ?? null,
49
+ pageTitle: target.title ?? null,
50
+ source: 'exception',
51
+ };
52
+ const selected = await selectLocationFromFrames(details?.stackTrace?.callFrames, config.ignoreMatcher ?? null);
53
+ if (selected) {
54
+ return applyLocationCleanup({ ...baseEvent, ...selected }, config.stripUrlPrefixes);
55
+ }
56
+ const fallback = await applySourcemap(applyFirstFrame(baseEvent, details?.stackTrace?.callFrames));
57
+ return applyLocationCleanup(fallback, config.stripUrlPrefixes);
58
+ };
59
+ export const fetchPageIntl = async (session) => {
60
+ try {
61
+ const result = await session.sendAndWait('Runtime.evaluate', {
62
+ expression: '(() => { const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone ?? null; const locale = navigator.language ?? null; return { timezone, locale }; })()',
63
+ returnByValue: true,
64
+ });
65
+ const payload = result;
66
+ const value = payload.result?.value;
67
+ if (!value || typeof value !== 'object') {
68
+ return null;
69
+ }
70
+ const record = value;
71
+ const timezone = typeof record.timezone === 'string' && record.timezone.trim() !== '' ? record.timezone : null;
72
+ const locale = typeof record.locale === 'string' && record.locale.trim() !== '' ? record.locale : null;
73
+ return { timezone, locale };
74
+ }
75
+ catch {
76
+ return null;
77
+ }
78
+ };
79
+ const applySourcemap = async (event) => {
80
+ if (!event.file || event.line == null || event.column == null) {
81
+ return event;
82
+ }
83
+ try {
84
+ const resolved = await resolveSourcemappedLocation({
85
+ file: event.file,
86
+ line: event.line,
87
+ column: event.column,
88
+ });
89
+ if (!resolved) {
90
+ return event;
91
+ }
92
+ return {
93
+ ...event,
94
+ file: resolved.file,
95
+ line: resolved.line,
96
+ column: resolved.column,
97
+ };
98
+ }
99
+ catch {
100
+ return event;
101
+ }
102
+ };
103
+ const selectLocationFromFrames = async (callFrames, ignoreMatcher) => {
104
+ if (!ignoreMatcher) {
105
+ return null;
106
+ }
107
+ return selectBestFrame(callFrames, ignoreMatcher);
108
+ };
109
+ const applyFirstFrame = (event, callFrames) => {
110
+ const frame = callFrames?.[0];
111
+ const file = frame?.url ?? null;
112
+ const line = frame?.lineNumber != null ? frame.lineNumber + 1 : null;
113
+ const column = frame?.columnNumber != null ? frame.columnNumber + 1 : null;
114
+ return { ...event, file, line, column };
115
+ };
116
+ const applyLocationCleanup = (event, prefixes) => {
117
+ if (!event.file) {
118
+ return event;
119
+ }
120
+ const cleaned = stripUrlPrefixes(event.file, prefixes);
121
+ if (cleaned === event.file) {
122
+ return event;
123
+ }
124
+ return { ...event, file: cleaned };
125
+ };
126
+ const describeExceptionValue = (value) => {
127
+ if (value == null) {
128
+ return null;
129
+ }
130
+ if (typeof value === 'string') {
131
+ return value;
132
+ }
133
+ try {
134
+ return JSON.stringify(value);
135
+ }
136
+ catch {
137
+ return String(value);
138
+ }
139
+ };
140
+ const formatExceptionText = (baseText, description) => {
141
+ const trimmed = baseText?.trim();
142
+ if (!trimmed) {
143
+ return description ?? 'Exception';
144
+ }
145
+ if (!description) {
146
+ return trimmed;
147
+ }
148
+ const isGeneric = trimmed === 'Uncaught' || trimmed === 'Uncaught (in promise)';
149
+ if (isGeneric && !trimmed.includes(description)) {
150
+ return `${trimmed}: ${description}`;
151
+ }
152
+ return trimmed;
153
+ };
154
+ const normalizeLevel = (level) => {
155
+ if (level === 'warn' || level === 'warning') {
156
+ return 'warning';
157
+ }
158
+ if (level === 'error' || level === 'info' || level === 'debug' || level === 'exception' || level === 'log') {
159
+ return level;
160
+ }
161
+ return 'log';
162
+ };
163
+ const formatArgs = (args) => {
164
+ if (args.length === 0) {
165
+ return '';
166
+ }
167
+ return args.map((arg) => previewStringify(arg)).join(' ');
168
+ };
169
+ //# sourceMappingURL=watcherEvents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watcherEvents.js","sourceRoot":"","sources":["../../src/cdp/watcherEvents.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBA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,CAAC,CAAA;AAED,MAAM,UAAU,GAAG,CAAC,IAAe,EAAU,EAAE;IAC9C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,EAAE,CAAA;IACV,CAAC;IAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1D,CAAC,CAAA"}
@@ -0,0 +1,18 @@
1
+ import type { WatcherChrome, WatcherMatch } from '@vforsh/argus-core';
2
+ /** Minimal CDP target metadata needed for attachment. */
3
+ export type CdpTarget = {
4
+ /** CDP target id (from Chrome `/json` endpoint). */
5
+ id: string;
6
+ /** Human-readable page title for the target. */
7
+ title: string;
8
+ /** Page URL for the target. */
9
+ url: string;
10
+ /** WebSocket URL used to connect to the target via the Chrome DevTools Protocol. */
11
+ webSocketDebuggerUrl: string;
12
+ /** Target type (e.g., 'page', 'iframe', 'worker', 'service_worker'). */
13
+ type: string;
14
+ /** Parent target ID for nested targets (e.g., iframes within pages). Null for top-level pages. */
15
+ parentId: string | null;
16
+ };
17
+ export declare const findTarget: (chrome: WatcherChrome, match?: WatcherMatch) => Promise<CdpTarget>;
18
+ //# sourceMappingURL=watcherTargets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watcherTargets.d.ts","sourceRoot":"","sources":["../../src/cdp/watcherTargets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAErE,yDAAyD;AACzD,MAAM,MAAM,SAAS,GAAG;IACvB,oDAAoD;IACpD,EAAE,EAAE,MAAM,CAAA;IAEV,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAA;IAEb,+BAA+B;IAC/B,GAAG,EAAE,MAAM,CAAA;IAEX,oFAAoF;IACpF,oBAAoB,EAAE,MAAM,CAAA;IAE5B,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAA;IAEZ,kGAAkG;IAClG,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,UAAU,GAAU,QAAQ,aAAa,EAAE,QAAQ,YAAY,KAAG,OAAO,CAAC,SAAS,CA6B/F,CAAA"}
@@ -0,0 +1,95 @@
1
+ export const findTarget = async (chrome, match) => {
2
+ const targets = await fetchTargets(chrome);
3
+ if (targets.length === 0) {
4
+ throw new Error('No CDP targets available');
5
+ }
6
+ if (match?.targetId) {
7
+ const selected = targets.find((target) => target.id === match.targetId);
8
+ if (!selected) {
9
+ throw new Error(`No CDP target found with id: ${match.targetId}`);
10
+ }
11
+ return selected;
12
+ }
13
+ const hasFilters = match?.url || match?.title || match?.urlRegex || match?.titleRegex || match?.type || match?.origin || match?.parent;
14
+ if (!match || !hasFilters) {
15
+ return targets[0];
16
+ }
17
+ const urlRegex = match.urlRegex ? safeRegex(match.urlRegex) : null;
18
+ const titleRegex = match.titleRegex ? safeRegex(match.titleRegex) : null;
19
+ const targetById = new Map(targets.map((target) => [target.id, target]));
20
+ const selected = targets.find((target) => matchesTarget(target, match, targetById, urlRegex, titleRegex));
21
+ if (!selected) {
22
+ throw new Error('No CDP target matched the provided criteria');
23
+ }
24
+ return selected;
25
+ };
26
+ const matchesTarget = (target, match, targetById, urlRegex, titleRegex) => {
27
+ if (match.type && target.type !== match.type) {
28
+ return false;
29
+ }
30
+ if (match.origin) {
31
+ const targetOrigin = extractOrigin(target.url);
32
+ if (!targetOrigin || !targetOrigin.includes(match.origin)) {
33
+ return false;
34
+ }
35
+ }
36
+ if (match.parent) {
37
+ if (!target.parentId) {
38
+ return false;
39
+ }
40
+ const parent = targetById.get(target.parentId);
41
+ if (!parent || !parent.url.includes(match.parent)) {
42
+ return false;
43
+ }
44
+ }
45
+ if (match.url && !target.url.includes(match.url)) {
46
+ return false;
47
+ }
48
+ if (match.title && !target.title.includes(match.title)) {
49
+ return false;
50
+ }
51
+ if (urlRegex && !urlRegex.test(target.url)) {
52
+ return false;
53
+ }
54
+ if (titleRegex && !titleRegex.test(target.title)) {
55
+ return false;
56
+ }
57
+ return true;
58
+ };
59
+ const fetchTargets = async (chrome) => {
60
+ const response = await fetch(`http://${chrome.host}:${chrome.port}/json`);
61
+ if (!response.ok) {
62
+ throw new Error(`Failed to fetch CDP targets (status ${response.status})`);
63
+ }
64
+ const data = await response.json();
65
+ if (!Array.isArray(data)) {
66
+ throw new Error('CDP target list is not an array');
67
+ }
68
+ return data
69
+ .map((target) => ({
70
+ id: target.id,
71
+ title: String(target.title ?? ''),
72
+ url: String(target.url ?? ''),
73
+ webSocketDebuggerUrl: String(target.webSocketDebuggerUrl ?? ''),
74
+ type: String(target.type ?? 'page'),
75
+ parentId: typeof target.parentId === 'string' ? target.parentId : null,
76
+ }))
77
+ .filter((target) => Boolean(target.webSocketDebuggerUrl));
78
+ };
79
+ const extractOrigin = (url) => {
80
+ try {
81
+ return new URL(url).origin;
82
+ }
83
+ catch {
84
+ return null;
85
+ }
86
+ };
87
+ const safeRegex = (pattern) => {
88
+ try {
89
+ return new RegExp(pattern);
90
+ }
91
+ catch {
92
+ throw new Error(`Invalid regex pattern: ${pattern}`);
93
+ }
94
+ };
95
+ //# sourceMappingURL=watcherTargets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watcherTargets.js","sourceRoot":"","sources":["../../src/cdp/watcherTargets.ts"],"names":[],"mappings":"AAuBA,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,EAAE,MAAqB,EAAE,KAAoB,EAAsB,EAAE;IACnG,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,CAAA;IAC1C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;IAC5C,CAAC;IAED,IAAI,KAAK,EAAE,QAAQ,EAAE,CAAC;QACrB,MAAM,QAAQ,GAAG,O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,CAAC,IAAI;KACtE,CAAC,CAAC;SACF,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,CAAA;AAC3D,CAAC,CAAA;AAED,MAAM,aAAa,GAAG,CAAC,GAAW,EAAiB,EAAE;IACpD,IAAI,CAAC;QACJ,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,CAAA;IAC3B,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,IAAI,CAAA;IACZ,CAAC;AACF,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,CAAC,OAAe,EAAU,EAAE;IAC7C,IAAI,CAAC;QACJ,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,CAAA;IAC3B,CAAC;IAAC,MAAM,CAAC;QACR,MAAM,IAAI,KAAK,CAAC,0BAA0B,OAAO,EAAE,CAAC,CAAA;IACrD,CAAC;AACF,CAAC,CAAA"}
@@ -0,0 +1,13 @@
1
+ import type { DialogStatus } from '@vforsh/argus-core';
2
+ /**
3
+ * Keeps the watcher’s current JavaScript dialog state in one place.
4
+ * Chrome only allows one active dialog per page, so a single-slot tracker is enough.
5
+ */
6
+ export declare class DialogTracker {
7
+ private activeDialog;
8
+ open(dialog: DialogStatus): void;
9
+ close(): DialogStatus | null;
10
+ clear(): void;
11
+ getActive(): DialogStatus | null;
12
+ }
13
+ //# sourceMappingURL=DialogTracker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DialogTracker.d.ts","sourceRoot":"","sources":["../../src/dialogs/DialogTracker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD;;;GAGG;AACH,qBAAa,aAAa;IACzB,OAAO,CAAC,YAAY,CAA4B;IAEhD,IAAI,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;IAIhC,KAAK,IAAI,YAAY,GAAG,IAAI;IAM5B,KAAK,IAAI,IAAI;IAIb,SAAS,IAAI,YAAY,GAAG,IAAI;CAGhC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Keeps the watcher’s current JavaScript dialog state in one place.
3
+ * Chrome only allows one active dialog per page, so a single-slot tracker is enough.
4
+ */
5
+ export class DialogTracker {
6
+ activeDialog = null;
7
+ open(dialog) {
8
+ this.activeDialog = { ...dialog };
9
+ }
10
+ close() {
11
+ const current = this.activeDialog;
12
+ this.activeDialog = null;
13
+ return current ? { ...current } : null;
14
+ }
15
+ clear() {
16
+ this.activeDialog = null;
17
+ }
18
+ getActive() {
19
+ return this.activeDialog ? { ...this.activeDialog } : null;
20
+ }
21
+ }
22
+ //# sourceMappingURL=DialogTracker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DialogTracker.js","sourceRoot":"","sources":["../../src/dialogs/DialogTracker.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,OAAO,aAAa;IACjB,YAAY,GAAwB,IAAI,CAAA;IAEhD,IAAI,CAAC,MAAoB;QACxB,IAAI,CAAC,YAAY,GAAG,EAAE,GAAG,MAAM,EAAE,CAAA;IAClC,CAAC;IAED,KAAK;QACJ,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,CAAA;QACjC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAA;QACxB,OAAO,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;IACvC,CAAC;IAED,KAAK;QACJ,IAAI,CAAC,YAAY,GAAG,IAAI,CAAA;IACzB,CAAC;IAED,SAAS;QACR,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;IAC3D,CAAC;CACD"}
package/dist/events.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { LogLevel } from '@vforsh/argus-core';
1
+ import type { LogLevel, NetRequestBodyPart } from '@vforsh/argus-core';
2
2
  /**
3
3
  * Event payload for when the watcher attaches to a CDP target.
4
4
  */
@@ -54,11 +54,16 @@ export type LogRequestQuery = {
54
54
  * Query parameters for network/tail requests.
55
55
  */
56
56
  export type NetRequestQuery = {
57
+ id?: number;
58
+ requestId?: string;
59
+ part?: NetRequestBodyPart;
57
60
  after?: number;
58
61
  limit?: number;
59
62
  sinceTs?: number;
60
63
  timeoutMs?: number;
61
64
  grep?: string;
65
+ ignoreHosts?: string[];
66
+ ignorePatterns?: string[];
62
67
  origin?: string;
63
68
  domain?: string;
64
69
  includeValues?: boolean;
@@ -72,7 +77,7 @@ export type HttpRequestEvent = {
72
77
  /** Unique watcher identifier. */
73
78
  watcherId: string;
74
79
  /** The requested endpoint. */
75
- endpoint: 'logs' | 'tail' | 'net' | 'net/tail' | 'auth/cookies' | 'eval' | 'trace/start' | 'trace/stop' | 'screenshot' | 'snapshot' | 'code/list' | 'code/read' | 'code/grep' | 'dom/tree' | 'dom/info' | 'dom/hover' | 'dom/click' | 'dom/keydown' | 'dom/add' | 'dom/remove' | 'dom/modify' | 'dom/set-file' | 'dom/focus' | 'dom/fill' | 'dom/scroll' | 'dom/scroll-to' | 'emulation' | 'throttle' | 'storage/local' | 'reload' | 'shutdown' | 'targets' | 'attach' | 'detach';
80
+ endpoint: 'logs' | 'tail' | 'net' | 'net/requests' | 'net/request' | 'net/request/body' | 'net/tail' | 'net/clear' | 'auth/cookies' | 'auth/cookies/get' | 'auth/cookies/set' | 'auth/cookies/delete' | 'auth/cookies/clear' | 'auth/state' | 'auth/state/load' | 'eval' | 'trace/start' | 'trace/stop' | 'screenshot' | 'snapshot' | 'locate/role' | 'locate/text' | 'locate/label' | 'code/list' | 'code/read' | 'code/grep' | 'dom/tree' | 'dom/info' | 'dom/hover' | 'dom/click' | 'dom/keydown' | 'dom/add' | 'dom/remove' | 'dom/modify' | 'dom/set-file' | 'dom/focus' | 'dom/fill' | 'dom/scroll' | 'dom/scroll-to' | 'emulation' | 'throttle' | 'dialog/status' | 'dialog/handle' | 'storage/local' | 'storage/session' | 'reload' | 'shutdown' | 'targets' | 'attach' | 'detach';
76
81
  /** IP address of the requester (best-effort). */
77
82
  remoteAddress: string | null;
78
83
  /** Parsed query parameters. */
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAElD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC9B,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAA;IACV,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAA;IACjB,2BAA2B;IAC3B,MAAM,EAAE;QACP,gDAAgD;QAChD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;QACpB,+BAA+B;QAC/B,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;QAClB,sDAAsD;QACtD,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;QACnB,qFAAqF;QACrF,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;KACvB,GAAG,IAAI,CAAA;CACR,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC9B,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAA;IACV,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAA;IACjB,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAA;IACd,sCAAsC;IACtC,MAAM,EAAE;QACP,gDAAgD;QAChD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;QACpB,+BAA+B;QAC/B,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;KAClB,GAAG,IAAI,CAAA;CACR,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAA;IACnB,KAAK,C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AW,GACX,aAAa,GACb,SAAS,GACT,YAAY,GACZ,YAAY,GACZ,cAAc,GACd,WAAW,GACX,UAAU,GACV,YAAY,GACZ,eAAe,GACf,WAAW,GACX,UAAU,GACV,eAAe,GACf,eAAe,GACf,eAAe,GACf,iBAAiB,GACjB,QAAQ,GACR,UAAU,GACV,SAAS,GACT,QAAQ,GACR,QAAQ,CAAA;IACX,iDAAiD;IACjD,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,+BAA+B;IAC/B,KAAK,CAAC,EAAE,eAAe,GAAG,eAAe,CAAA;CACzC,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAClC,WAAW,EAAE,gBAAgB,CAAA;IAC7B,WAAW,EAAE,gBAAgB,CAAA;IAC7B,aAAa,EAAE,gBAAgB,CAAA;CAC/B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/http/router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,EAAgB,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAmFnE,kFAAkF;AAClF,eAAO,MAAM,QAAQ,GAAI,KAAK,IAAI,CAAC,eAAe,EAAE,KAAK,IAAI,CAAC,cAAc,EAAE,KAAK,GAAG,EAAE,KAAK,YAAY,KAAG,IAO3G,CAAA"}
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/http/router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAMrD,kFAAkF;AAClF,eAAO,MAAM,QAAQ,GAAI,KAAK,IAAI,CAAC,eAAe,EAAE,KAAK,IAAI,CAAC,cAAc,EAAE,KAAK,GAAG,EAAE,KAAK,YAAY,KAAG,IAO3G,CAAA"}
@@ -1,83 +1,9 @@
1
1
  import { respondJson } from './httpUtils.js';
2
- import { handle as getStatus } from './routes/getStatus.js';
3
- import { handle as getLogs } from './routes/getLogs.js';
4
- import { handle as getTail } from './routes/getTail.js';
5
- import { handle as getNet } from './routes/getNet.js';
6
- import { handle as getNetTail } from './routes/getNetTail.js';
7
- import { handle as getAuthCookies } from './routes/getAuthCookies.js';
8
- import { handle as postEval } from './routes/postEval.js';
9
- import { handle as postTraceStart } from './routes/postTraceStart.js';
10
- import { handle as postTraceStop } from './routes/postTraceStop.js';
11
- import { handle as postScreenshot } from './routes/postScreenshot.js';
12
- import { handle as postSnapshot } from './routes/postSnapshot.js';
13
- import { handle as postCodeList } from './routes/postCodeList.js';
14
- import { handle as postCodeRead } from './routes/postCodeRead.js';
15
- import { handle as postCodeGrep } from './routes/postCodeGrep.js';
16
- import { handle as postDomTree } from './routes/postDomTree.js';
17
- import { handle as postDomInfo } from './routes/postDomInfo.js';
18
- import { handle as postDomHover } from './routes/postDomHover.js';
19
- import { handle as postDomClick } from './routes/postDomClick.js';
20
- import { handle as postDomKeydown } from './routes/postDomKeydown.js';
21
- import { handle as postDomAdd } from './routes/postDomAdd.js';
22
- import { handle as postDomRemove } from './routes/postDomRemove.js';
23
- import { handle as postDomModify } from './routes/postDomModify.js';
24
- import { handle as postDomSetFile } from './routes/postDomSetFile.js';
25
- import { handle as postDomFocus } from './routes/postDomFocus.js';
26
- import { handle as postDomFill } from './routes/postDomFill.js';
27
- import { handle as postDomScroll } from './routes/postDomScroll.js';
28
- import { handle as postDomScrollTo } from './routes/postDomScrollTo.js';
29
- import { handle as getEmulation } from './routes/getEmulation.js';
30
- import { handle as postEmulation } from './routes/postEmulation.js';
31
- import { handle as getThrottle } from './routes/getThrottle.js';
32
- import { handle as postThrottle } from './routes/postThrottle.js';
33
- import { handle as postStorageLocal } from './routes/postStorageLocal.js';
34
- import { handle as postReload } from './routes/postReload.js';
35
- import { handle as postShutdown } from './routes/postShutdown.js';
36
- import { handle as getTargets } from './routes/getTargets.js';
37
- import { handle as postAttach } from './routes/postAttach.js';
38
- import { handle as postDetach } from './routes/postDetach.js';
39
- const routes = {
40
- 'GET /status': { handler: getStatus },
41
- 'GET /logs': { handler: getLogs },
42
- 'GET /tail': { handler: getTail },
43
- 'GET /net': { handler: getNet },
44
- 'GET /net/tail': { handler: getNetTail },
45
- 'GET /auth/cookies': { handler: getAuthCookies },
46
- 'POST /eval': { handler: postEval },
47
- 'POST /trace/start': { handler: postTraceStart },
48
- 'POST /trace/stop': { handler: postTraceStop },
49
- 'POST /screenshot': { handler: postScreenshot },
50
- 'POST /snapshot': { handler: postSnapshot },
51
- 'POST /code/list': { handler: postCodeList },
52
- 'POST /code/read': { handler: postCodeRead },
53
- 'POST /code/grep': { handler: postCodeGrep },
54
- 'POST /dom/tree': { handler: postDomTree },
55
- 'POST /dom/info': { handler: postDomInfo },
56
- 'POST /dom/hover': { handler: postDomHover },
57
- 'POST /dom/click': { handler: postDomClick },
58
- 'POST /dom/keydown': { handler: postDomKeydown },
59
- 'POST /dom/add': { handler: postDomAdd },
60
- 'POST /dom/remove': { handler: postDomRemove },
61
- 'POST /dom/modify': { handler: postDomModify },
62
- 'POST /dom/set-file': { handler: postDomSetFile },
63
- 'POST /dom/focus': { handler: postDomFocus },
64
- 'POST /dom/fill': { handler: postDomFill },
65
- 'POST /dom/scroll': { handler: postDomScroll },
66
- 'POST /dom/scroll-to': { handler: postDomScrollTo },
67
- 'GET /emulation': { handler: getEmulation },
68
- 'POST /emulation': { handler: postEmulation },
69
- 'GET /throttle': { handler: getThrottle },
70
- 'POST /throttle': { handler: postThrottle },
71
- 'POST /storage/local': { handler: postStorageLocal },
72
- 'POST /reload': { handler: postReload },
73
- 'POST /shutdown': { handler: postShutdown },
74
- 'GET /targets': { handler: getTargets, extensionOnly: true },
75
- 'POST /attach': { handler: postAttach, extensionOnly: true },
76
- 'POST /detach': { handler: postDetach, extensionOnly: true },
77
- };
2
+ import { watcherRoutes } from './routes/index.js';
3
+ const routes = new Map(watcherRoutes.map((route) => [`${route.method} ${route.path}`, route]));
78
4
  /** Dispatch an incoming request to the matching route handler, or respond 404. */
79
5
  export const dispatch = (req, res, url, ctx) => {
80
- const entry = routes[`${req.method} ${url.pathname}`];
6
+ const entry = routes.get(`${req.method} ${url.pathname}`);
81
7
  if (!entry || (entry.extensionOnly && !ctx.sourceHandle)) {
82
8
  respondJson(res, { ok: false, error: { message: 'Not found', code: 'not_found' } }, 404);
83
9
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"router.js","sourceRoot":"","sources":["../../src/http/router.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,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E,GAAG,CAAC,CAAA;QACxF,OAAM;IACP,CAAC;IACD,KAAK,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;AACvC,CAAC,CAAA"}
@@ -0,0 +1,11 @@
1
+ import { type AuthCookieClearRequest, type AuthCookieDeleteRequest, type AuthCookieGetRequest, type AuthCookieSetRequest } from '@vforsh/argus-core';
2
+ import type { RouteHandler } from './types.js';
3
+ export declare const validateCookieGetPayload: (payload: AuthCookieGetRequest) => string | null;
4
+ export declare const validateCookieDeletePayload: (payload: AuthCookieDeleteRequest) => string | null;
5
+ export declare const validateCookieSetPayload: (payload: AuthCookieSetRequest) => string | null;
6
+ export declare const validateCookieClearPayload: (payload: AuthCookieClearRequest) => string | null;
7
+ export declare const handleCookieGet: RouteHandler;
8
+ export declare const handleCookieSet: RouteHandler;
9
+ export declare const handleCookieDelete: RouteHandler;
10
+ export declare const handleCookieClear: RouteHandler;
11
+ //# sourceMappingURL=authCookies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authCookies.d.ts","sourceRoot":"","sources":["../../../src/http/routes/authCookies.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,sBAAsB,EAG3B,KAAK,uBAAuB,EAE5B,KAAK,oBAAoB,EAEzB,KAAK,oBAAoB,EAEzB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAgB,YAAY,EAAE,MAAM,YAAY,CAAA;AAO5D,eAAO,MAAM,wBAAwB,GAAI,SAAS,oBAAoB,KAAG,MAAM,GAAG,IAWjF,CAAA;AAED,eAAO,MAAM,2BAA2B,GAAI,SAAS,uBAAuB,KAAG,MAAM,GAAG,IAA8C,CAAA;AAEtI,eAAO,MAAM,wBAAwB,GAAI,SAAS,oBAAoB,KAAG,MAAM,GAAG,IA0CjF,CAAA;AAED,eAAO,MAAM,0BAA0B,GAAI,SAAS,sBAAsB,KAAG,MAAM,GAAG,IAkBrF,CAAA;AA8CD,eAAO,MAAM,eAAe,cAQ1B,CAAA;AAEF,eAAO,MAAM,eAAe,cAQ1B,CAAA;AAEF,eAAO,MAAM,kBAAkB,cAQ7B,CAAA;AAEF,eAAO,MAAM,iBAAiB,cAQ5B,CAAA"}