MCPcopy Create free account
hub / github.com/Shazbot/WH3-Mod-Manager / executeGetCounterColumnNode

Function executeGetCounterColumnNode

src/nodeExecutor.ts:5987–6166  ·  view source on GitHub ↗
(
  nodeId: string,
  textValue: string,
  inputData: PackFilesNodeData,
  config?: unknown,
  executionContext?: FlowExecutionContext,
)

Source from the content-addressed store, hash-verified

5985}
5986
5987async function executeGetCounterColumnNode(
5988 nodeId: string,
5989 textValue: string,
5990 inputData: PackFilesNodeData,
5991 config?: unknown,
5992 executionContext?: FlowExecutionContext,
5993): Promise<NodeExecutionResult> {
5994 hotPathLog(executionContext, `GetCounterColumn Node ${nodeId}: Processing with input:`, inputData);
5995
5996 if (!inputData || inputData.type !== "PackFiles") {
5997 return { success: false, error: "Invalid input: Expected PackFiles data" };
5998 }
5999
6000 // Parse configuration from textValue
6001 const parsed = getNodeConfig<{ selectedTable?: string; selectedColumn?: string; newColumnName?: string }>(
6002 config,
6003 textValue,
6004 );
6005 if (!parsed) {
6006 return {
6007 success: false,
6008 error: "Invalid configuration: Failed to parse node settings",
6009 };
6010 }
6011 const selectedTable = parsed.selectedTable || "";
6012 const selectedColumn = parsed.selectedColumn || "";
6013 let newColumnName = parsed.newColumnName || "";
6014
6015 // Use defaults for missing configuration to allow flow to continue
6016 if (!selectedTable) {
6017 hotPathLog(executionContext, `GetCounterColumn Node ${nodeId}: No table selected - returning empty output`);
6018 return {
6019 success: true,
6020 data: {
6021 type: "TableSelection",
6022 tables: [],
6023 sourceFiles: inputData.files || [],
6024 tableCount: 0,
6025 } as DBTablesNodeData,
6026 };
6027 }
6028
6029 if (!selectedColumn) {
6030 hotPathLog(executionContext, `GetCounterColumn Node ${nodeId}: No column selected - returning empty output`);
6031 return {
6032 success: true,
6033 data: {
6034 type: "TableSelection",
6035 tables: [],
6036 sourceFiles: inputData.files || [],
6037 tableCount: 0,
6038 } as DBTablesNodeData,
6039 };
6040 }
6041
6042 // Use default column name if not specified
6043 if (!newColumnName) {
6044 newColumnName = `counter_${selectedColumn}`;

Callers 1

executeNodeActionFunction · 0.85

Calls 5

hotPathLogFunction · 0.85
getNodeConfigFunction · 0.85
getRowsForPackedFileFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected