1import { runAction } from '../cliF/runActionF.mts'2import { wrapKubeCoalesce } from './kubeCoalesceF.mts'3import { isActionSupported } from './isActionSupportedF.mts'4import { resourcesActionCore } from './resourcesActionCoreF.mts'5import { getKlusterCtx, type KubeResource } from './ctxF/klusterCtxF.mts'6import { getAction } from '../ctxF/actionCtxF.mts'8type ResourcesActionInnerProps = {9 resources: KubeResource[]10 noDelPvcs?: boolean11 skipCustomActions?: boolean12 [key: string]: any13}15const resourcesActionInner = async ({16 resources,17 noDelPvcs=true,18 skipCustomActions=false,19 ...props20}: ResourcesActionInnerProps) => {21 const {cluster_name} = getKlusterCtx(props)23 if (!skipCustomActions && !isActionSupported(action) && await runAction({action})) {24 // for skipping actions that shld run once per-app not per-resource like dbconsole25 return26 }28 return await resourcesActionCore({resources, action, cluster_name, noDelPvcs})29}31export const resourcesAction = async (props?: ResourcesActionInnerProps) => {32 return await wrapKubeCoalesce(resourcesActionInner, props)33}