import { queryClient } from '../commands/_app.js';
import { readForgeArtifact } from '../forge/readForgeArtifact.js';
import { useQuery } from '@tanstack/react-query';
export const getForgeArtifactQueryParams = (artifactPath) => {
    return {
        queryKey: ['forgeArtifact', artifactPath],
        queryFn: () => readForgeArtifact(artifactPath),
    };
};
export const queryForgeArtifact = async (artifactPath) => {
    return queryClient.fetchQuery(getForgeArtifactQueryParams(artifactPath));
};
export const useForgeArtifact = (artifactPath) => {
    return useQuery({
        ...getForgeArtifactQueryParams(artifactPath),
        staleTime: Infinity, // For the duration of the CLI session, we want to use the cached artifact
    });
};
