import{a7 as o,a4 as t}from"./index-dNe6i2rS.js";const a=(e,r)=>{const n={};return e&&(n["X-Trino-Catalog"]=e,r&&(n["X-Trino-Schema"]=r)),n},i=e=>e&&e.includes("/api/")?e.split("/api/")[1]:"",u=o.injectEndpoints({endpoints:e=>({getAdminQueries:e.query({query:()=>({url:"admin/trino/query"}),providesTags:[t.TrinoAdminTag.UIQueries],extraOptions:{skipError:!0}}),getAdminQuery:e.query({query:({queryId:r})=>({url:`admin/trino/query/${r}`}),providesTags:[t.TrinoAdminTag.UIQuery],extraOptions:{skipError:!0}}),getAdminStats:e.query({query:()=>({url:"admin/trino/stats"}),transformResponse:r=>({...r,timestamp:Date.now()}),providesTags:[t.TrinoAdminTag.Stats],extraOptions:{skipError:!0}}),getAdminWorkers:e.query({query:()=>({url:"admin/trino/worker"}),providesTags:[t.TrinoAdminTag.Workers],extraOptions:{skipError:!0}}),getAdminWorker:e.query({query:({workerId:r})=>({url:`admin/trino/worker/${r}/status`}),providesTags:[t.TrinoAdminTag.Worker],extraOptions:{skipError:!0}}),getAdminCluster:e.query({query:()=>({url:"admin/trino/cluster"}),providesTags:[t.TrinoAdminTag.Cluster],extraOptions:{skipError:!0}}),getAdminStatement:e.query({query:r=>({url:i(r)}),extraOptions:{skipError:!0}}),postAdminStatement:e.mutation({query:({sql:r,catalog:n,schema:s})=>({url:"admin/trino/v1/statement",method:"post",headers:a(n,s),data:r})}),deleteAdminStatement:e.mutation({query:r=>({url:i(r),method:"delete"})})})}),{useGetAdminQueriesQuery:d,useGetAdminQueryQuery:p,useGetAdminStatsQuery:y,useGetAdminWorkersQuery:A,useGetAdminWorkerQuery:g,useGetAdminClusterQuery:T,useGetAdminStatementQuery:q,usePostAdminStatementMutation:k,useDeleteAdminStatementMutation:Q}=u;export{y as a,d as b,A as c,p as d,g as e,T as u};
