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

Function executeReadTSVFromPackNode

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

Source from the content-addressed store, hash-verified

6201}
6202
6203async function executeReadTSVFromPackNode(
6204 nodeId: string,
6205 textValue: string,
6206 inputData: any,
6207 config?: unknown,
6208 executionContext?: FlowExecutionContext,
6209): Promise<NodeExecutionResult> {
6210 hotPathLog(executionContext, `ReadTSVFromPack Node ${nodeId}: Processing with input:`, inputData);
6211
6212 // Handle both array input (new format with two inputs) and single input (backward compatibility)
6213 let schemaData: any;
6214 let packsData: any = null;
6215
6216 if (Array.isArray(inputData)) {
6217 // New format: [schemaData, packsData]
6218 [schemaData, packsData] = inputData;
6219 } else {
6220 // Old format: single schemaData input
6221 schemaData = inputData;
6222 }
6223
6224 if (!schemaData || schemaData.type !== "CustomSchema") {
6225 return { success: false, error: "Invalid input: Expected CustomSchema data" };
6226 }
6227
6228 // Parse configuration from textValue
6229 let tsvFileName = "";
6230 const schemaColumns = (schemaData.schemaColumns || []) as CustomSchemaColumn[];
6231
6232 hotPathLog(executionContext, `ReadTSVFromPack Node ${nodeId}: textValue received:`, textValue);
6233
6234 const parsed = getNodeConfig<{ tsvFileName?: string }>(config, textValue);
6235 if (!parsed) {
6236 return {
6237 success: false,
6238 error: "Invalid configuration: Failed to parse node settings",
6239 };
6240 }
6241 tsvFileName = parsed.tsvFileName || "";
6242
6243 if (!tsvFileName) {
6244 hotPathLog(executionContext, `ReadTSVFromPack Node ${nodeId}: No TSV file specified - returning empty output`);
6245 return {
6246 success: true,
6247 data: {
6248 type: "TableSelection",
6249 tables: [],
6250 sourceFiles: [],
6251 tableCount: 0,
6252 } as DBTablesNodeData,
6253 };
6254 }
6255
6256 if (schemaColumns.length === 0) {
6257 hotPathLog(executionContext, `ReadTSVFromPack Node ${nodeId}: No schema columns - returning empty output`);
6258 return {
6259 success: true,
6260 data: {

Callers 1

executeNodeActionFunction · 0.85

Calls 3

hotPathLogFunction · 0.85
getNodeConfigFunction · 0.85
readPackCachedFunction · 0.85

Tested by

no test coverage detected