All files / src/utils workItemTypes.ts

100% Statements 7/7
100% Branches 2/2
100% Functions 1/1
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 273x 3x                       3x   5x 5x     5x         4x    
import { ConnectionManager } from "../services/ConnectionManager";
import { GET_WORK_ITEM_TYPES } from "../graphql/workItems";
 
// Define interface for work item type objects
interface WorkItemType {
  id: string;
  name: string;
}
 
/**
 * Internal utility function to get work item types for a namespace
 * This is NOT exposed as a tool - it's for internal use only
 */
export async function getWorkItemTypes(namespace: string): Promise<WorkItemType[]> {
  // Get GraphQL client from ConnectionManager
  const connectionManager = ConnectionManager.getInstance();
  const client = connectionManager.getClient();
 
  // Use GraphQL query for getting work item types
  const response = await client.request(GET_WORK_ITEM_TYPES, {
    namespacePath: namespace,
  });
 
  // Return the work item types in the expected format
  return response.namespace?.workItemTypes?.nodes ?? [];
}