1import _resActionsH from './index.mts'2import { availActionsCtx } from '../../ctxF/availActionsCtxF.mts'3import { filterObj } from '../../../sharedF/objF.mts'4import { resPlainAction } from './resPlainActionF.mts'5import { isApplyishAction } from '../applyishActionF.mts'6import { rewriteResourceImgRefs } from '../initialSetupF/regcacheF/rewriteImgRefsAI.mts'7import type { KubeResource } from '../ctxF/klusterCtxF.mts'9export const resActionsH = () => _resActionsH11type Res1ActionProps = {12 action?: string13 resource: KubeResource14 cluster_name?: string15 noDelPvcs?: boolean16}18export const res1Action = async ({action, resource, cluster_name, noDelPvcs}: Res1ActionProps) => {19 if (isApplyishAction(action) && action !== 'apply') action = 'apply'20 if (action === 'apply' || action === 'resources') resource = await rewriteResourceImgRefs(resource)21 const fncsH = {22 ...resActionsH(),24 if (!(val as any)?.runActionPerK8sRes) return25 return [key, val] as [string, unknown]26 }),27 } as Record<string, ((props: {resource: KubeResource, cluster_name?: string}) => Promise<void>) | undefined>28 const resActionFnc = action ? fncsH[action] : undefined29 if (resActionFnc) {30 await resActionFnc({resource, cluster_name})31 return32 }33 return await resPlainAction({action: action as Parameters<typeof resPlainAction>[0]['action'], resource, cluster_name, noDelPvcs})34}