@vforsh/argus 0.1.13 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/argus.js +3963 -2198
- package/dist/cli/defineCommand.d.ts +26 -0
- package/dist/cli/defineCommand.d.ts.map +1 -0
- package/dist/cli/defineCommand.js +55 -0
- package/dist/cli/defineCommand.js.map +1 -0
- package/dist/cli/defineWatcherCommand.d.ts +112 -0
- package/dist/cli/defineWatcherCommand.d.ts.map +1 -0
- package/dist/cli/defineWatcherCommand.js +89 -0
- package/dist/cli/defineWatcherCommand.js.map +1 -0
- package/dist/cli/plugins/pluginAliases.d.ts +6 -0
- package/dist/cli/plugins/pluginAliases.d.ts.map +1 -0
- package/dist/cli/plugins/pluginAliases.js +10 -0
- package/dist/cli/plugins/pluginAliases.js.map +1 -0
- package/dist/cli/plugins/pluginHost.d.ts +3 -0
- package/dist/cli/plugins/pluginHost.d.ts.map +1 -0
- package/dist/cli/plugins/pluginHost.js +30 -0
- package/dist/cli/plugins/pluginHost.js.map +1 -0
- package/dist/cli/plugins/registerPlugins.d.ts +32 -1
- package/dist/cli/plugins/registerPlugins.d.ts.map +1 -1
- package/dist/cli/plugins/registerPlugins.js +102 -12
- package/dist/cli/plugins/registerPlugins.js.map +1 -1
- package/dist/cli/program.d.ts.map +1 -1
- package/dist/cli/program.js +2 -0
- package/dist/cli/program.js.map +1 -1
- package/dist/cli/register/index.d.ts.map +1 -1
- package/dist/cli/register/index.js +8 -2
- package/dist/cli/register/index.js.map +1 -1
- package/dist/cli/register/registerAuth.d.ts.map +1 -1
- package/dist/cli/register/registerAuth.js +13 -8
- package/dist/cli/register/registerAuth.js.map +1 -1
- package/dist/cli/register/registerCode.d.ts.map +1 -1
- package/dist/cli/register/registerCode.js +19 -0
- package/dist/cli/register/registerCode.js.map +1 -1
- package/dist/cli/register/registerDom.d.ts.map +1 -1
- package/dist/cli/register/registerDom.js +3 -1
- package/dist/cli/register/registerDom.js.map +1 -1
- package/dist/cli/register/registerEval.d.ts.map +1 -1
- package/dist/cli/register/registerEval.js +13 -0
- package/dist/cli/register/registerEval.js.map +1 -1
- package/dist/cli/register/registerExtension.d.ts.map +1 -1
- package/dist/cli/register/registerExtension.js +12 -0
- package/dist/cli/register/registerExtension.js.map +1 -1
- package/dist/cli/register/registerNet.d.ts.map +1 -1
- package/dist/cli/register/registerNet.js +40 -6
- package/dist/cli/register/registerNet.js.map +1 -1
- package/dist/cli/register/registerPage.d.ts.map +1 -1
- package/dist/cli/register/registerPage.js +17 -0
- package/dist/cli/register/registerPage.js.map +1 -1
- package/dist/cli/register/registerPlugin.d.ts +3 -0
- package/dist/cli/register/registerPlugin.d.ts.map +1 -0
- package/dist/cli/register/registerPlugin.js +34 -0
- package/dist/cli/register/registerPlugin.js.map +1 -0
- package/dist/cli/register/registerSnapshot.d.ts.map +1 -1
- package/dist/cli/register/registerSnapshot.js +2 -1
- package/dist/cli/register/registerSnapshot.js.map +1 -1
- package/dist/cli/register/registerWatcher.d.ts.map +1 -1
- package/dist/cli/register/registerWatcher.js +19 -0
- package/dist/cli/register/registerWatcher.js.map +1 -1
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +4 -9
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/authCookieSupport.d.ts.map +1 -1
- package/dist/commands/authCookieSupport.js +4 -6
- package/dist/commands/authCookieSupport.js.map +1 -1
- package/dist/commands/authCookies.d.ts +4 -4
- package/dist/commands/authCookies.d.ts.map +1 -1
- package/dist/commands/authCookies.js +85 -105
- package/dist/commands/authCookies.js.map +1 -1
- package/dist/commands/code.js +3 -25
- package/dist/commands/code.js.map +1 -1
- package/dist/commands/codeEdit.d.ts +9 -0
- package/dist/commands/codeEdit.d.ts.map +1 -0
- package/dist/commands/codeEdit.js +155 -0
- package/dist/commands/codeEdit.js.map +1 -0
- package/dist/commands/configInit.d.ts.map +1 -1
- package/dist/commands/configInit.js +1 -0
- package/dist/commands/configInit.js.map +1 -1
- package/dist/commands/dialog.d.ts +5 -5
- package/dist/commands/dialog.d.ts.map +1 -1
- package/dist/commands/dialog.js +36 -54
- package/dist/commands/dialog.js.map +1 -1
- package/dist/commands/domAdd.d.ts +1 -1
- package/dist/commands/domAdd.d.ts.map +1 -1
- package/dist/commands/domAdd.js +26 -30
- package/dist/commands/domAdd.js.map +1 -1
- package/dist/commands/domClick.d.ts +4 -1
- package/dist/commands/domClick.d.ts.map +1 -1
- package/dist/commands/domClick.js +83 -75
- package/dist/commands/domClick.js.map +1 -1
- package/dist/commands/domFill.d.ts +2 -2
- package/dist/commands/domFill.d.ts.map +1 -1
- package/dist/commands/domFill.js +56 -67
- package/dist/commands/domFill.js.map +1 -1
- package/dist/commands/domFocus.d.ts +1 -1
- package/dist/commands/domFocus.d.ts.map +1 -1
- package/dist/commands/domFocus.js +27 -35
- package/dist/commands/domFocus.js.map +1 -1
- package/dist/commands/domHover.d.ts +1 -1
- package/dist/commands/domHover.d.ts.map +1 -1
- package/dist/commands/domHover.js +27 -35
- package/dist/commands/domHover.js.map +1 -1
- package/dist/commands/domInfo.d.ts +1 -1
- package/dist/commands/domInfo.d.ts.map +1 -1
- package/dist/commands/domInfo.js +18 -23
- package/dist/commands/domInfo.js.map +1 -1
- package/dist/commands/domKeydown.d.ts +1 -1
- package/dist/commands/domKeydown.d.ts.map +1 -1
- package/dist/commands/domKeydown.js +22 -43
- package/dist/commands/domKeydown.js.map +1 -1
- package/dist/commands/domModify.js +27 -30
- package/dist/commands/domModify.js.map +1 -1
- package/dist/commands/domRemove.d.ts +1 -1
- package/dist/commands/domRemove.d.ts.map +1 -1
- package/dist/commands/domRemove.js +25 -34
- package/dist/commands/domRemove.js.map +1 -1
- package/dist/commands/domScroll.d.ts +2 -2
- package/dist/commands/domScroll.d.ts.map +1 -1
- package/dist/commands/domScroll.js +19 -25
- package/dist/commands/domScroll.js.map +1 -1
- package/dist/commands/domScrollTo.d.ts +1 -1
- package/dist/commands/domScrollTo.d.ts.map +1 -1
- package/dist/commands/domScrollTo.js +15 -24
- package/dist/commands/domScrollTo.js.map +1 -1
- package/dist/commands/domSetFile.d.ts +1 -1
- package/dist/commands/domSetFile.d.ts.map +1 -1
- package/dist/commands/domSetFile.js +24 -33
- package/dist/commands/domSetFile.js.map +1 -1
- package/dist/commands/domTree.d.ts +1 -1
- package/dist/commands/domTree.d.ts.map +1 -1
- package/dist/commands/domTree.js +18 -24
- package/dist/commands/domTree.js.map +1 -1
- package/dist/commands/eval.d.ts +4 -0
- package/dist/commands/eval.d.ts.map +1 -1
- package/dist/commands/eval.js +43 -56
- package/dist/commands/eval.js.map +1 -1
- package/dist/commands/evalPolling.d.ts +55 -0
- package/dist/commands/evalPolling.d.ts.map +1 -0
- package/dist/commands/evalPolling.js +59 -0
- package/dist/commands/evalPolling.js.map +1 -0
- package/dist/commands/evalShared.d.ts +24 -0
- package/dist/commands/evalShared.d.ts.map +1 -1
- package/dist/commands/evalShared.js +75 -7
- package/dist/commands/evalShared.js.map +1 -1
- package/dist/commands/evalUntil.d.ts +4 -0
- package/dist/commands/evalUntil.d.ts.map +1 -1
- package/dist/commands/evalUntil.js +47 -64
- package/dist/commands/evalUntil.js.map +1 -1
- package/dist/commands/extension/resolveExtensionWatcher.d.ts +20 -0
- package/dist/commands/extension/resolveExtensionWatcher.d.ts.map +1 -0
- package/dist/commands/extension/resolveExtensionWatcher.js +73 -0
- package/dist/commands/extension/resolveExtensionWatcher.js.map +1 -0
- package/dist/commands/extension/tabs.d.ts +8 -0
- package/dist/commands/extension/tabs.d.ts.map +1 -0
- package/dist/commands/extension/tabs.js +85 -0
- package/dist/commands/extension/tabs.js.map +1 -0
- package/dist/commands/locate.js +2 -2
- package/dist/commands/locate.js.map +1 -1
- package/dist/commands/logs.d.ts +1 -1
- package/dist/commands/logs.d.ts.map +1 -1
- package/dist/commands/logs.js +18 -27
- package/dist/commands/logs.js.map +1 -1
- package/dist/commands/net.d.ts +1 -1
- package/dist/commands/net.d.ts.map +1 -1
- package/dist/commands/net.js +14 -19
- package/dist/commands/net.js.map +1 -1
- package/dist/commands/netCapture.d.ts +10 -5
- package/dist/commands/netCapture.d.ts.map +1 -1
- package/dist/commands/netCapture.js +113 -15
- package/dist/commands/netCapture.js.map +1 -1
- package/dist/commands/netClear.d.ts +1 -1
- package/dist/commands/netClear.d.ts.map +1 -1
- package/dist/commands/netClear.js +7 -19
- package/dist/commands/netClear.js.map +1 -1
- package/dist/commands/netExport.d.ts +2 -7
- package/dist/commands/netExport.d.ts.map +1 -1
- package/dist/commands/netExport.js.map +1 -1
- package/dist/commands/netSse.d.ts +6 -0
- package/dist/commands/netSse.d.ts.map +1 -0
- package/dist/commands/netSse.js +26 -0
- package/dist/commands/netSse.js.map +1 -0
- package/dist/commands/netWatch.d.ts +2 -7
- package/dist/commands/netWatch.d.ts.map +1 -1
- package/dist/commands/netWatch.js.map +1 -1
- package/dist/commands/netWebSocket.d.ts +10 -0
- package/dist/commands/netWebSocket.d.ts.map +1 -0
- package/dist/commands/netWebSocket.js +58 -0
- package/dist/commands/netWebSocket.js.map +1 -0
- package/dist/commands/pageEmulation.d.ts +3 -3
- package/dist/commands/pageEmulation.d.ts.map +1 -1
- package/dist/commands/pageEmulation.js +72 -143
- package/dist/commands/pageEmulation.js.map +1 -1
- package/dist/commands/pageVisibility.d.ts +9 -0
- package/dist/commands/pageVisibility.d.ts.map +1 -0
- package/dist/commands/pageVisibility.js +24 -0
- package/dist/commands/pageVisibility.js.map +1 -0
- package/dist/commands/pluginConfig.d.ts +7 -0
- package/dist/commands/pluginConfig.d.ts.map +1 -0
- package/dist/commands/pluginConfig.js +199 -0
- package/dist/commands/pluginConfig.js.map +1 -0
- package/dist/commands/pluginList.d.ts +5 -0
- package/dist/commands/pluginList.d.ts.map +1 -0
- package/dist/commands/pluginList.js +26 -0
- package/dist/commands/pluginList.js.map +1 -0
- package/dist/commands/reload.d.ts +1 -1
- package/dist/commands/reload.d.ts.map +1 -1
- package/dist/commands/reload.js +8 -17
- package/dist/commands/reload.js.map +1 -1
- package/dist/commands/screenshot.d.ts +2 -1
- package/dist/commands/screenshot.d.ts.map +1 -1
- package/dist/commands/screenshot.js +45 -16
- package/dist/commands/screenshot.js.map +1 -1
- package/dist/commands/snapshot.d.ts +1 -1
- package/dist/commands/snapshot.d.ts.map +1 -1
- package/dist/commands/snapshot.js +26 -49
- package/dist/commands/snapshot.js.map +1 -1
- package/dist/commands/storage.d.ts.map +1 -1
- package/dist/commands/storage.js +26 -58
- package/dist/commands/storage.js.map +1 -1
- package/dist/commands/throttle.d.ts +6 -3
- package/dist/commands/throttle.d.ts.map +1 -1
- package/dist/commands/throttle.js +46 -118
- package/dist/commands/throttle.js.map +1 -1
- package/dist/commands/watcherStatus.d.ts +1 -1
- package/dist/commands/watcherStatus.d.ts.map +1 -1
- package/dist/commands/watcherStatus.js +8 -20
- package/dist/commands/watcherStatus.js.map +1 -1
- package/dist/config/argusConfig.d.ts +5 -0
- package/dist/config/argusConfig.d.ts.map +1 -1
- package/dist/config/argusConfig.js +33 -2
- package/dist/config/argusConfig.js.map +1 -1
- package/dist/eval/evalClient.d.ts +1 -0
- package/dist/eval/evalClient.d.ts.map +1 -1
- package/dist/eval/evalClient.js +2 -0
- package/dist/eval/evalClient.js.map +1 -1
- package/dist/output/net.d.ts +4 -1
- package/dist/output/net.d.ts.map +1 -1
- package/dist/output/net.js +59 -0
- package/dist/output/net.js.map +1 -1
- package/package.json +2 -2
- package/schemas/argus.config.schema.json +16 -0
- package/dist/cli/register/registerClick.d.ts +0 -3
- package/dist/cli/register/registerClick.d.ts.map +0 -1
- package/dist/cli/register/registerClick.js +0 -24
- package/dist/cli/register/registerClick.js.map +0 -1
package/dist/commands/domFill.js
CHANGED
|
@@ -1,12 +1,62 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
|
-
import {
|
|
2
|
+
import { defineWatcherCommand } from '../cli/defineWatcherCommand.js';
|
|
3
3
|
import { formatError } from '../cli/parse.js';
|
|
4
|
-
import { readStdin } from './evalShared.js';
|
|
5
4
|
import { resolvePath } from '../utils/paths.js';
|
|
6
|
-
import { requestWatcherAction } from '../watchers/requestWatcher.js';
|
|
7
5
|
import { describeElementTarget, parseWaitDuration, requireElementTarget, writeNoElementFound } from './dom/shared.js';
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
import { readStdin } from './evalShared.js';
|
|
7
|
+
/** Execute the dom fill command for a watcher id. The first positional arg is the inline value. */
|
|
8
|
+
export const runDomFill = defineWatcherCommand({
|
|
9
|
+
build: async ([value], options, output) => buildFillPlan(value, options, output),
|
|
10
|
+
formatHuman: (response, { output, options }) => {
|
|
11
|
+
const target = { selector: resolveFillSelector(options), ref: options.ref };
|
|
12
|
+
if (response.matches === 0) {
|
|
13
|
+
writeNoElementFound(target.selector ?? target.ref, output);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const elLabel = response.filled === 1 ? '1 element' : `${response.filled} elements`;
|
|
17
|
+
output.writeHuman(`Filled ${elLabel} for ${describeElementTarget(target)}`);
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
/** Apply the `--name` shorthand: `--name foo` is equivalent to `--selector '[name="foo"]'`. */
|
|
21
|
+
const resolveFillSelector = (options) => (options.name ? `[name="${options.name}"]` : options.selector);
|
|
22
|
+
/** Resolve `--name` shorthand, the value source, and `--wait` into a `/dom/fill` request plan. */
|
|
23
|
+
const buildFillPlan = async (value, options, output) => {
|
|
24
|
+
if (options.name && (options.selector || options.ref)) {
|
|
25
|
+
output.writeWarn('Cannot use --name with --selector or --ref');
|
|
26
|
+
process.exitCode = 2;
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
const target = requireElementTarget({ selector: resolveFillSelector(options), ref: options.ref }, output);
|
|
30
|
+
if (!target)
|
|
31
|
+
return null;
|
|
32
|
+
const resolvedValue = await resolveFillValue(value, options, output);
|
|
33
|
+
if (resolvedValue == null) {
|
|
34
|
+
process.exitCode = 2;
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
const waitMs = parseWaitDuration(options.wait, output);
|
|
38
|
+
if (waitMs == null)
|
|
39
|
+
return null;
|
|
40
|
+
const body = {
|
|
41
|
+
value: resolvedValue,
|
|
42
|
+
all: options.all ?? false,
|
|
43
|
+
text: options.text,
|
|
44
|
+
};
|
|
45
|
+
if (target.selector)
|
|
46
|
+
body.selector = target.selector;
|
|
47
|
+
if (target.ref)
|
|
48
|
+
body.ref = target.ref;
|
|
49
|
+
if (waitMs > 0)
|
|
50
|
+
body.wait = waitMs;
|
|
51
|
+
return {
|
|
52
|
+
path: '/dom/fill',
|
|
53
|
+
method: 'POST',
|
|
54
|
+
body,
|
|
55
|
+
timeoutMs: Math.max(30_000, waitMs + 5_000),
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
/** Resolve the fill value from inline arg, --value-file, or --value-stdin. Returns null on error. */
|
|
59
|
+
const resolveFillValue = async (value, options, output) => {
|
|
10
60
|
const wantsStdin = options.valueStdin === true || value === '-';
|
|
11
61
|
const hasInline = value != null && value !== '-';
|
|
12
62
|
const hasFile = options.valueFile != null;
|
|
@@ -43,70 +93,9 @@ const resolveValueInput = async (value, options, output) => {
|
|
|
43
93
|
return null;
|
|
44
94
|
}
|
|
45
95
|
}
|
|
46
|
-
if (hasInline)
|
|
96
|
+
if (hasInline)
|
|
47
97
|
return value;
|
|
48
|
-
}
|
|
49
98
|
output.writeWarn('Value is required. Provide an inline value, --value-file, or --value-stdin (or pass - as value).');
|
|
50
99
|
return null;
|
|
51
100
|
};
|
|
52
|
-
/** Execute the dom fill command for a watcher id. */
|
|
53
|
-
export const runDomFill = async (id, value, options) => {
|
|
54
|
-
const output = createOutput(options);
|
|
55
|
-
if (options.name && (options.selector || options.ref)) {
|
|
56
|
-
output.writeWarn('Cannot use --name with --selector or --ref');
|
|
57
|
-
process.exitCode = 2;
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (options.name) {
|
|
61
|
-
options.selector = `[name="${options.name}"]`;
|
|
62
|
-
}
|
|
63
|
-
const target = requireElementTarget({ selector: options.selector, ref: options.ref }, output);
|
|
64
|
-
if (!target) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
const resolvedValue = await resolveValueInput(value, options, output);
|
|
68
|
-
if (resolvedValue == null) {
|
|
69
|
-
process.exitCode = 2;
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
const waitMs = parseWaitDuration(options.wait, output);
|
|
73
|
-
if (waitMs == null) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
const body = {
|
|
77
|
-
value: resolvedValue,
|
|
78
|
-
all: options.all ?? false,
|
|
79
|
-
text: options.text,
|
|
80
|
-
};
|
|
81
|
-
if (target.selector) {
|
|
82
|
-
body.selector = target.selector;
|
|
83
|
-
}
|
|
84
|
-
if (target.ref) {
|
|
85
|
-
body.ref = target.ref;
|
|
86
|
-
}
|
|
87
|
-
if (waitMs > 0) {
|
|
88
|
-
body.wait = waitMs;
|
|
89
|
-
}
|
|
90
|
-
const result = await requestWatcherAction({
|
|
91
|
-
id,
|
|
92
|
-
path: '/dom/fill',
|
|
93
|
-
method: 'POST',
|
|
94
|
-
body,
|
|
95
|
-
timeoutMs: Math.max(30_000, waitMs + 5_000),
|
|
96
|
-
}, output);
|
|
97
|
-
if (!result) {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
const successResp = result.data;
|
|
101
|
-
if (options.json) {
|
|
102
|
-
output.writeJson(successResp);
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
if (successResp.matches === 0) {
|
|
106
|
-
writeNoElementFound(target.selector ?? target.ref, output);
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
const elLabel = successResp.filled === 1 ? '1 element' : `${successResp.filled} elements`;
|
|
110
|
-
output.writeHuman(`Filled ${elLabel} for ${describeElementTarget(target)}`);
|
|
111
|
-
};
|
|
112
101
|
//# sourceMappingURL=domFill.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domFill.js","sourceRoot":"","sources":["../../src/commands/domFill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE3C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"domFill.js","sourceRoot":"","sources":["../../src/commands/domFill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE3C,OAAO,EAAE,oBAAoB,EAA2B,MAAM,gCAAgC,CAAA;AAC9F,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACrH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAe3C,mGAAmG;AACnG,MAAM,CAAC,MAAM,UAAU,GAAG,oBAAoB,CAAwE;IACrH,KAAK,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC;IAChF,WAAW,EAAE,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE;QAC9C,MAAM,MAAM,GAAG,EAAE,QAAQ,EAAE,mBAAmB,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAA;QAC3E,IAAI,QAAQ,CAAC,OAAO,KAAK,CAAC,EAAE,CAAC;YAC5B,mBAAmB,CAAC,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,GAAI,EAAE,MAAM,CAAC,CAAA;YAC3D,OAAM;QACP,CAAC;QACD,MAAM,OAAO,GAAG,QAAQ,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,CAAC;YACJ,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,SAAU,CAAC,EAAE,MAAM,CAAC,CAAA;YACvE,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;gBACrB,MAAM,CAAC,SAAS,CAAC,kBAAkB,OAAO,CAAC,SAAS,EAAE,CAAC,CAAA;gBACvD,OAAO,IAAI,CAAA;YACZ,CAAC;YACD,OAAO,OAAO,CAAA;QACf,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,CAAC,SAAS,CAAC,gCAAgC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;YACtE,OAAO,IAAI,CAAA;QACZ,CAAC;IACF,CAAC;IAED,IAAI,UAAU,EAAE,CAAC;QAChB,IAAI,CAAC;YACJ,MAAM,OAAO,GAAG,MAAM,SAAS,EAAE,CAAA;YACjC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;gBACrB,MAAM,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAA;gBACxC,OAAO,IAAI,CAAA;YACZ,CAAC;YACD,OAAO,OAAO,CAAA;QACf,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,CAAC,SAAS,CAAC,yBAAyB,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;YAC/D,OAAO,IAAI,CAAA;QACZ,CAAC;IACF,CAAC;IAED,IAAI,SAAS;QAAE,OAAO,KAAM,CAAA;IAE5B,MAAM,CAAC,SAAS,CAAC,kGAAkG,CAAC,CAAA;IACpH,OAAO,IAAI,CAAA;AACZ,CAAC,CAAA"}
|
|
@@ -7,5 +7,5 @@ export type DomFocusOptions = {
|
|
|
7
7
|
json?: boolean;
|
|
8
8
|
};
|
|
9
9
|
/** Execute the dom focus command for a watcher id. */
|
|
10
|
-
export declare const runDomFocus: (
|
|
10
|
+
export declare const runDomFocus: import("../cli/defineWatcherCommand.js").WatcherCommandRunner<[], DomFocusOptions>;
|
|
11
11
|
//# sourceMappingURL=domFocus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domFocus.d.ts","sourceRoot":"","sources":["../../src/commands/domFocus.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"domFocus.d.ts","sourceRoot":"","sources":["../../src/commands/domFocus.ts"],"names":[],"mappings":"AAIA,yCAAyC;AACzC,MAAM,MAAM,eAAe,GAAG;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,OAAO,CAAA;CACd,CAAA;AAED,sDAAsD;AACtD,eAAO,MAAM,WAAW,oFAyBtB,CAAA"}
|
|
@@ -1,38 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { requestWatcherAction } from '../watchers/requestWatcher.js';
|
|
1
|
+
import { defineWatcherCommand } from '../cli/defineWatcherCommand.js';
|
|
3
2
|
import { describeElementTarget, requireElementTarget, writeNoElementFound } from './dom/shared.js';
|
|
4
3
|
/** Execute the dom focus command for a watcher id. */
|
|
5
|
-
export const runDomFocus =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
output.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (successResp.matches === 0) {
|
|
32
|
-
writeNoElementFound(target.selector ?? target.ref, output);
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const label = successResp.focused === 1 ? 'element' : 'elements';
|
|
36
|
-
output.writeHuman(`Focused ${successResp.focused} ${label} for ${describeElementTarget(target)}`);
|
|
37
|
-
};
|
|
4
|
+
export const runDomFocus = defineWatcherCommand({
|
|
5
|
+
build: (_args, options, output) => {
|
|
6
|
+
const target = requireElementTarget({ selector: options.selector, ref: options.ref }, output);
|
|
7
|
+
if (!target)
|
|
8
|
+
return null;
|
|
9
|
+
return {
|
|
10
|
+
path: '/dom/focus',
|
|
11
|
+
method: 'POST',
|
|
12
|
+
body: {
|
|
13
|
+
selector: target.selector,
|
|
14
|
+
ref: target.ref,
|
|
15
|
+
all: options.all ?? false,
|
|
16
|
+
text: options.text,
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
formatHuman: (response, { output, options }) => {
|
|
21
|
+
const target = { selector: options.selector, ref: options.ref };
|
|
22
|
+
if (response.matches === 0) {
|
|
23
|
+
writeNoElementFound(target.selector ?? target.ref, output);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const label = response.focused === 1 ? 'element' : 'elements';
|
|
27
|
+
output.writeHuman(`Focused ${response.focused} ${label} for ${describeElementTarget(target)}`);
|
|
28
|
+
},
|
|
29
|
+
});
|
|
38
30
|
//# sourceMappingURL=domFocus.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domFocus.js","sourceRoot":"","sources":["../../src/commands/domFocus.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"domFocus.js","sourceRoot":"","sources":["../../src/commands/domFocus.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AACrE,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAWlG,sDAAsD;AACtD,MAAM,CAAC,MAAM,WAAW,GAAG,oBAAoB,CAAoC;IAClF,KAAK,EAAE,CAAC,KAAK,EAAE,OA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export declare const runDomHover: (
|
|
10
|
+
export declare const runDomHover: import("../cli/defineWatcherCommand.js").WatcherCommandRunner<[], DomHoverOptions>;
|
|
11
11
|
//# sourceMappingURL=domHover.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domHover.d.ts","sourceRoot":"","sources":["../../src/commands/domHover.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"domHover.d.ts","sourceRoot":"","sources":["../../src/commands/domHover.ts"],"names":[],"mappings":"AAIA,yCAAyC;AACzC,MAAM,MAAM,eAAe,GAAG;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,OAAO,CAAA;CACd,CAAA;AAED,sDAAsD;AACtD,eAAO,MAAM,WAAW,oFAyBtB,CAAA"}
|
|
@@ -1,38 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { requestWatcherAction } from '../watchers/requestWatcher.js';
|
|
1
|
+
import { defineWatcherCommand } from '../cli/defineWatcherCommand.js';
|
|
3
2
|
import { describeElementTarget, requireElementTarget, writeNoElementFound } from './dom/shared.js';
|
|
4
3
|
/** Execute the dom hover command for a watcher id. */
|
|
5
|
-
export const runDomHover =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
output.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (successResp.matches === 0) {
|
|
32
|
-
writeNoElementFound(target.selector ?? target.ref, output);
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const label = successResp.hovered === 1 ? 'element' : 'elements';
|
|
36
|
-
output.writeHuman(`Hovered ${successResp.hovered} ${label} for ${describeElementTarget(target)}`);
|
|
37
|
-
};
|
|
4
|
+
export const runDomHover = defineWatcherCommand({
|
|
5
|
+
build: (_args, options, output) => {
|
|
6
|
+
const target = requireElementTarget({ selector: options.selector, ref: options.ref }, output);
|
|
7
|
+
if (!target)
|
|
8
|
+
return null;
|
|
9
|
+
return {
|
|
10
|
+
path: '/dom/hover',
|
|
11
|
+
method: 'POST',
|
|
12
|
+
body: {
|
|
13
|
+
selector: target.selector,
|
|
14
|
+
ref: target.ref,
|
|
15
|
+
all: options.all ?? false,
|
|
16
|
+
text: options.text,
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
formatHuman: (response, { output, options }) => {
|
|
21
|
+
const target = { selector: options.selector, ref: options.ref };
|
|
22
|
+
if (response.matches === 0) {
|
|
23
|
+
writeNoElementFound(target.selector ?? target.ref, output);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const label = response.hovered === 1 ? 'element' : 'elements';
|
|
27
|
+
output.writeHuman(`Hovered ${response.hovered} ${label} for ${describeElementTarget(target)}`);
|
|
28
|
+
},
|
|
29
|
+
});
|
|
38
30
|
//# sourceMappingURL=domHover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domHover.js","sourceRoot":"","sources":["../../src/commands/domHover.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"domHover.js","sourceRoot":"","sources":["../../src/commands/domHover.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AACrE,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAWlG,sDAAsD;AACtD,MAAM,CAAC,MAAM,WAAW,G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
9
9
|
};
|
|
10
10
|
/** Execute the dom info command for a watcher id. */
|
|
11
|
-
export declare const runDomInfo: (
|
|
11
|
+
export declare const runDomInfo: import("../cli/defineWatcherCommand.js").WatcherCommandRunner<[], DomInfoOptions>;
|
|
12
12
|
//# sourceMappingURL=domInfo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domInfo.d.ts","sourceRoot":"","sources":["../../src/commands/domInfo.ts"],"names":[],"mappings":"AAOA,wCAAwC;AACxC,MAAM,MAAM,cAAc,GAAG;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,OAAO,CAAA;CACd,CAAA;AAED,qDAAqD;AACrD,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"domInfo.d.ts","sourceRoot":"","sources":["../../src/commands/domInfo.ts"],"names":[],"mappings":"AAOA,wCAAwC;AACxC,MAAM,MAAM,cAAc,GAAG;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,OAAO,CAAA;CACd,CAAA;AAED,qDAAqD;AACrD,eAAO,MAAM,UAAU,mFAYrB,CAAA"}
|
package/dist/commands/domInfo.js
CHANGED
|
@@ -1,23 +1,32 @@
|
|
|
1
1
|
import { formatDomInfo } from '../output/dom.js';
|
|
2
|
-
import { createOutput } from '../output/io.js';
|
|
3
2
|
import { parsePositiveInt } from '../cli/parse.js';
|
|
4
|
-
import {
|
|
3
|
+
import { defineWatcherCommand } from '../cli/defineWatcherCommand.js';
|
|
5
4
|
import { requireElementTarget, writeNoElementFound } from './dom/shared.js';
|
|
6
5
|
/** Execute the dom info command for a watcher id. */
|
|
7
|
-
export const runDomInfo =
|
|
8
|
-
|
|
6
|
+
export const runDomInfo = defineWatcherCommand({
|
|
7
|
+
build: (_args, options, output) => buildDomInfoPlan(options, output),
|
|
8
|
+
formatHuman: (response, { output, options }) => {
|
|
9
|
+
const target = { selector: options.selector, ref: options.ref };
|
|
10
|
+
if (response.matches === 0) {
|
|
11
|
+
writeNoElementFound(target.selector ?? target.ref, output);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const formatted = formatDomInfo(response.elements);
|
|
15
|
+
output.writeHuman(formatted);
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
const buildDomInfoPlan = (options, output) => {
|
|
9
19
|
const target = requireElementTarget({ selector: options.selector, ref: options.ref }, output);
|
|
10
20
|
if (!target) {
|
|
11
|
-
return;
|
|
21
|
+
return null;
|
|
12
22
|
}
|
|
13
23
|
const outerHtmlMaxChars = parsePositiveInt(options.outerHtmlMax);
|
|
14
24
|
if (options.outerHtmlMax !== undefined && outerHtmlMaxChars === undefined) {
|
|
15
25
|
output.writeWarn('--outer-html-max must be a positive integer');
|
|
16
26
|
process.exitCode = 2;
|
|
17
|
-
return;
|
|
27
|
+
return null;
|
|
18
28
|
}
|
|
19
|
-
|
|
20
|
-
id,
|
|
29
|
+
return {
|
|
21
30
|
path: '/dom/info',
|
|
22
31
|
method: 'POST',
|
|
23
32
|
body: {
|
|
@@ -28,20 +37,6 @@ export const runDomInfo = async (id, options) => {
|
|
|
28
37
|
text: options.text,
|
|
29
38
|
},
|
|
30
39
|
timeoutMs: 30_000,
|
|
31
|
-
}
|
|
32
|
-
if (!result) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const successResp = result.data;
|
|
36
|
-
if (options.json) {
|
|
37
|
-
output.writeJson(successResp);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (successResp.matches === 0) {
|
|
41
|
-
writeNoElementFound(target.selector ?? target.ref, output);
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
const formatted = formatDomInfo(successResp.elements);
|
|
45
|
-
output.writeHuman(formatted);
|
|
40
|
+
};
|
|
46
41
|
};
|
|
47
42
|
//# sourceMappingURL=domInfo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domInfo.js","sourceRoot":"","sources":["../../src/commands/domInfo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"domInfo.js","sourceRoot":"","sources":["../../src/commands/domInfo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,oBAAoB,EAA2B,MAAM,gCAAgC,CAAA;AAE9F,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAY3E,qDAAqD;AACrD,MAAM,CAAC,MAAM,UAAU,GAAG,oBAAoB,CAAkC;IAC/E,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC;IACpE,WAAW,EAAE,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE;QAC9C,MAAM,MAAM,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAA;QAC/D,IAAI,QAAQ,CAAC,OAAO,KAAK,CAAC,EAAE,CAAC;YAC5B,mBAAmB,CAAC,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,GAAI,EAAE,MAAM,CAAC,CAAA;YAC3D,OAAM;QACP,CAAC;QAED,MAAM,SAAS,GAAG,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;QAClD,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAA;IAC7B,CAAC;CACD,CAAC,CAAA;AAEF,MAAM,gBAAgB,GAAG,CAAC,OAAuB,EAAE,MAAc,EAA6B,EAAE;IAC/F,MAAM,MAAM,GAAG,oBAAoB,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC,CAAA;IAC7F,IAAI,CAAC,MAAM,EAAE,CAAC;QACb,OAAO,IAAI,CAAA;IACZ,CAAC;IAED,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;IAChE,IAAI,OAAO,CAAC,YAAY,KAAK,SAAS,IAAI,iBAAiB,KAAK,SAAS,EAAE,CAAC;QAC3E,MAAM,CAAC,SAAS,CAAC,6CAA6C,CAAC,CAAA;QAC/D,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;QACpB,OAAO,IAAI,CAAA;IACZ,CAAC;IAED,OAAO;QACN,IAAI,EAAE,WAAW;QACjB,MAAM,EAAE,MAAM;QACd,IAAI,EAAE;YACL,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,GAAG,EAAE,MAAM,CAAC,GAAG;YACf,GAAG,EAAE,OAAO,CAAC,GAAG,IAAI,KAAK;YACzB,iBAAiB;YACjB,IAAI,EAAE,OAAO,CAAC,IAAI;SAClB;QACD,SAAS,EAAE,MAAM;KACjB,CAAA;AACF,CAAC,CAAA"}
|
|
@@ -6,5 +6,5 @@ export type DomKeydownOptions = {
|
|
|
6
6
|
json?: boolean;
|
|
7
7
|
};
|
|
8
8
|
/** Execute the dom keydown command for a watcher id. */
|
|
9
|
-
export declare const runDomKeydown: (
|
|
9
|
+
export declare const runDomKeydown: import("../cli/defineWatcherCommand.js").WatcherCommandRunner<[], DomKeydownOptions>;
|
|
10
10
|
//# sourceMappingURL=domKeydown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domKeydown.d.ts","sourceRoot":"","sources":["../../src/commands/domKeydown.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"domKeydown.d.ts","sourceRoot":"","sources":["../../src/commands/domKeydown.ts"],"names":[],"mappings":"AAGA,2CAA2C;AAC3C,MAAM,MAAM,iBAAiB,GAAG;IAC/B,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,CAAA;CACd,CAAA;AAED,wDAAwD;AACxD,eAAO,MAAM,aAAa,sFAqBxB,CAAA"}
|
|
@@ -1,46 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { requestWatcherJson, writeRequestError } from '../watchers/requestWatcher.js';
|
|
1
|
+
import { defineWatcherCommand } from '../cli/defineWatcherCommand.js';
|
|
3
2
|
/** Execute the dom keydown command for a watcher id. */
|
|
4
|
-
export const runDomKeydown =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
const result = await requestWatcherJson({
|
|
12
|
-
id,
|
|
13
|
-
path: '/dom/keydown',
|
|
14
|
-
method: 'POST',
|
|
15
|
-
body: {
|
|
16
|
-
key: options.key,
|
|
17
|
-
selector: options.selector,
|
|
18
|
-
modifiers: options.modifiers,
|
|
19
|
-
},
|
|
20
|
-
timeoutMs: 30_000,
|
|
21
|
-
returnErrorResponse: true,
|
|
22
|
-
});
|
|
23
|
-
if (!result.ok) {
|
|
24
|
-
writeRequestError(result, output);
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
const response = result.data;
|
|
28
|
-
if (!response.ok) {
|
|
29
|
-
const errorResp = response;
|
|
30
|
-
if (options.json) {
|
|
31
|
-
output.writeJson(response);
|
|
3
|
+
export const runDomKeydown = defineWatcherCommand({
|
|
4
|
+
build: (_args, options, output) => {
|
|
5
|
+
if (!options.key || options.key.trim() === '') {
|
|
6
|
+
output.writeWarn('--key is required');
|
|
7
|
+
process.exitCode = 2;
|
|
8
|
+
return null;
|
|
32
9
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
};
|
|
10
|
+
return {
|
|
11
|
+
path: '/dom/keydown',
|
|
12
|
+
method: 'POST',
|
|
13
|
+
body: {
|
|
14
|
+
key: options.key,
|
|
15
|
+
selector: options.selector,
|
|
16
|
+
modifiers: options.modifiers,
|
|
17
|
+
},
|
|
18
|
+
timeoutMs: 30_000,
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
formatHuman: (response, { output }) => {
|
|
22
|
+
output.writeHuman(`Dispatched keydown: ${response.key}`);
|
|
23
|
+
},
|
|
24
|
+
});
|
|
46
25
|
//# sourceMappingURL=domKeydown.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domKeydown.js","sourceRoot":"","sources":["../../src/commands/domKeydown.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"domKeydown.js","sourceRoot":"","sources":["../../src/commands/domKeydown.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AAUrE,wDAAwD;AACxD,MAAM,CAAC,MAAM,aAAa,GAAG,oBAAoB,CAAwC;IACxF,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;QACjC,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YAC/C,MAAM,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAA;YACrC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;YACpB,OAAO,IAAI,CAAA;QACZ,CAAC;QACD,OAAO;YACN,IAAI,EAAE,cAAc;YACpB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACL,GAAG,EAAE,OAAO,CAAC,GAAG;gBAChB,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,SAAS,EAAE,OAAO,CAAC,SAAS;aAC5B;YACD,SAAS,EAAE,MAAM;SACjB,CAAA;IACF,CAAC;IACD,WAAW,EAAE,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;QACrC,MAAM,CAAC,UAAU,CAAC,uBAAuB,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAA;IACzD,CAAC;CACD,CAAC,CAAA"}
|
|
@@ -1,37 +1,34 @@
|
|
|
1
|
+
import { defineWatcherCommand } from '../cli/defineWatcherCommand.js';
|
|
1
2
|
import { createOutput } from '../output/io.js';
|
|
2
|
-
import { requestWatcherAction } from '../watchers/requestWatcher.js';
|
|
3
3
|
import { requireSelector, writeNoElementFound } from './dom/shared.js';
|
|
4
4
|
const executeModify = async (id, options, payload, successMessage) => {
|
|
5
|
-
|
|
6
|
-
const selector = requireSelector(options, output);
|
|
7
|
-
if (!selector) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
const result = await requestWatcherAction({
|
|
11
|
-
id,
|
|
12
|
-
path: '/dom/modify',
|
|
13
|
-
method: 'POST',
|
|
14
|
-
body: {
|
|
15
|
-
...payload,
|
|
16
|
-
selector,
|
|
17
|
-
...(options.text != null ? { text: options.text } : {}),
|
|
18
|
-
},
|
|
19
|
-
timeoutMs: 30_000,
|
|
20
|
-
}, output);
|
|
21
|
-
if (!result) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
const successResp = result.data;
|
|
25
|
-
if (options.json) {
|
|
26
|
-
output.writeJson(successResp);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (successResp.matches === 0) {
|
|
30
|
-
writeNoElementFound(selector, output);
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
output.writeHuman(successMessage(successResp));
|
|
5
|
+
await runDomModifyRequest(id, payload, successMessage, options);
|
|
34
6
|
};
|
|
7
|
+
const runDomModifyRequest = defineWatcherCommand({
|
|
8
|
+
build: ([payload], options, output) => {
|
|
9
|
+
const selector = requireSelector(options, output);
|
|
10
|
+
if (!selector) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
path: '/dom/modify',
|
|
15
|
+
method: 'POST',
|
|
16
|
+
body: {
|
|
17
|
+
...payload,
|
|
18
|
+
selector,
|
|
19
|
+
...(options.text != null ? { text: options.text } : {}),
|
|
20
|
+
},
|
|
21
|
+
timeoutMs: 30_000,
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
formatHuman: (successResp, { output, options, args }) => {
|
|
25
|
+
if (successResp.matches === 0) {
|
|
26
|
+
writeNoElementFound(options.selector, output);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
output.writeHuman(args[1](successResp));
|
|
30
|
+
},
|
|
31
|
+
});
|
|
35
32
|
/**
|
|
36
33
|
* Parse attribute arguments: "name" (boolean) or "name=value".
|
|
37
34
|
*/
|