260322:1648 Correct Coresspondence / Doing RFA / Correct CI
CI Pipeline / build (push) Failing after 12m41s
Build and Deploy / deploy (push) Failing after 2m44s

This commit is contained in:
admin
2026-03-22 16:48:12 +07:00
parent e5deedb42e
commit 11984bfa29
683 changed files with 105251 additions and 29068 deletions
+23 -19
View File
@@ -9,37 +9,41 @@ try {
if (!fs.existsSync(config.SOURCE_PDF_DIR)) {
throw new Error(`PDF Source directory not found at: ${config.SOURCE_PDF_DIR}`);
}
const files = fs.readdirSync(config.SOURCE_PDF_DIR);
// Check write permission to log path
fs.writeFileSync(`${config.LOG_PATH}/.preflight_ok`, new Date().toISOString());
// Grab categories out of the previous node (Fetch Categories) if available
// otherwise use fallback array
let categories = ['Correspondence','RFA','Drawing','Transmittal','Report','Other'];
let categories = ['Correspondence', 'RFA', 'Drawing', 'Transmittal', 'Report', 'Other'];
try {
const upstreamData = $('Fetch Categories').first()?.json?.data;
if (upstreamData && Array.isArray(upstreamData)) {
categories = upstreamData.map(c => c.name || c.type || c); // very loose mapping depending on API response
categories = upstreamData.map((c) => c.name || c.type || c); // very loose mapping depending on API response
}
} catch(e) {}
} catch (e) {}
// Grab existing tags from Fetch Tags node
let existingTags = [];
try {
const tagData = $('Fetch Tags').first()?.json?.data || [];
existingTags = Array.isArray(tagData) ? tagData.map(t => t.tag_name || t.name || '').filter(Boolean) : [];
} catch(e) {}
return [{ json: {
preflight_ok: true,
pdf_count_in_source: files.length,
excel_target: config.EXCEL_FILE,
system_categories: categories,
existing_tags: existingTags,
timestamp: new Date().toISOString()
}}];
existingTags = Array.isArray(tagData) ? tagData.map((t) => t.tag_name || t.name || '').filter(Boolean) : [];
} catch (e) {}
return [
{
json: {
preflight_ok: true,
pdf_count_in_source: files.length,
excel_target: config.EXCEL_FILE,
system_categories: categories,
existing_tags: existingTags,
timestamp: new Date().toISOString(),
},
},
];
} catch (err) {
throw new Error(`Pre-flight check failed: ${err.message}`);
}
}