import request from '@/utils/request';
// 查询缓存列表
export function listThread(query: any) {
	return request({
		url: '/api/core/runtime/thread',
		method: 'get',
		params: query,
	});
}

export function stopThread(query: any) {
	/*
	{
		path:[
			'/test1/function.js',
			'/test2/function.js,
		]
	}
	*/
	const newQuery = Array.isArray(query) ? query : [query];
	return request({
		method: 'delete',
		url: `/api/core/runtime/thread/stop`,
		params: {
			path: newQuery,
		},
	});
}

// 删除所有缓存
export function stopThreadAll() {
	return request({
		method: 'delete',
		url: `/api/core/runtime/thread/stop`,
		params: {
			path: ['*'],
		},
	});
}
