hunk.code_window: }
   // Deploy executes the docker stack deploy command.
   func (manager *SwarmStackManager) Deploy(stack *portainer.Stack, prune bool, pullImage bool, endpoint *portainer.Endpoint) error {
   	filePaths := stackutils.GetStackFilePaths(stack, false)
   	command, args, err := manager.prepareDockerCommandAndArgs(manager.binaryPath, manager.configPath, endpoint)
   	if err != nil {
   		return err
   	}
  
hunk.labels: keep keep keep keep replace keep keep keep keep
hunk.after_edit: 	filePaths := stackutils.GetStackFilePaths(stack, true)
  
hunk.file_path: api/exec/swarm_stack.go
hunk.type: replace
file: import { useQuery } from 'react-query';
  
  import axios, { parseAxiosError } from '@/portainer/services/axios';
  import { withError } from '@/react-tools/react-query';
  
  import { semverCompare } from '../common/utils';
  
  import { queryKeys } from './query-keys';
  import { buildUrl } from './urls';
  
  export function useSupportedAgentVersions(
    minVersion?: string,
    { onSuccess }: { onSuccess?(data: string[]): void } = {}
  ) {
    return useQuery(
      [...queryKeys.supportedAgentVersions(), { minVersion }],
      getSupportedAgentVersions,
      {
        select(versions) {
          if (!minVersion) {
            return versions;
          }
  
          return versions.filter(
            (version) => semverCompare(version, minVersion) > 0
          );
        },
        onSuccess,
        ...withError('failed fetching available agent versions'),
      }
    );
  }
  
  async function getSupportedAgentVersions() {
    try {
      const { data } = await axios.get<string[]>(
        buildUrl(undefined, 'agent_versions')
      );
      return data;
    } catch (err) {
      throw parseAxiosError(
        err as Error,
        'Failed to get list of edge update schedules'
      );
    }
  }
  