@vforsh/argus-watcher 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -14
- package/dist/.tsbuildinfo +1 -1
- package/dist/artifacts.d.ts +13 -0
- package/dist/artifacts.d.ts.map +1 -0
- package/dist/artifacts.js +27 -0
- package/dist/artifacts.js.map +1 -0
- package/dist/buffer/LogBuffer.d.ts +8 -3
- package/dist/buffer/LogBuffer.d.ts.map +1 -1
- package/dist/buffer/LogBuffer.js +9 -1
- package/dist/buffer/LogBuffer.js.map +1 -1
- package/dist/buffer/NetBuffer.d.ts +29 -0
- package/dist/buffer/NetBuffer.d.ts.map +1 -0
- package/dist/buffer/NetBuffer.js +85 -0
- package/dist/buffer/NetBuffer.js.map +1 -0
- package/dist/cdp/accessibility.d.ts +18 -0
- package/dist/cdp/accessibility.d.ts.map +1 -0
- package/dist/cdp/accessibility.js +300 -0
- package/dist/cdp/accessibility.js.map +1 -0
- package/dist/cdp/connection.d.ts +24 -0
- package/dist/cdp/connection.d.ts.map +1 -0
- package/dist/cdp/connection.js +131 -0
- package/dist/cdp/connection.js.map +1 -0
- package/dist/cdp/dom/fill.d.ts +22 -0
- package/dist/cdp/dom/fill.d.ts.map +1 -0
- package/dist/cdp/dom/fill.js +59 -0
- package/dist/cdp/dom/fill.js.map +1 -0
- package/dist/cdp/dom/info.d.ts +14 -0
- package/dist/cdp/dom/info.d.ts.map +1 -0
- package/dist/cdp/dom/info.js +52 -0
- package/dist/cdp/dom/info.js.map +1 -0
- package/dist/cdp/dom/insert.d.ts +19 -0
- package/dist/cdp/dom/insert.d.ts.map +1 -0
- package/dist/cdp/dom/insert.js +30 -0
- package/dist/cdp/dom/insert.js.map +1 -0
- package/dist/cdp/dom/modify.d.ts +50 -0
- package/dist/cdp/dom/modify.d.ts.map +1 -0
- package/dist/cdp/dom/modify.js +100 -0
- package/dist/cdp/dom/modify.js.map +1 -0
- package/dist/cdp/dom/remove.d.ts +17 -0
- package/dist/cdp/dom/remove.d.ts.map +1 -0
- package/dist/cdp/dom/remove.js +27 -0
- package/dist/cdp/dom/remove.js.map +1 -0
- package/dist/cdp/dom/selector.d.ts +19 -0
- package/dist/cdp/dom/selector.d.ts.map +1 -0
- package/dist/cdp/dom/selector.js +64 -0
- package/dist/cdp/dom/selector.js.map +1 -0
- package/dist/cdp/dom/setFile.d.ts +21 -0
- package/dist/cdp/dom/setFile.d.ts.map +1 -0
- package/dist/cdp/dom/setFile.js +82 -0
- package/dist/cdp/dom/setFile.js.map +1 -0
- package/dist/cdp/dom/submit.d.ts +15 -0
- package/dist/cdp/dom/submit.d.ts.map +1 -0
- package/dist/cdp/dom/submit.js +130 -0
- package/dist/cdp/dom/submit.js.map +1 -0
- package/dist/cdp/dom/tree.d.ts +16 -0
- package/dist/cdp/dom/tree.d.ts.map +1 -0
- package/dist/cdp/dom/tree.js +100 -0
- package/dist/cdp/dom/tree.js.map +1 -0
- package/dist/cdp/dom/types.d.ts +16 -0
- package/dist/cdp/dom/types.d.ts.map +1 -0
- package/dist/cdp/dom/types.js +2 -0
- package/dist/cdp/dom/types.js.map +1 -0
- package/dist/cdp/dom.d.ts +17 -0
- package/dist/cdp/dom.d.ts.map +1 -0
- package/dist/cdp/dom.js +10 -0
- package/dist/cdp/dom.js.map +1 -0
- package/dist/cdp/emulation.d.ts +16 -0
- package/dist/cdp/emulation.d.ts.map +1 -0
- package/dist/cdp/emulation.js +40 -0
- package/dist/cdp/emulation.js.map +1 -0
- package/dist/cdp/eval.d.ts +10 -0
- package/dist/cdp/eval.d.ts.map +1 -0
- package/dist/cdp/eval.js +34 -0
- package/dist/cdp/eval.js.map +1 -0
- package/dist/cdp/keyboard.d.ts +38 -0
- package/dist/cdp/keyboard.d.ts.map +1 -0
- package/dist/cdp/keyboard.js +148 -0
- package/dist/cdp/keyboard.js.map +1 -0
- package/dist/cdp/mouse.d.ts +49 -0
- package/dist/cdp/mouse.d.ts.map +1 -0
- package/dist/cdp/mouse.js +199 -0
- package/dist/cdp/mouse.js.map +1 -0
- package/dist/cdp/networkCapture.d.ts +11 -0
- package/dist/cdp/networkCapture.d.ts.map +1 -0
- package/dist/cdp/networkCapture.js +99 -0
- package/dist/cdp/networkCapture.js.map +1 -0
- package/dist/cdp/pageIndicator.d.ts +41 -0
- package/dist/cdp/pageIndicator.d.ts.map +1 -0
- package/dist/cdp/pageIndicator.js +395 -0
- package/dist/cdp/pageIndicator.js.map +1 -0
- package/dist/cdp/redaction.d.ts +3 -0
- package/dist/cdp/redaction.d.ts.map +1 -0
- package/dist/cdp/redaction.js +35 -0
- package/dist/cdp/redaction.js.map +1 -0
- package/dist/cdp/remoteObject.d.ts +6 -0
- package/dist/cdp/remoteObject.d.ts.map +1 -0
- package/dist/cdp/remoteObject.js +94 -0
- package/dist/cdp/remoteObject.js.map +1 -0
- package/dist/cdp/screenshot.d.ts +10 -0
- package/dist/cdp/screenshot.d.ts.map +1 -0
- package/dist/cdp/screenshot.js +87 -0
- package/dist/cdp/screenshot.js.map +1 -0
- package/dist/cdp/storageLocal.d.ts +8 -0
- package/dist/cdp/storageLocal.d.ts.map +1 -0
- package/dist/cdp/storageLocal.js +70 -0
- package/dist/cdp/storageLocal.js.map +1 -0
- package/dist/cdp/text-filter.d.ts +19 -0
- package/dist/cdp/text-filter.d.ts.map +1 -0
- package/dist/cdp/text-filter.js +54 -0
- package/dist/cdp/text-filter.js.map +1 -0
- package/dist/cdp/throttle.d.ts +6 -0
- package/dist/cdp/throttle.d.ts.map +1 -0
- package/dist/cdp/throttle.js +9 -0
- package/dist/cdp/throttle.js.map +1 -0
- package/dist/cdp/tracing.d.ts +14 -0
- package/dist/cdp/tracing.d.ts.map +1 -0
- package/dist/cdp/tracing.js +115 -0
- package/dist/cdp/tracing.js.map +1 -0
- package/dist/cdp/watcher.d.ts +17 -2
- package/dist/cdp/watcher.d.ts.map +1 -1
- package/dist/cdp/watcher.js +124 -175
- package/dist/cdp/watcher.js.map +1 -1
- package/dist/emulation/EmulationController.d.ts +12 -0
- package/dist/emulation/EmulationController.d.ts.map +1 -0
- package/dist/emulation/EmulationController.js +83 -0
- package/dist/emulation/EmulationController.js.map +1 -0
- package/dist/events.d.ts +86 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +2 -0
- package/dist/events.js.map +1 -0
- package/dist/fileLogs/WatcherFileLogger.d.ts +5 -2
- package/dist/fileLogs/WatcherFileLogger.d.ts.map +1 -1
- package/dist/fileLogs/WatcherFileLogger.js +30 -12
- package/dist/fileLogs/WatcherFileLogger.js.map +1 -1
- package/dist/http/httpUtils.d.ts +25 -0
- package/dist/http/httpUtils.d.ts.map +1 -0
- package/dist/http/httpUtils.js +170 -0
- package/dist/http/httpUtils.js.map +1 -0
- package/dist/http/router.d.ts +5 -0
- package/dist/http/router.d.ts.map +1 -0
- package/dist/http/router.js +81 -0
- package/dist/http/router.js.map +1 -0
- package/dist/http/routes/getEmulation.d.ts +3 -0
- package/dist/http/routes/getEmulation.d.ts.map +1 -0
- package/dist/http/routes/getEmulation.js +8 -0
- package/dist/http/routes/getEmulation.js.map +1 -0
- package/dist/http/routes/getLogs.d.ts +3 -0
- package/dist/http/routes/getLogs.d.ts.map +1 -0
- package/dist/http/routes/getLogs.js +28 -0
- package/dist/http/routes/getLogs.js.map +1 -0
- package/dist/http/routes/getNet.d.ts +3 -0
- package/dist/http/routes/getNet.d.ts.map +1 -0
- package/dist/http/routes/getNet.js +17 -0
- package/dist/http/routes/getNet.js.map +1 -0
- package/dist/http/routes/getNetTail.d.ts +3 -0
- package/dist/http/routes/getNetTail.d.ts.map +1 -0
- package/dist/http/routes/getNetTail.js +18 -0
- package/dist/http/routes/getNetTail.js.map +1 -0
- package/dist/http/routes/getStatus.d.ts +3 -0
- package/dist/http/routes/getStatus.d.ts.map +1 -0
- package/dist/http/routes/getStatus.js +21 -0
- package/dist/http/routes/getStatus.js.map +1 -0
- package/dist/http/routes/getTail.d.ts +3 -0
- package/dist/http/routes/getTail.d.ts.map +1 -0
- package/dist/http/routes/getTail.js +28 -0
- package/dist/http/routes/getTail.js.map +1 -0
- package/dist/http/routes/getTargets.d.ts +3 -0
- package/dist/http/routes/getTargets.d.ts.map +1 -0
- package/dist/http/routes/getTargets.js +16 -0
- package/dist/http/routes/getTargets.js.map +1 -0
- package/dist/http/routes/getThrottle.d.ts +3 -0
- package/dist/http/routes/getThrottle.d.ts.map +1 -0
- package/dist/http/routes/getThrottle.js +8 -0
- package/dist/http/routes/getThrottle.js.map +1 -0
- package/dist/http/routes/postAttach.d.ts +3 -0
- package/dist/http/routes/postAttach.d.ts.map +1 -0
- package/dist/http/routes/postAttach.js +23 -0
- package/dist/http/routes/postAttach.js.map +1 -0
- package/dist/http/routes/postDetach.d.ts +3 -0
- package/dist/http/routes/postDetach.d.ts.map +1 -0
- package/dist/http/routes/postDetach.js +23 -0
- package/dist/http/routes/postDetach.js.map +1 -0
- package/dist/http/routes/postDomAdd.d.ts +7 -0
- package/dist/http/routes/postDomAdd.d.ts.map +1 -0
- package/dist/http/routes/postDomAdd.js +97 -0
- package/dist/http/routes/postDomAdd.js.map +1 -0
- package/dist/http/routes/postDomClick.d.ts +3 -0
- package/dist/http/routes/postDomClick.d.ts.map +1 -0
- package/dist/http/routes/postDomClick.js +85 -0
- package/dist/http/routes/postDomClick.js.map +1 -0
- package/dist/http/routes/postDomFill.d.ts +3 -0
- package/dist/http/routes/postDomFill.d.ts.map +1 -0
- package/dist/http/routes/postDomFill.js +58 -0
- package/dist/http/routes/postDomFill.js.map +1 -0
- package/dist/http/routes/postDomFocus.d.ts +3 -0
- package/dist/http/routes/postDomFocus.d.ts.map +1 -0
- package/dist/http/routes/postDomFocus.js +40 -0
- package/dist/http/routes/postDomFocus.js.map +1 -0
- package/dist/http/routes/postDomHover.d.ts +3 -0
- package/dist/http/routes/postDomHover.d.ts.map +1 -0
- package/dist/http/routes/postDomHover.js +40 -0
- package/dist/http/routes/postDomHover.js.map +1 -0
- package/dist/http/routes/postDomInfo.d.ts +3 -0
- package/dist/http/routes/postDomInfo.d.ts.map +1 -0
- package/dist/http/routes/postDomInfo.js +40 -0
- package/dist/http/routes/postDomInfo.js.map +1 -0
- package/dist/http/routes/postDomKeydown.d.ts +3 -0
- package/dist/http/routes/postDomKeydown.d.ts.map +1 -0
- package/dist/http/routes/postDomKeydown.js +36 -0
- package/dist/http/routes/postDomKeydown.js.map +1 -0
- package/dist/http/routes/postDomModify.d.ts +3 -0
- package/dist/http/routes/postDomModify.d.ts.map +1 -0
- package/dist/http/routes/postDomModify.js +45 -0
- package/dist/http/routes/postDomModify.js.map +1 -0
- package/dist/http/routes/postDomRemove.d.ts +3 -0
- package/dist/http/routes/postDomRemove.d.ts.map +1 -0
- package/dist/http/routes/postDomRemove.js +39 -0
- package/dist/http/routes/postDomRemove.js.map +1 -0
- package/dist/http/routes/postDomScroll.d.ts +3 -0
- package/dist/http/routes/postDomScroll.d.ts.map +1 -0
- package/dist/http/routes/postDomScroll.js +75 -0
- package/dist/http/routes/postDomScroll.js.map +1 -0
- package/dist/http/routes/postDomScrollTo.d.ts +3 -0
- package/dist/http/routes/postDomScrollTo.d.ts.map +1 -0
- package/dist/http/routes/postDomScrollTo.js +69 -0
- package/dist/http/routes/postDomScrollTo.js.map +1 -0
- package/dist/http/routes/postDomSetFile.d.ts +3 -0
- package/dist/http/routes/postDomSetFile.d.ts.map +1 -0
- package/dist/http/routes/postDomSetFile.js +67 -0
- package/dist/http/routes/postDomSetFile.js.map +1 -0
- package/dist/http/routes/postDomSubmit.d.ts +3 -0
- package/dist/http/routes/postDomSubmit.d.ts.map +1 -0
- package/dist/http/routes/postDomSubmit.js +49 -0
- package/dist/http/routes/postDomSubmit.js.map +1 -0
- package/dist/http/routes/postDomTree.d.ts +3 -0
- package/dist/http/routes/postDomTree.d.ts.map +1 -0
- package/dist/http/routes/postDomTree.js +41 -0
- package/dist/http/routes/postDomTree.js.map +1 -0
- package/dist/http/routes/postEmulation.d.ts +3 -0
- package/dist/http/routes/postEmulation.d.ts.map +1 -0
- package/dist/http/routes/postEmulation.js +70 -0
- package/dist/http/routes/postEmulation.js.map +1 -0
- package/dist/http/routes/postEval.d.ts +3 -0
- package/dist/http/routes/postEval.d.ts.map +1 -0
- package/dist/http/routes/postEval.js +26 -0
- package/dist/http/routes/postEval.js.map +1 -0
- package/dist/http/routes/postReload.d.ts +3 -0
- package/dist/http/routes/postReload.d.ts.map +1 -0
- package/dist/http/routes/postReload.js +20 -0
- package/dist/http/routes/postReload.js.map +1 -0
- package/dist/http/routes/postScreenshot.d.ts +3 -0
- package/dist/http/routes/postScreenshot.d.ts.map +1 -0
- package/dist/http/routes/postScreenshot.js +17 -0
- package/dist/http/routes/postScreenshot.js.map +1 -0
- package/dist/http/routes/postShutdown.d.ts +3 -0
- package/dist/http/routes/postShutdown.d.ts.map +1 -0
- package/dist/http/routes/postShutdown.js +13 -0
- package/dist/http/routes/postShutdown.js.map +1 -0
- package/dist/http/routes/postSnapshot.d.ts +3 -0
- package/dist/http/routes/postSnapshot.d.ts.map +1 -0
- package/dist/http/routes/postSnapshot.js +28 -0
- package/dist/http/routes/postSnapshot.js.map +1 -0
- package/dist/http/routes/postStorageLocal.d.ts +3 -0
- package/dist/http/routes/postStorageLocal.d.ts.map +1 -0
- package/dist/http/routes/postStorageLocal.js +31 -0
- package/dist/http/routes/postStorageLocal.js.map +1 -0
- package/dist/http/routes/postThrottle.d.ts +3 -0
- package/dist/http/routes/postThrottle.d.ts.map +1 -0
- package/dist/http/routes/postThrottle.js +38 -0
- package/dist/http/routes/postThrottle.js.map +1 -0
- package/dist/http/routes/postTraceStart.d.ts +3 -0
- package/dist/http/routes/postTraceStart.d.ts.map +1 -0
- package/dist/http/routes/postTraceStart.js +17 -0
- package/dist/http/routes/postTraceStart.js.map +1 -0
- package/dist/http/routes/postTraceStop.d.ts +3 -0
- package/dist/http/routes/postTraceStop.d.ts.map +1 -0
- package/dist/http/routes/postTraceStop.js +17 -0
- package/dist/http/routes/postTraceStop.js.map +1 -0
- package/dist/http/routes/types.d.ts +9 -0
- package/dist/http/routes/types.d.ts.map +1 -0
- package/dist/http/routes/types.js +10 -0
- package/dist/http/routes/types.js.map +1 -0
- package/dist/http/server.d.ts +40 -1
- package/dist/http/server.d.ts.map +1 -1
- package/dist/http/server.js +3 -82
- package/dist/http/server.js.map +1 -1
- package/dist/index.d.ts +117 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +330 -44
- package/dist/index.js.map +1 -1
- package/dist/native-messaging/messaging.d.ts +18 -0
- package/dist/native-messaging/messaging.d.ts.map +1 -0
- package/dist/native-messaging/messaging.js +94 -0
- package/dist/native-messaging/messaging.js.map +1 -0
- package/dist/native-messaging/session-manager.d.ts +105 -0
- package/dist/native-messaging/session-manager.d.ts.map +1 -0
- package/dist/native-messaging/session-manager.js +259 -0
- package/dist/native-messaging/session-manager.js.map +1 -0
- package/dist/native-messaging/types.d.ts +79 -0
- package/dist/native-messaging/types.d.ts.map +1 -0
- package/dist/native-messaging/types.js +6 -0
- package/dist/native-messaging/types.js.map +1 -0
- package/dist/registry/registry.d.ts +9 -2
- package/dist/registry/registry.d.ts.map +1 -1
- package/dist/registry/registry.js +53 -9
- package/dist/registry/registry.js.map +1 -1
- package/dist/scripts/install-host.d.ts +10 -0
- package/dist/scripts/install-host.d.ts.map +1 -0
- package/dist/scripts/install-host.js +189 -0
- package/dist/scripts/install-host.js.map +1 -0
- package/dist/sources/cdp-source.d.ts +24 -0
- package/dist/sources/cdp-source.d.ts.map +1 -0
- package/dist/sources/cdp-source.js +48 -0
- package/dist/sources/cdp-source.js.map +1 -0
- package/dist/sources/extension-source.d.ts +15 -0
- package/dist/sources/extension-source.d.ts.map +1 -0
- package/dist/sources/extension-source.js +256 -0
- package/dist/sources/extension-source.js.map +1 -0
- package/dist/sources/types.d.ts +92 -0
- package/dist/sources/types.d.ts.map +1 -0
- package/dist/sources/types.js +7 -0
- package/dist/sources/types.js.map +1 -0
- package/dist/throttle/ThrottleController.d.ts +12 -0
- package/dist/throttle/ThrottleController.d.ts.map +1 -0
- package/dist/throttle/ThrottleController.js +67 -0
- package/dist/throttle/ThrottleController.js.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { emitRequest } from './types.js';
|
|
2
|
+
import { submitElements } from '../../cdp/dom.js';
|
|
3
|
+
import { respondJson, respondInvalidBody, respondError, readJsonBody } from '../httpUtils.js';
|
|
4
|
+
export const handle = async (req, res, _url, ctx) => {
|
|
5
|
+
const payload = await readJsonBody(req, res);
|
|
6
|
+
if (!payload) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (!payload.selector || typeof payload.selector !== 'string') {
|
|
10
|
+
return respondInvalidBody(res, 'selector is required');
|
|
11
|
+
}
|
|
12
|
+
const all = payload.all ?? false;
|
|
13
|
+
if (typeof all !== 'boolean') {
|
|
14
|
+
return respondInvalidBody(res, 'all must be a boolean');
|
|
15
|
+
}
|
|
16
|
+
const waitMs = payload.wait ?? 0;
|
|
17
|
+
if (typeof waitMs !== 'number' || !Number.isFinite(waitMs) || waitMs < 0) {
|
|
18
|
+
return respondInvalidBody(res, 'wait must be a non-negative number (ms)');
|
|
19
|
+
}
|
|
20
|
+
const strategy = payload.strategy ?? 'auto';
|
|
21
|
+
if (strategy !== 'auto' && strategy !== 'form' && strategy !== 'self') {
|
|
22
|
+
return respondInvalidBody(res, 'strategy must be one of: auto, form, self');
|
|
23
|
+
}
|
|
24
|
+
emitRequest(ctx, res, 'dom/submit');
|
|
25
|
+
try {
|
|
26
|
+
const { allNodeIds, submittedCount } = await submitElements(ctx.cdpSession, {
|
|
27
|
+
selector: payload.selector,
|
|
28
|
+
all,
|
|
29
|
+
text: payload.text,
|
|
30
|
+
wait: waitMs,
|
|
31
|
+
strategy,
|
|
32
|
+
});
|
|
33
|
+
if (!all && allNodeIds.length > 1) {
|
|
34
|
+
return respondJson(res, {
|
|
35
|
+
ok: false,
|
|
36
|
+
error: {
|
|
37
|
+
message: `Selector matched ${allNodeIds.length} elements; pass all=true to submit all matches`,
|
|
38
|
+
code: 'multiple_matches',
|
|
39
|
+
},
|
|
40
|
+
}, 400);
|
|
41
|
+
}
|
|
42
|
+
const response = { ok: true, matches: allNodeIds.length, submitted: submittedCount };
|
|
43
|
+
respondJson(res, response);
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
respondError(res, error);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=postDomSubmit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postDomSubmit.js","sourceRoot":"","sources":["../../../src/http/routes/postDomSubmit.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE7F,MAAM,CAAC,MAAM,MAAM,GAAiB,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;IACjE,MAAM,OAAO,GAAG,MAAM,YAAY,CAAmB,GAAG,EAAE,GAAG,CAAC,CAAA;IAC9D,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,OAAM;IACP,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC/D,OAAO,kBAAkB,CAAC,GAAG,EAAE,sBAAsB,CAAC,CAAA;IACvD,CAAC;IAED,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,KAAK,CAAA;IAChC,IAAI,OAAO,GAAG,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,kBAAkB,CAAC,GAAG,EAAE,uBAAuB,CAAC,CAAA;IACxD,CAAC;IAED,MAAM,MAAM,GAAG,OA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C,OAAO,KAAK,EAAE,CAAC;QAChB,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IACzB,CAAC;AACF,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postDomTree.d.ts","sourceRoot":"","sources":["../../../src/http/routes/postDomTree.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAK9C,eAAO,MAAM,MAAM,EAAE,YA6CpB,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { emitRequest } from './types.js';
|
|
2
|
+
import { fetchDomSubtreeBySelector } from '../../cdp/dom.js';
|
|
3
|
+
import { respondJson, respondInvalidBody, respondError, readJsonBody } from '../httpUtils.js';
|
|
4
|
+
export const handle = async (req, res, _url, ctx) => {
|
|
5
|
+
const payload = await readJsonBody(req, res);
|
|
6
|
+
if (!payload) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (!payload.selector || typeof payload.selector !== 'string') {
|
|
10
|
+
return respondInvalidBody(res, 'selector is required');
|
|
11
|
+
}
|
|
12
|
+
const all = payload.all ?? false;
|
|
13
|
+
if (typeof all !== 'boolean') {
|
|
14
|
+
return respondInvalidBody(res, 'all must be a boolean');
|
|
15
|
+
}
|
|
16
|
+
emitRequest(ctx, res, 'dom/tree');
|
|
17
|
+
try {
|
|
18
|
+
const response = await fetchDomSubtreeBySelector(ctx.cdpSession, {
|
|
19
|
+
selector: payload.selector,
|
|
20
|
+
depth: payload.depth,
|
|
21
|
+
maxNodes: payload.maxNodes,
|
|
22
|
+
all,
|
|
23
|
+
text: payload.text,
|
|
24
|
+
});
|
|
25
|
+
// Enforce "single match" policy server-side when all=false
|
|
26
|
+
if (!all && response.matches > 1) {
|
|
27
|
+
return respondJson(res, {
|
|
28
|
+
ok: false,
|
|
29
|
+
error: {
|
|
30
|
+
message: `Selector matched ${response.matches} elements; pass all=true to return all matches`,
|
|
31
|
+
code: 'multiple_matches',
|
|
32
|
+
},
|
|
33
|
+
}, 400);
|
|
34
|
+
}
|
|
35
|
+
respondJson(res, response);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
respondError(res, error);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=postDomTree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postDomTree.js","sourceRoot":"","sources":["../../../src/http/routes/postDomTree.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE7F,MAAM,CAAC,MAAM,MAAM,GAAiB,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;IACjE,MAAM,OAAO,GAAG,MAAM,YAAY,CAAiB,GAAG,EAAE,GAAG,CAAC,CAAA;IAC5D,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,OAAM;IACP,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC/D,OAAO,kBAAkB,CAAC,GAAG,EAAE,sBAAsB,CAAC,CAAA;IACvD,CAAC;IAED,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,KAAK,CAAA;IAChC,IAAI,OAAO,GAAG,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,kBAAkB,CAAC,GAAG,EAAE,uBAAuB,CAAC,CAAA;IACxD,CAAC;IAED,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,UAAU,CAAC,CAAA;IAEjC,IAAI,CAAC;QACJ,MAAM,QAAQ,GAAoB,MAAM,yBAAyB,CAAC,GAAG,CAAC,UAAU,EAAE;YACjF,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,GAAG;YACH,IAAI,EAAE,OAAO,CAAC,IAAI;SAClB,CAAC,CAAA;QAEF,2DAA2D;QAC3D,IAAI,CAAC,GAAG,IAAI,QAAQ,CAAC,OAAO,GAAG,CAAC,EAAE,CAAC;YAClC,OAAO,WAAW,CACjB,GAAG,EACH;gBACC,EAAE,EAAE,KAAK;gBACT,KAAK,EAAE;oBACN,OAAO,EAAE,oBAAoB,QAAQ,CAAC,OAAO,gDAAgD;oBAC7F,IAAI,EAAE,kBAAkB;iBACxB;aACD,EACD,GAAG,CACH,CAAA;QACF,CAAC;QAED,WAAW,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IACzB,CAAC;AACF,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postEmulation.d.ts","sourceRoot":"","sources":["../../../src/http/routes/postEmulation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAI9C,eAAO,MAAM,MAAM,EAAE,YAyEpB,CAAA"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { emitRequest } from './types.js';
|
|
2
|
+
import { respondJson, respondInvalidBody, respondError, readJsonBody } from '../httpUtils.js';
|
|
3
|
+
export const handle = async (req, res, _url, ctx) => {
|
|
4
|
+
const payload = await readJsonBody(req, res);
|
|
5
|
+
if (!payload) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
const validActions = ['set', 'clear'];
|
|
9
|
+
const action = payload.action;
|
|
10
|
+
if (!action || !validActions.includes(action)) {
|
|
11
|
+
return respondInvalidBody(res, `action must be one of: ${validActions.join(', ')}`);
|
|
12
|
+
}
|
|
13
|
+
emitRequest(ctx, res, 'emulation');
|
|
14
|
+
if (action === 'clear') {
|
|
15
|
+
try {
|
|
16
|
+
const session = ctx.cdpSession.isAttached() ? ctx.cdpSession : null;
|
|
17
|
+
const response = await ctx.emulationController.clearDesired(session);
|
|
18
|
+
respondJson(res, response);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
respondError(res, error);
|
|
22
|
+
}
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
// action === 'set'
|
|
26
|
+
const setPayload = payload;
|
|
27
|
+
if (!setPayload.state || typeof setPayload.state !== 'object') {
|
|
28
|
+
return respondInvalidBody(res, 'state is required for set action');
|
|
29
|
+
}
|
|
30
|
+
const state = setPayload.state;
|
|
31
|
+
// Validate viewport if present
|
|
32
|
+
if (state.viewport != null) {
|
|
33
|
+
const vp = state.viewport;
|
|
34
|
+
if (!Number.isInteger(vp.width) || vp.width <= 0) {
|
|
35
|
+
return respondInvalidBody(res, 'viewport.width must be a positive integer');
|
|
36
|
+
}
|
|
37
|
+
if (!Number.isInteger(vp.height) || vp.height <= 0) {
|
|
38
|
+
return respondInvalidBody(res, 'viewport.height must be a positive integer');
|
|
39
|
+
}
|
|
40
|
+
if (typeof vp.deviceScaleFactor !== 'number' || !Number.isFinite(vp.deviceScaleFactor) || vp.deviceScaleFactor <= 0) {
|
|
41
|
+
return respondInvalidBody(res, 'viewport.deviceScaleFactor must be a finite number > 0');
|
|
42
|
+
}
|
|
43
|
+
if (typeof vp.mobile !== 'boolean') {
|
|
44
|
+
return respondInvalidBody(res, 'viewport.mobile must be a boolean');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// Validate touch if present
|
|
48
|
+
if (state.touch != null) {
|
|
49
|
+
const touch = state.touch;
|
|
50
|
+
if (typeof touch.enabled !== 'boolean') {
|
|
51
|
+
return respondInvalidBody(res, 'touch.enabled must be a boolean');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// Validate userAgent if present
|
|
55
|
+
if (state.userAgent != null) {
|
|
56
|
+
const ua = state.userAgent;
|
|
57
|
+
if (ua.value !== null && (typeof ua.value !== 'string' || ua.value === '')) {
|
|
58
|
+
return respondInvalidBody(res, 'userAgent.value must be a non-empty string or null');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
const session = ctx.cdpSession.isAttached() ? ctx.cdpSession : null;
|
|
63
|
+
const response = await ctx.emulationController.setDesired(state, session);
|
|
64
|
+
respondJson(res, response);
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
respondError(res, error);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=postEmulation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postEmulation.js","sourceRoot":"","sources":["../../../src/http/routes/postEmulation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE7F,MAAM,CAAC,MAAM,MAAM,GAAiB,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;IACjE,MAAM,OAAO,GAAG,MAAM,YAAY,CAAmB,GAAG,EAAE,GAAG,CAAC,CAAA;IAC9D,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,OAAM;IACP,CAAC;IAED,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,OAAO,CAAU,CAAA;IAC9C,MAAM,MAAM,GAAI,OAA+B,CAAC,MAAM,CAAA;IACtD,IAAI,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAuC,CAAC,EAAE,CAAC;QAChF,OAAO,kBAAkB,CAAC,GAAG,EAAE,0BAA0B,YAAY,CAAC,IAAI,CAAC,IA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,GAAG,CAAC,mBAAmB,CAAC,UAAU,CAAC,KAAoD,EAAE,OAAO,CAAC,CAAA;QACxH,WAAW,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IACzB,CAAC;AACF,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postEval.d.ts","sourceRoot":"","sources":["../../../src/http/routes/postEval.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAK9C,eAAO,MAAM,MAAM,EAAE,YAuBpB,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { emitRequest } from './types.js';
|
|
2
|
+
import { evaluateExpression } from '../../cdp/eval.js';
|
|
3
|
+
import { respondJson, respondInvalidBody, respondError, readJsonBody, normalizeBoolean, normalizeTimeout } from '../httpUtils.js';
|
|
4
|
+
export const handle = async (req, res, _url, ctx) => {
|
|
5
|
+
const payload = await readJsonBody(req, res);
|
|
6
|
+
if (!payload) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (!payload.expression || typeof payload.expression !== 'string') {
|
|
10
|
+
return respondInvalidBody(res, 'expression is required');
|
|
11
|
+
}
|
|
12
|
+
emitRequest(ctx, res, 'eval');
|
|
13
|
+
try {
|
|
14
|
+
const response = await evaluateExpression(ctx.cdpSession, {
|
|
15
|
+
expression: payload.expression,
|
|
16
|
+
awaitPromise: normalizeBoolean(payload.awaitPromise, true),
|
|
17
|
+
returnByValue: normalizeBoolean(payload.returnByValue, true),
|
|
18
|
+
timeoutMs: normalizeTimeout(payload.timeoutMs),
|
|
19
|
+
});
|
|
20
|
+
respondJson(res, response);
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
respondError(res, error);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+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CAAC;QAChB,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IACzB,CAAC;AACF,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postReload.d.ts","sourceRoot":"","sources":["../../../src/http/routes/postReload.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAI9C,eAAO,MAAM,MAAM,EAAE,YAiBpB,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { emitRequest } from './types.js';
|
|
2
|
+
import { respondJson, respondError, readJsonBody } from '../httpUtils.js';
|
|
3
|
+
export const handle = async (req, res, _url, ctx) => {
|
|
4
|
+
const payload = await readJsonBody(req, res);
|
|
5
|
+
if (!payload) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
emitRequest(ctx, res, 'reload');
|
|
9
|
+
try {
|
|
10
|
+
await ctx.cdpSession.sendAndWait('Page.reload', {
|
|
11
|
+
ignoreCache: payload.ignoreCache ?? false,
|
|
12
|
+
});
|
|
13
|
+
const response = { ok: true };
|
|
14
|
+
respondJson(res, response);
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
respondError(res, error);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=postReload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postReload.js","sourceRoot":"","sources":["../../../src/http/routes/postReload.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAEzE,MAAM,CAAC,MAAM,MAAM,GAAiB,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;IACjE,MAAM,OAAO,GAAG,MAAM,YAAY,CAAgB,GAAG,EAAE,GAAG,CAAC,CAAA;IAC3D,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,OAAM;IACP,CAAC;IAED,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAA;IAE/B,IAAI,CAAC;QACJ,MAAM,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC,aAAa,EAAE;YAC/C,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,KAAK;SACzC,CAAC,CAAA;QACF,MAAM,QAAQ,GAAmB,EAAE,EAAE,EAAE,IAAI,EAAE,CAAA;QAC7C,WAAW,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IACzB,CAAC;AACF,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postScreenshot.d.ts","sourceRoot":"","sources":["../../../src/http/routes/postScreenshot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAI9C,eAAO,MAAM,MAAM,EAAE,YAcpB,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { emitRequest } from './types.js';
|
|
2
|
+
import { respondJson, respondError, readJsonBody } from '../httpUtils.js';
|
|
3
|
+
export const handle = async (req, res, _url, ctx) => {
|
|
4
|
+
const payload = await readJsonBody(req, res);
|
|
5
|
+
if (!payload) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
emitRequest(ctx, res, 'screenshot');
|
|
9
|
+
try {
|
|
10
|
+
const response = await ctx.screenshotter.capture(payload);
|
|
11
|
+
respondJson(res, response);
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
respondError(res, error);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=postScreenshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postScreenshot.js","sourceRoot":"","sources":["../../../src/http/routes/postScreenshot.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAEzE,MAAM,CAAC,MAAM,MAAM,GAAiB,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;IACjE,MAAM,OAAO,GAAG,MAAM,YAAY,CAAoB,GAAG,EAAE,GAAG,CAAC,CAAA;IAC/D,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,OAAM;IACP,CAAC;IAED,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,YAAY,CAAC,CAAA;IAEnC,IAAI,CAAC;QACJ,MAAM,QAAQ,GAAuB,MAAM,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAC7E,WAAW,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IACzB,CAAC;AACF,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postShutdown.d.ts","sourceRoot":"","sources":["../../../src/http/routes/postShutdown.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAI9C,eAAO,MAAM,MAAM,EAAE,YAWpB,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { emitRequest } from './types.js';
|
|
2
|
+
import { respondJson } from '../httpUtils.js';
|
|
3
|
+
export const handle = (_req, res, _url, ctx) => {
|
|
4
|
+
emitRequest(ctx, res, 'shutdown');
|
|
5
|
+
const response = { ok: true };
|
|
6
|
+
respondJson(res, response);
|
|
7
|
+
if (ctx.onShutdown) {
|
|
8
|
+
queueMicrotask(() => {
|
|
9
|
+
void ctx.onShutdown?.();
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=postShutdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postShutdown.js","sourceRoot":"","sources":["../../../src/http/routes/postShutdown.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C,MAAM,CAAC,MAAM,MAAM,GAAiB,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;IAC5D,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,UAAU,CAAC,CAAA;IAEjC,MAAM,QAAQ,GAAqB,EAAE,EAAE,EAAE,IAAI,EAAE,CAAA;IAC/C,WAAW,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IAE1B,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC;QACpB,cAAc,CAAC,GAAG,EAAE;YACnB,KAAK,GAAG,CAAC,UAAU,EAAE,EAAE,CAAA;QACxB,CAAC,CAAC,CAAA;IACH,CAAC;AACF,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postSnapshot.d.ts","sourceRoot":"","sources":["../../../src/http/routes/postSnapshot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAK9C,eAAO,MAAM,MAAM,EAAE,YA0BpB,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { emitRequest } from './types.js';
|
|
2
|
+
import { fetchAccessibilitySnapshot } from '../../cdp/accessibility.js';
|
|
3
|
+
import { respondJson, respondInvalidBody, respondError, readJsonBody } from '../httpUtils.js';
|
|
4
|
+
export const handle = async (req, res, _url, ctx) => {
|
|
5
|
+
const payload = await readJsonBody(req, res);
|
|
6
|
+
if (!payload) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (payload.selector != null && (typeof payload.selector !== 'string' || payload.selector.trim() === '')) {
|
|
10
|
+
return respondInvalidBody(res, 'selector must be a non-empty string');
|
|
11
|
+
}
|
|
12
|
+
if (payload.depth != null && (!Number.isFinite(payload.depth) || payload.depth < 0 || !Number.isInteger(payload.depth))) {
|
|
13
|
+
return respondInvalidBody(res, 'depth must be a non-negative integer');
|
|
14
|
+
}
|
|
15
|
+
emitRequest(ctx, res, 'snapshot');
|
|
16
|
+
try {
|
|
17
|
+
const response = await fetchAccessibilitySnapshot(ctx.cdpSession, {
|
|
18
|
+
selector: payload.selector,
|
|
19
|
+
depth: payload.depth,
|
|
20
|
+
interactive: payload.interactive ?? false,
|
|
21
|
+
});
|
|
22
|
+
respondJson(res, response);
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
respondError(res, error);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=postSnapshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postSnapshot.js","sourceRoot":"","sources":["../../../src/http/routes/postSnapshot.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAA;AACvE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE7F,MAAM,CAAC,MAAM,MAAM,GAAiB,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;IACjE,MAAM,OAAO,GAAG,MAAM,YAAY,CAAkB,GAAG,EAAE,GAAG,CAAC,CAAA;IAC7D,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,OAAM;IACP,CAAC;IAED,IAAI,OAAO,CAAC,QA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Request } from './types.js';
|
|
2
|
+
import { executeStorageLocal } from '../../cdp/storageLocal.js';
|
|
3
|
+
import { respondJson, respondInvalidBody, respondError, readJsonBody } from '../httpUtils.js';
|
|
4
|
+
export const handle = async (req, res, _url, ctx) => {
|
|
5
|
+
const payload = await readJsonBody(req, res);
|
|
6
|
+
if (!payload) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
// Validate action
|
|
10
|
+
const validActions = ['get', 'set', 'remove', 'list', 'clear'];
|
|
11
|
+
if (!payload.action || !validActions.includes(payload.action)) {
|
|
12
|
+
return respondInvalidBody(res, `action must be one of: ${validActions.join(', ')}`);
|
|
13
|
+
}
|
|
14
|
+
// Validate key is present for get/set/remove
|
|
15
|
+
if (['get', 'set', 'remove'].includes(payload.action) && (!payload.key || typeof payload.key !== 'string')) {
|
|
16
|
+
return respondInvalidBody(res, 'key is required for get/set/remove actions');
|
|
17
|
+
}
|
|
18
|
+
// Validate value is present for set
|
|
19
|
+
if (payload.action === 'set' && (payload.value === undefined || typeof payload.value !== 'string')) {
|
|
20
|
+
return respondInvalidBody(res, 'value is required for set action');
|
|
21
|
+
}
|
|
22
|
+
emitRequest(ctx, res, 'storage/local');
|
|
23
|
+
try {
|
|
24
|
+
const response = await executeStorageLocal(ctx.cdpSession, payload);
|
|
25
|
+
respondJson(res, response);
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
respondError(res, error);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=postStorageLocal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postStorageLocal.js","sourceRoot":"","sources":["../../../src/http/routes/postStorageLocal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,YAAY,EAAE,YAA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AAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;QACnE,WAAW,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IACzB,CAAC;AACF,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postThrottle.d.ts","sourceRoot":"","sources":["../../../src/http/routes/postThrottle.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAI9C,eAAO,MAAM,MAAM,EAAE,YAsCpB,CAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { emitRequest } from './types.js';
|
|
2
|
+
import { respondJson, respondInvalidBody, respondError, readJsonBody } from '../httpUtils.js';
|
|
3
|
+
export const handle = async (req, res, _url, ctx) => {
|
|
4
|
+
const payload = await readJsonBody(req, res);
|
|
5
|
+
if (!payload) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
const validActions = ['set', 'clear'];
|
|
9
|
+
const action = payload.action;
|
|
10
|
+
if (!action || !validActions.includes(action)) {
|
|
11
|
+
return respondInvalidBody(res, `action must be one of: ${validActions.join(', ')}`);
|
|
12
|
+
}
|
|
13
|
+
emitRequest(ctx, res, 'throttle');
|
|
14
|
+
const session = ctx.cdpSession.isAttached() ? ctx.cdpSession : null;
|
|
15
|
+
if (action === 'clear') {
|
|
16
|
+
try {
|
|
17
|
+
const response = await ctx.throttleController.clearDesired(session);
|
|
18
|
+
respondJson(res, response);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
respondError(res, error);
|
|
22
|
+
}
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
// action === 'set'
|
|
26
|
+
const setPayload = payload;
|
|
27
|
+
if (typeof setPayload.rate !== 'number' || !Number.isFinite(setPayload.rate) || setPayload.rate < 1) {
|
|
28
|
+
return respondInvalidBody(res, 'rate must be a finite number >= 1');
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
const response = await ctx.throttleController.setDesired(setPayload.rate, session);
|
|
32
|
+
respondJson(res, response);
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
respondError(res, error);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=postThrottle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postThrottle.js","sourceRoot":"","sources":["../../../src/http/routes/postThrottle.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE7F,MAAM,CAAC,MAAM,MAAM,GAAiB,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;IACjE,MAAM,OAAO,GAAG,MAAM,YAAY,CAAkB,GAAG,EAAE,GAAG,CAAC,CAAA;IAC7D,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,OAAM;IACP,CAAC;IAED,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,OAAO,CAAU,CAAA;IAC9C,MAAM,MAAM,GAAI,OAA+B,CAAC,MAAM,CAAA;IACtD,IAAI,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAuC,CAAC,EAAE,CAAC;QAChF,OAAO,kBAAkB,CAAC,GAAG,EAAE,0BAA0B,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACpF,CAAC;IAED,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,UAAU,CAAC,CAAA;IAEjC,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAA;IAEnE,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;QACxB,IAAI,CAAC;YACJ,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,kBAAkB,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;YACnE,WAAW,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;QAC3B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;QACzB,CAAC;QACD,OAAM;IACP,CAAC;IAED,mBAAmB;IACnB,MAAM,UAAU,GAAG,OAA6B,CAAA;IAChD,IAAI,OAAO,UAAU,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;QACrG,OAAO,kBAAkB,CAAC,GAAG,EAAE,mCAAmC,CAAC,CAAA;IACpE,CAAC;IAED,IAAI,CAAC;QACJ,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,kBAAkB,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QAClF,WAAW,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IACzB,CAAC;AACF,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postTraceStart.d.ts","sourceRoot":"","sources":["../../../src/http/routes/postTraceStart.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAI9C,eAAO,MAAM,MAAM,EAAE,YAcpB,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { emitRequest } from './types.js';
|
|
2
|
+
import { respondJson, respondError, readJsonBody } from '../httpUtils.js';
|
|
3
|
+
export const handle = async (req, res, _url, ctx) => {
|
|
4
|
+
const payload = await readJsonBody(req, res);
|
|
5
|
+
if (!payload) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
emitRequest(ctx, res, 'trace/start');
|
|
9
|
+
try {
|
|
10
|
+
const response = await ctx.traceRecorder.start(payload);
|
|
11
|
+
respondJson(res, response);
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
respondError(res, error);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=postTraceStart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postTraceStart.js","sourceRoot":"","sources":["../../../src/http/routes/postTraceStart.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAEzE,MAAM,CAAC,MAAM,MAAM,GAAiB,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;IACjE,MAAM,OAAO,GAAG,MAAM,YAAY,CAAoB,GAAG,EAAE,GAAG,CAAC,CAAA;IAC/D,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,OAAM;IACP,CAAC;IAED,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,aAAa,CAAC,CAAA;IAEpC,IAAI,CAAC;QACJ,MAAM,QAAQ,GAAuB,MAAM,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAC3E,WAAW,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IACzB,CAAC;AACF,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postTraceStop.d.ts","sourceRoot":"","sources":["../../../src/http/routes/postTraceStop.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAI9C,eAAO,MAAM,MAAM,EAAE,YAcpB,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { emitRequest } from './types.js';
|
|
2
|
+
import { respondJson, respondError, readJsonBody } from '../httpUtils.js';
|
|
3
|
+
export const handle = async (req, res, _url, ctx) => {
|
|
4
|
+
const payload = await readJsonBody(req, res);
|
|
5
|
+
if (!payload) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
emitRequest(ctx, res, 'trace/stop');
|
|
9
|
+
try {
|
|
10
|
+
const response = await ctx.traceRecorder.stop(payload);
|
|
11
|
+
respondJson(res, response);
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
respondError(res, error);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=postTraceStop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postTraceStop.js","sourceRoot":"","sources":["../../../src/http/routes/postTraceStop.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAEzE,MAAM,CAAC,MAAM,MAAM,GAAiB,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;IACjE,MAAM,OAAO,GAAG,MAAM,YAAY,CAAmB,GAAG,EAAE,GAAG,CAAC,CAAA;IAC9D,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,OAAM;IACP,CAAC;IAED,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,YAAY,CAAC,CAAA;IAEnC,IAAI,CAAC;QACJ,MAAM,QAAQ,GAAsB,MAAM,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QACzE,WAAW,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IACzB,CAAC;AACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type http from 'node:http';
|
|
2
|
+
import type { HttpRequestEventMetadata, HttpServerOptions } from '../server.js';
|
|
3
|
+
/** Uniform handler signature for all route modules. */
|
|
4
|
+
export type RouteHandler = (req: http.IncomingMessage, res: http.ServerResponse, url: URL, ctx: RouteContext) => Promise<void> | void;
|
|
5
|
+
/** Context passed to every route handler (alias for HttpServerOptions). */
|
|
6
|
+
export type RouteContext = HttpServerOptions;
|
|
7
|
+
/** Emit an HTTP request event via `ctx.onRequest`. Replaces per-handler boilerplate. */
|
|
8
|
+
export declare const emitRequest: (ctx: RouteContext, res: http.ServerResponse, endpoint: HttpRequestEventMetadata["endpoint"], query?: HttpRequestEventMetadata["query"]) => void;
|
|
9
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/http/routes/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAE/E,uDAAuD;AACvD,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,eAAe,EAAE,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;AAErI,2EAA2E;AAC3E,MAAM,MAAM,YAAY,GAAG,iBAAiB,CAAA;AAE5C,wFAAwF;AACxF,eAAO,MAAM,WAAW,GACvB,KAAK,YAAY,EACjB,KAAK,IAAI,CAAC,cAAc,EACxB,UAAU,wBAAwB,CAAC,UAAU,CAAC,EAC9C,QAAQ,wBAAwB,CAAC,OAAO,CAAC,KACvC,IAOF,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Emit an HTTP request event via `ctx.onRequest`. Replaces per-handler boilerplate. */
|
|
2
|
+
export const emitRequest = (ctx, res, endpoint, query) => {
|
|
3
|
+
ctx.onRequest?.({
|
|
4
|
+
endpoint,
|
|
5
|
+
remoteAddress: res.req.socket.remoteAddress ?? null,
|
|
6
|
+
query,
|
|
7
|
+
ts: Date.now(),
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/http/routes/types.ts"],"names":[],"mappings":"AASA,wFAAwF;AACxF,MAAM,CAAC,MAAM,WAAW,GAAG,CAC1B,GAAiB,EACjB,GAAwB,EACxB,QAA8C,EAC9C,KAAyC,EAClC,EAAE;IACT,GAAG,CAAC,SAAS,EAAE,CAAC;QACf,QAAQ;QACR,aAAa,EAAE,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,aAAa,IAAI,IAAI;QACnD,KAAK;QACL,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;KACd,CAAC,CAAA;AACH,CAAC,CAAA"}
|