@stubber/virtual-worker 1.5.0 → 1.5.1
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.
|
@@ -4,11 +4,11 @@ import { clear_chromium_sessions, list_chromium_sessions } from "../../helpers/g
|
|
|
4
4
|
/**
|
|
5
5
|
*
|
|
6
6
|
* @param {Object} params
|
|
7
|
-
* @param {
|
|
7
|
+
* @param {'list'|'delete'|'delete_all'} params.operation - The operation to perform
|
|
8
8
|
* @param {string} [params.session_ids] - The session IDs to delete (required for "delete" operation)
|
|
9
9
|
*/
|
|
10
10
|
export const browser_manage_sessions = async (params, stubber_context) => {
|
|
11
|
-
const { operation
|
|
11
|
+
const { operation, session_ids } = params || {};
|
|
12
12
|
|
|
13
13
|
if (operation === "list") {
|
|
14
14
|
return await list_chromium_sessions();
|
|
@@ -19,7 +19,11 @@ export const browser_manage_sessions = async (params, stubber_context) => {
|
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
return await clear_chromium_sessions(session_ids);
|
|
22
|
+
} else if (operation === "delete_all") {
|
|
23
|
+
const sessions_result = await list_chromium_sessions();
|
|
24
|
+
const all_session_ids = sessions_result.payload.sessions;
|
|
25
|
+
return await clear_chromium_sessions(all_session_ids);
|
|
22
26
|
} else {
|
|
23
|
-
return create_error_conceptual({ message: "Invalid operation. Must be 'list' or '
|
|
27
|
+
return create_error_conceptual({ message: "Invalid operation. Must be 'list', 'delete', or 'delete_all'." });
|
|
24
28
|
}
|
|
25
29
|
};
|