@vforsh/argus 0.1.13 → 0.1.14
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 +2905 -1424
- 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 +95 -0
- package/dist/cli/defineWatcherCommand.d.ts.map +1 -0
- package/dist/cli/defineWatcherCommand.js +72 -0
- package/dist/cli/defineWatcherCommand.js.map +1 -0
- package/dist/cli/register/index.d.ts.map +1 -1
- package/dist/cli/register/index.js +6 -2
- package/dist/cli/register/index.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 +7 -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/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/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/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/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/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 +1 -1
- package/dist/commands/domScroll.d.ts.map +1 -1
- package/dist/commands/domScroll.js +1 -1
- package/dist/commands/domScroll.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/eval.d.ts +2 -0
- package/dist/commands/eval.d.ts.map +1 -1
- package/dist/commands/eval.js +15 -9
- package/dist/commands/eval.js.map +1 -1
- package/dist/commands/evalShared.d.ts +11 -0
- package/dist/commands/evalShared.d.ts.map +1 -1
- package/dist/commands/evalShared.js +21 -0
- package/dist/commands/evalShared.js.map +1 -1
- package/dist/commands/evalUntil.d.ts +2 -0
- package/dist/commands/evalUntil.d.ts.map +1 -1
- package/dist/commands/evalUntil.js +14 -8
- 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/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/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/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/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 +1 -0
- package/dist/commands/screenshot.d.ts.map +1 -1
- package/dist/commands/screenshot.js +37 -2
- 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.map +1 -1
- package/dist/commands/watcherStatus.js +2 -1
- package/dist/commands/watcherStatus.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/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
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { appendNetCommandParams } from './netShared.js';
|
|
2
|
+
import { formatWebSocketDetail, formatWebSocketSummary } from '../output/net.js';
|
|
3
|
+
import { createOutput } from '../output/io.js';
|
|
4
|
+
import { requestWatcherAction } from '../watchers/requestWatcher.js';
|
|
5
|
+
export const runNetWebSocket = async (id, options) => {
|
|
6
|
+
const output = createOutput(options);
|
|
7
|
+
const params = new URLSearchParams();
|
|
8
|
+
const query = appendNetCommandParams(params, options);
|
|
9
|
+
if (query.error) {
|
|
10
|
+
output.writeWarn(query.error);
|
|
11
|
+
process.exitCode = 2;
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const result = await requestWatcherAction({ id, path: '/net/ws', query: params, timeoutMs: 5_000 }, output);
|
|
15
|
+
if (!result) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (options.json) {
|
|
19
|
+
output.writeJson(result.data.connections);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
for (const connection of result.data.connections) {
|
|
23
|
+
output.writeHuman(formatWebSocketSummary(connection));
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
export const runNetWebSocketShow = async (id, connection, options) => {
|
|
27
|
+
const output = createOutput(options);
|
|
28
|
+
const query = buildConnectionQuery(connection, output);
|
|
29
|
+
if (!query) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const result = await requestWatcherAction({ id, path: '/net/ws/connection', query, timeoutMs: 5_000 }, output);
|
|
33
|
+
if (!result) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (options.json) {
|
|
37
|
+
output.writeJson(result.data.connection);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
for (const line of formatWebSocketDetail(result.data.connection)) {
|
|
41
|
+
output.writeHuman(line);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const buildConnectionQuery = (connection, output) => {
|
|
45
|
+
const query = new URLSearchParams();
|
|
46
|
+
if (/^\d+$/.test(connection)) {
|
|
47
|
+
query.set('id', connection);
|
|
48
|
+
return query;
|
|
49
|
+
}
|
|
50
|
+
if (!connection.trim()) {
|
|
51
|
+
output.writeWarn('Missing WebSocket connection id.');
|
|
52
|
+
process.exitCode = 2;
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
query.set('requestId', connection);
|
|
56
|
+
return query;
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=netWebSocket.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"netWebSocket.js","sourceRoot":"","sources":["../../src/commands/netWebSocket.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,C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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Shared flags for `argus page show` / `argus page hide`. */
|
|
2
|
+
export type PageVisibilityOptions = {
|
|
3
|
+
json?: boolean;
|
|
4
|
+
};
|
|
5
|
+
/** `argus page show <id>` — lock the page into shown+focused state. */
|
|
6
|
+
export declare const runPageShow: (id: string | undefined, options: PageVisibilityOptions) => Promise<void>;
|
|
7
|
+
/** `argus page hide <id>` — release the visibility lock. */
|
|
8
|
+
export declare const runPageHide: (id: string | undefined, options: PageVisibilityOptions) => Promise<void>;
|
|
9
|
+
//# sourceMappingURL=pageVisibility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageVisibility.d.ts","sourceRoot":"","sources":["../../src/commands/pageVisibility.ts"],"names":[],"mappings":"AAGA,8DAA8D;AAC9D,MAAM,MAAM,qBAAqB,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,CAAA;AAuBtD,uEAAuE;AACvE,eAAO,MAAM,WAAW,GAAI,IAAI,MAAM,GAAG,SAAS,EAAE,SAAS,qBAAqB,KAAG,OAAO,CAAC,IAAI,CAA0C,CAAA;AAE3I,4DAA4D;AAC5D,eAAO,MAAM,WAAW,GAAI,IAAI,MAAM,GAAG,SAAS,EAAE,SAAS,qBAAqB,KAAG,OAAO,CAAC,IAAI,CAA0C,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { defineWatcherCommand } from '../cli/defineWatcherCommand.js';
|
|
2
|
+
/** Internal runner — the public `runPageShow`/`runPageHide` wrappers thread the action through as a positional arg. */
|
|
3
|
+
const visibilityRunner = defineWatcherCommand({
|
|
4
|
+
build: ([action]) => ({
|
|
5
|
+
path: '/visibility',
|
|
6
|
+
method: 'POST',
|
|
7
|
+
body: { action },
|
|
8
|
+
timeoutMs: 5_000,
|
|
9
|
+
}),
|
|
10
|
+
formatHuman: (data, { output, watcher, args: [action] }) => {
|
|
11
|
+
if (!data.attached) {
|
|
12
|
+
// Desired state is remembered in the watcher; it will apply on reattach.
|
|
13
|
+
const suffix = action === 'show' ? ' (will apply on reattach)' : '';
|
|
14
|
+
output.writeHuman(`page ${action} queued for ${watcher.id}${suffix}`);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
output.writeHuman(`${data.state === 'shown' ? 'shown' : 'hidden'} ${watcher.id}`);
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
/** `argus page show <id>` — lock the page into shown+focused state. */
|
|
21
|
+
export const runPageShow = (id, options) => visibilityRunner(id, 'show', options);
|
|
22
|
+
/** `argus page hide <id>` — release the visibility lock. */
|
|
23
|
+
export const runPageHide = (id, options) => visibilityRunner(id, 'hide', options);
|
|
24
|
+
//# sourceMappingURL=pageVisibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageVisibility.js","sourceRoot":"","sources":["../../src/commands/pageVisibility.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AAOrE,uHAAuH;AACvH,MAAM,gBAAgB,GAAG,oBAAoB,CAAqF;IACjI,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;QACrB,IAAI,EAAE,aAAa;QACnB,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,EAAE,MAAM,EAAE;QAChB,SAAS,EAAE,KAAK;KAChB,CAAC;IACF,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE;QAC1D,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACpB,yEAAyE;YACzE,MAAM,MAAM,GAAG,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,EAAE,CAAA;YACnE,MAAM,CAAC,UAAU,CAAC,QAAQ,MAAM,eAAe,OAAO,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC,CAAA;YACrE,OAAM;QACP,CAAC;QACD,MAAM,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC,CAAA;IAClF,CAAC;CACD,CAAC,CAAA;AAEF,uEAAuE;AACvE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAsB,EAAE,OAA8B,EAAiB,EAAE,CAAC,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;AAE3I,4DAA4D;AAC5D,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAsB,EAAE,OAA8B,EAAiB,EAAE,CAAC,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA"}
|
|
@@ -4,5 +4,5 @@ export type ReloadOptions = {
|
|
|
4
4
|
ignoreCache?: boolean;
|
|
5
5
|
};
|
|
6
6
|
/** Execute the reload command for a watcher id. */
|
|
7
|
-
export declare const runReload: (
|
|
7
|
+
export declare const runReload: import("../cli/defineWatcherCommand.js").WatcherCommandRunner<[], ReloadOptions>;
|
|
8
8
|
//# sourceMappingURL=reload.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reload.d.ts","sourceRoot":"","sources":["../../src/commands/reload.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reload.d.ts","sourceRoot":"","sources":["../../src/commands/reload.ts"],"names":[],"mappings":"AAGA,sCAAsC;AACtC,MAAM,MAAM,aAAa,GAAG;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,WAAW,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AAED,mDAAmD;AACnD,eAAO,MAAM,SAAS,kFAUpB,CAAA"}
|
package/dist/commands/reload.js
CHANGED
|
@@ -1,23 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { requestWatcherJson, writeRequestError } from '../watchers/requestWatcher.js';
|
|
1
|
+
import { defineWatcherCommand } from '../cli/defineWatcherCommand.js';
|
|
3
2
|
/** Execute the reload command for a watcher id. */
|
|
4
|
-
export const runReload =
|
|
5
|
-
|
|
6
|
-
const result = await requestWatcherJson({
|
|
7
|
-
id,
|
|
3
|
+
export const runReload = defineWatcherCommand({
|
|
4
|
+
build: (_args, options) => ({
|
|
8
5
|
path: '/reload',
|
|
9
6
|
method: 'POST',
|
|
10
7
|
body: { ignoreCache: options.ignoreCache ?? false },
|
|
11
8
|
timeoutMs: 10_000,
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if (options.json) {
|
|
18
|
-
output.writeJson(result.data);
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
output.writeHuman(`reloaded ${result.watcher.id}`);
|
|
22
|
-
};
|
|
9
|
+
}),
|
|
10
|
+
formatHuman: (_response, { output, watcher }) => {
|
|
11
|
+
output.writeHuman(`reloaded ${watcher.id}`);
|
|
12
|
+
},
|
|
13
|
+
});
|
|
23
14
|
//# sourceMappingURL=reload.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reload.js","sourceRoot":"","sources":["../../src/commands/reload.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"reload.js","sourceRoot":"","sources":["../../src/commands/reload.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AAQrE,mDAAmD;AACnD,MAAM,CAAC,MAAM,SAAS,GAAG,oBAAoB,CAAgC;IAC5E,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;QAC3B,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,KAAK,EAAE;QACnD,SAAS,EAAE,MAAM;KACjB,CAAC;IACF,WAAW,EAAE,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE;QAC/C,MAAM,CAAC,UAAU,CAAC,YAAY,OAAO,CAAC,EAAE,EAAE,CAAC,CAAA;IAC5C,CAAC;CACD,CAAC,CAAA"}
|
|
@@ -3,6 +3,7 @@ export type ScreenshotOptions = {
|
|
|
3
3
|
json?: boolean;
|
|
4
4
|
out?: string;
|
|
5
5
|
selector?: string;
|
|
6
|
+
clip?: string;
|
|
6
7
|
};
|
|
7
8
|
/** Execute the screenshot command for a watcher id. */
|
|
8
9
|
export declare const runScreenshot: (id: string | undefined, options: ScreenshotOptions) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screenshot.d.ts","sourceRoot":"","sources":["../../src/commands/screenshot.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"screenshot.d.ts","sourceRoot":"","sources":["../../src/commands/screenshot.ts"],"names":[],"mappings":"AAMA,0CAA0C;AAC1C,MAAM,MAAM,iBAAiB,GAAG;IAC/B,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAED,uDAAuD;AACvD,eAAO,MAAM,aAAa,GAAU,IAAI,MAAM,GAAG,SAAS,EAAE,SAAS,iBAAiB,KAAG,OAAO,CAAC,IAAI,CAqCpG,CAAA"}
|
|
@@ -1,18 +1,29 @@
|
|
|
1
1
|
import { createOutput } from '../output/io.js';
|
|
2
2
|
import { requestWatcherJson, writeRequestError } from '../watchers/requestWatcher.js';
|
|
3
|
+
const SCREENSHOT_REQUEST_TIMEOUT_MS = 45_000;
|
|
3
4
|
/** Execute the screenshot command for a watcher id. */
|
|
4
5
|
export const runScreenshot = async (id, options) => {
|
|
5
6
|
const output = createOutput(options);
|
|
7
|
+
const clip = parseScreenshotClip(options.clip, output);
|
|
8
|
+
if (clip === null) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const selector = normalizeSelector(options.selector);
|
|
12
|
+
if (selector && clip) {
|
|
13
|
+
writeScreenshotOptionError(output, 'Cannot use both --selector and --clip');
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
6
16
|
const result = await requestWatcherJson({
|
|
7
17
|
id,
|
|
8
18
|
path: '/screenshot',
|
|
9
19
|
method: 'POST',
|
|
10
20
|
body: {
|
|
11
21
|
outFile: options.out,
|
|
12
|
-
selector
|
|
22
|
+
selector,
|
|
23
|
+
clip,
|
|
13
24
|
format: 'png',
|
|
14
25
|
},
|
|
15
|
-
timeoutMs:
|
|
26
|
+
timeoutMs: SCREENSHOT_REQUEST_TIMEOUT_MS,
|
|
16
27
|
});
|
|
17
28
|
if (!result.ok) {
|
|
18
29
|
writeRequestError(result, output);
|
|
@@ -24,4 +35,28 @@ export const runScreenshot = async (id, options) => {
|
|
|
24
35
|
}
|
|
25
36
|
output.writeHuman(`Screenshot saved: ${result.data.outFile}`);
|
|
26
37
|
};
|
|
38
|
+
const normalizeSelector = (selector) => {
|
|
39
|
+
const trimmed = selector?.trim();
|
|
40
|
+
return trimmed ? trimmed : undefined;
|
|
41
|
+
};
|
|
42
|
+
const parseScreenshotClip = (value, output) => {
|
|
43
|
+
if (value == null) {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
const parts = value.split(',').map((part) => part.trim());
|
|
47
|
+
if (parts.length !== 4 || parts.some((part) => !part)) {
|
|
48
|
+
writeScreenshotOptionError(output, 'Invalid --clip value: expected x,y,width,height.');
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
const [x, y, width, height] = parts.map(Number);
|
|
52
|
+
if (![x, y, width, height].every(Number.isFinite) || width <= 0 || height <= 0) {
|
|
53
|
+
writeScreenshotOptionError(output, 'Invalid --clip value: x and y must be finite numbers; width and height must be > 0.');
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
return { x, y, width, height };
|
|
57
|
+
};
|
|
58
|
+
const writeScreenshotOptionError = (output, message) => {
|
|
59
|
+
output.writeWarn(message);
|
|
60
|
+
process.exitCode = 2;
|
|
61
|
+
};
|
|
27
62
|
//# sourceMappingURL=screenshot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screenshot.js","sourceRoot":"","sources":["../../src/commands/screenshot.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"screenshot.js","sourceRoot":"","sources":["../../src/commands/screenshot.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAe,MAAM,iBAAiB,CAAA;AAC3D,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AAErF,MAAM,6BAA6B,GAAG,MAAM,CAAA;AAU5C,uDAAuD;AACvD,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAAE,EAAsB,EAAE,OAA0B,EAAiB,EAAE;IACxG,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,CAAA;IACpC,MAAM,IAAI,GAAG,mBAAmB,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IACtD,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QACnB,OAAM;IACP,CAAC;IAED,MAAM,QAAQ,GAAG,iBAAiB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;IACpD,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;QACtB,0BAA0B,CAAC,MAAM,EAAE,uCAAuC,CAAC,CAAA;QAC3E,OAAM;IACP,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAqB;QAC3D,EAAE;QACF,IAAI,EAAE,aAAa;QACnB,MAAM,EAAE,MAAM;QACd,IAAI,EAAE;YACL,OAAO,EAAE,OAAO,CAAC,GAAG;YAC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GAAG,CAAC,MAAM,CAAC,CAAA;IAC/C,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;QAChF,0BAA0B,CAAC,MAAM,EAAE,qFAAqF,CAAC,CAAA;QACzH,OAAO,IAAI,CAAA;IACZ,CAAC;IAED,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAA;AAC/B,CAAC,CAAA;AAED,MAAM,0BAA0B,GAAG,CAAC,MAAc,EAAE,OAAe,EAAQ,EAAE;IAC5E,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;IACzB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;AACrB,CAAC,CAAA"}
|
|
@@ -6,5 +6,5 @@ export type SnapshotOptions = {
|
|
|
6
6
|
json?: boolean;
|
|
7
7
|
};
|
|
8
8
|
/** Execute the snapshot command for a watcher id. */
|
|
9
|
-
export declare const runSnapshot: (
|
|
9
|
+
export declare const runSnapshot: import("../cli/defineWatcherCommand.js").WatcherCommandRunner<[], SnapshotOptions>;
|
|
10
10
|
//# sourceMappingURL=snapshot.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../src/commands/snapshot.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../src/commands/snapshot.ts"],"names":[],"mappings":"AAKA,wCAAwC;AACxC,MAAM,MAAM,eAAe,GAAG;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,IAAI,CAAC,EAAE,OAAO,CAAA;CACd,CAAA;AAED,qDAAqD;AACrD,eAAO,MAAM,WAAW,oFAyBtB,CAAA"}
|
|
@@ -1,54 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createOutput } from '../output/io.js';
|
|
1
|
+
import { defineWatcherCommand } from '../cli/defineWatcherCommand.js';
|
|
3
2
|
import { parsePositiveInt } from '../cli/parse.js';
|
|
4
|
-
import {
|
|
3
|
+
import { formatAccessibilityTree } from '../output/accessibility.js';
|
|
5
4
|
/** Execute the snapshot command for a watcher id. */
|
|
6
|
-
export const runSnapshot =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
const result = await requestWatcherJson({
|
|
15
|
-
id,
|
|
16
|
-
path: '/snapshot',
|
|
17
|
-
method: 'POST',
|
|
18
|
-
body: {
|
|
19
|
-
selector: options.selector,
|
|
20
|
-
depth,
|
|
21
|
-
interactive: options.interactive ?? false,
|
|
22
|
-
},
|
|
23
|
-
timeoutMs: 30_000,
|
|
24
|
-
returnErrorResponse: true,
|
|
25
|
-
});
|
|
26
|
-
if (!result.ok) {
|
|
27
|
-
writeRequestError(result, output);
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const response = result.data;
|
|
31
|
-
if (!response.ok) {
|
|
32
|
-
const errorResp = response;
|
|
33
|
-
if (options.json) {
|
|
34
|
-
output.writeJson(response);
|
|
5
|
+
export const runSnapshot = defineWatcherCommand({
|
|
6
|
+
build: (_args, options, output) => {
|
|
7
|
+
const depth = parsePositiveInt(options.depth);
|
|
8
|
+
if (options.depth !== undefined && depth === undefined) {
|
|
9
|
+
output.writeWarn('--depth must be a positive integer');
|
|
10
|
+
process.exitCode = 2;
|
|
11
|
+
return null;
|
|
35
12
|
}
|
|
36
|
-
|
|
37
|
-
|
|
13
|
+
return {
|
|
14
|
+
path: '/snapshot',
|
|
15
|
+
method: 'POST',
|
|
16
|
+
body: {
|
|
17
|
+
selector: options.selector,
|
|
18
|
+
depth,
|
|
19
|
+
interactive: options.interactive ?? false,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
formatHuman: (response, { output }) => {
|
|
24
|
+
if (response.roots.length === 0) {
|
|
25
|
+
output.writeWarn('Accessibility tree is empty.');
|
|
26
|
+
return;
|
|
38
27
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const successResp = response;
|
|
43
|
-
if (options.json) {
|
|
44
|
-
output.writeJson(successResp);
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
if (successResp.roots.length === 0) {
|
|
48
|
-
output.writeWarn('Accessibility tree is empty.');
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
const formatted = formatAccessibilityTree(successResp.roots);
|
|
52
|
-
output.writeHuman(formatted);
|
|
53
|
-
};
|
|
28
|
+
output.writeHuman(formatAccessibilityTree(response.roots));
|
|
29
|
+
},
|
|
30
|
+
});
|
|
54
31
|
//# sourceMappingURL=snapshot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../src/commands/snapshot.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../src/commands/snapshot.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAA;AAUpE,qDAAqD;AACrD,MAAM,CAAC,MAAM,WAAW,GAAG,oBAAoB,CAAoC;IAClF,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;QACjC,MAAM,KAAK,GAAG,gBAAgB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QAC7C,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxD,MAAM,CAAC,SAAS,CAAC,oCAAoC,CAAC,CAAA;YACtD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;YACpB,OAAO,IAAI,CAAA;QACZ,CAAC;QACD,OAAO;YACN,IAAI,EAAE,WAAW;YACjB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACL,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,KAAK;gBACL,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,KAAK;aACzC;SACD,CAAA;IACF,CAAC;IACD,WAAW,EAAE,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;QACrC,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACjC,MAAM,CAAC,SAAS,CAAC,8BAA8B,CAAC,CAAA;YAChD,OAAM;QACP,CAAC;QACD,MAAM,CAAC,UAAU,CAAC,uBAAuB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAA;IAC3D,CAAC;CACD,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/commands/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/commands/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,WAAW,EAOX,MAAM,oBAAoB,CAAA;AAG3B,0CAA0C;AAC1C,MAAM,MAAM,cAAc,GAAG;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,OAAO,CAAA;CACd,CAAA;AAKD,0CAA0C;AAC1C,eAAO,MAAM,aAAa,GAAI,MAAM,WAAW,EAAE,IAAI,MAAM,GAAG,SAAS,EAAE,KAAK,MAAM,EAAE,SAAS,cAAc,KAAG,OAAO,CAAC,IAAI,CACnF,CAAA;AAEzC,0CAA0C;AAC1C,eAAO,MAAM,aAAa,GAAI,MAAM,WAAW,EAAE,IAAI,MAAM,GAAG,SAAS,EAAE,KAAK,MAAM,EAAE,OAAO,MAAM,EAAE,SAAS,cAAc,KAAG,OAAO,CAAC,IAAI,CAC3F,CAAA;AAEhD,6CAA6C;AAC7C,eAAO,MAAM,gBAAgB,GAAI,MAAM,WAAW,EAAE,IAAI,MAAM,GAAG,SAAS,EAAE,KAAK,MAAM,EAAE,SAAS,cAAc,KAAG,OAAO,CAAC,IAAI,CACnF,CAAA;AAE5C,2CAA2C;AAC3C,eAAO,MAAM,cAAc,GAAI,MAAM,WAAW,EAAE,IAAI,MAAM,GAAG,SAAS,EAAE,SAAS,cAAc,KAAG,OAAO,CAAC,IAAI,CAC3E,CAAA;AAErC,4CAA4C;AAC5C,eAAO,MAAM,eAAe,GAAI,MAAM,WAAW,EAAE,IAAI,MAAM,GAAG,SAAS,EAAE,SAAS,cAAc,KAAG,OAAO,CAAC,IAAI,CAC3E,CAAA"}
|
package/dist/commands/storage.js
CHANGED
|
@@ -1,67 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { requestWatcherJson, writeRequestError } from '../watchers/requestWatcher.js';
|
|
1
|
+
import { defineWatcherCommand } from '../cli/defineWatcherCommand.js';
|
|
3
2
|
/** Execute `argus storage <area> get`. */
|
|
4
|
-
export const runStorageGet =
|
|
5
|
-
await runStorageCommand(area, id, { action: 'get', key, origin: options.origin }, options, (response, output) => {
|
|
6
|
-
output.writeHuman(response.value ?? 'null');
|
|
7
|
-
});
|
|
8
|
-
};
|
|
3
|
+
export const runStorageGet = (area, id, key, options) => getRunner(id, key, { ...options, area });
|
|
9
4
|
/** Execute `argus storage <area> set`. */
|
|
10
|
-
export const runStorageSet =
|
|
11
|
-
await runStorageCommand(area, id, { action: 'set', key, value, origin: options.origin }, options, (response, output) => {
|
|
12
|
-
output.writeHuman(`Set ${response.key} on ${response.origin}`);
|
|
13
|
-
});
|
|
14
|
-
};
|
|
5
|
+
export const runStorageSet = (area, id, key, value, options) => setRunner(id, key, value, { ...options, area });
|
|
15
6
|
/** Execute `argus storage <area> remove`. */
|
|
16
|
-
export const runStorageRemove =
|
|
17
|
-
await runStorageCommand(area, id, { action: 'remove', key, origin: options.origin }, options, (response, output) => {
|
|
18
|
-
output.writeHuman(`Removed ${response.key} from ${response.origin}`);
|
|
19
|
-
});
|
|
20
|
-
};
|
|
7
|
+
export const runStorageRemove = (area, id, key, options) => removeRunner(id, key, { ...options, area });
|
|
21
8
|
/** Execute `argus storage <area> list`. */
|
|
22
|
-
export const runStorageList =
|
|
23
|
-
await runStorageCommand(area, id, { action: 'list', origin: options.origin }, options, (response, output) => {
|
|
24
|
-
for (const key of response.keys) {
|
|
25
|
-
output.writeHuman(key);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
};
|
|
9
|
+
export const runStorageList = (area, id, options) => listRunner(id, { ...options, area });
|
|
29
10
|
/** Execute `argus storage <area> clear`. */
|
|
30
|
-
export const runStorageClear =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
if (options.json) {
|
|
42
|
-
output.writeJson(response);
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
writeHuman(response, output);
|
|
46
|
-
};
|
|
47
|
-
const callStorage = async (area, id, payload, output) => {
|
|
48
|
-
const result = await requestWatcherJson({
|
|
49
|
-
id,
|
|
50
|
-
path: `/storage/${area}`,
|
|
11
|
+
export const runStorageClear = (area, id, options) => clearRunner(id, { ...options, area });
|
|
12
|
+
/**
|
|
13
|
+
* Build a runner for one storage command. Bakes in the shared HTTP shape
|
|
14
|
+
* (`POST /storage/<area>` with a 10s timeout); callers supply the per-action
|
|
15
|
+
* payload and human formatter.
|
|
16
|
+
*/
|
|
17
|
+
const storageRunner = (body, formatHuman) => defineWatcherCommand({
|
|
18
|
+
build: (args, options) => ({
|
|
19
|
+
path: `/storage/${options.area}`,
|
|
51
20
|
method: 'POST',
|
|
52
|
-
body:
|
|
21
|
+
body: body(args, options),
|
|
53
22
|
timeoutMs: 10_000,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return null;
|
|
23
|
+
}),
|
|
24
|
+
formatHuman,
|
|
25
|
+
});
|
|
26
|
+
const getRunner = storageRunner(([key], { origin }) => ({ action: 'get', key, origin }), (response, { output }) => output.writeHuman(response.value ?? 'null'));
|
|
27
|
+
const setRunner = storageRunner(([key, value], { origin }) => ({ action: 'set', key, value, origin }), (response, { output }) => output.writeHuman(`Set ${response.key} on ${response.origin}`));
|
|
28
|
+
const removeRunner = storageRunner(([key], { origin }) => ({ action: 'remove', key, origin }), (response, { output }) => output.writeHuman(`Removed ${response.key} from ${response.origin}`));
|
|
29
|
+
const listRunner = storageRunner((_args, { origin }) => ({ action: 'list', origin }), (response, { output }) => {
|
|
30
|
+
for (const key of response.keys) {
|
|
31
|
+
output.writeHuman(key);
|
|
64
32
|
}
|
|
65
|
-
|
|
66
|
-
};
|
|
33
|
+
});
|
|
34
|
+
const clearRunner = storageRunner((_args, { origin }) => ({ action: 'clear', origin }), (response, { output }) => output.writeHuman(`Cleared ${response.cleared} item(s) from ${response.origin}`));
|
|
67
35
|
//# sourceMappingURL=storage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/commands/storage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/commands/storage.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,oBAAoB,EAAyD,MAAM,gCAAgC,CAAA;AAW5H,0CAA0C;AAC1C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAiB,EAAE,EA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E,MAAM,EAAE,EAAE,EAAE;IACxB,KAAK,MAAM,GAAG,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;QACjC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;IACvB,CAAC;AACF,CAAC,CACD,CAAA;AAED,MAAM,WAAW,GAAG,aAAa,CAChC,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,EACpD,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,QAAQ,CAAC,OAAO,iBAAiB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAC1G,CAAA"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
export type ThrottleSetOptions = {
|
|
2
2
|
json?: boolean;
|
|
3
3
|
};
|
|
4
|
-
|
|
4
|
+
/** Execute `argus throttle set <id> <rate>`. */
|
|
5
|
+
export declare const runThrottleSet: import("../cli/defineWatcherCommand.js").WatcherCommandRunner<[rateRaw: string], ThrottleSetOptions>;
|
|
5
6
|
export type ThrottleClearOptions = {
|
|
6
7
|
json?: boolean;
|
|
7
8
|
};
|
|
8
|
-
|
|
9
|
+
/** Execute `argus throttle clear <id>`. */
|
|
10
|
+
export declare const runThrottleClear: import("../cli/defineWatcherCommand.js").WatcherCommandRunner<[], ThrottleClearOptions>;
|
|
9
11
|
export type ThrottleStatusOptions = {
|
|
10
12
|
json?: boolean;
|
|
11
13
|
};
|
|
12
|
-
|
|
14
|
+
/** Execute `argus throttle status <id>`. */
|
|
15
|
+
export declare const runThrottleStatus: import("../cli/defineWatcherCommand.js").WatcherCommandRunner<[], ThrottleStatusOptions>;
|
|
13
16
|
//# sourceMappingURL=throttle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"throttle.d.ts","sourceRoot":"","sources":["../../src/commands/throttle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"throttle.d.ts","sourceRoot":"","sources":["../../src/commands/throttle.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,kBAAkB,GAAG;IAChC,IAAI,CAAC,EAAE,OAAO,CAAA;CACd,CAAA;AAED,gDAAgD;AAChD,eAAO,MAAM,cAAc,sGAyBzB,CAAA;AAMF,MAAM,MAAM,oBAAoB,GAAG;IAClC,IAAI,CAAC,EAAE,OAAO,CAAA;CACd,CAAA;AAED,2CAA2C;AAC3C,eAAO,MAAM,gBAAgB,yFAK3B,CAAA;AAMF,MAAM,MAAM,qBAAqB,GAAG;IACnC,IAAI,CAAC,EAAE,OAAO,CAAA;CACd,CAAA;AAED,4CAA4C;AAC5C,eAAO,MAAM,iBAAiB,0FAc5B,CAAA"}
|