feat: local-cpl-sim.mjs kabelueberwachung
This commit is contained in:
@@ -69,6 +69,38 @@ function getRelFromRoot(filePath) {
|
||||
function tryServeSpecialMocks(res, relPath) {
|
||||
const rp = relPath.replace(/^\/+/, "");
|
||||
// Serve ready JS/JSON mocks for some routes
|
||||
// Digital Inputs JSON
|
||||
if (rp === "CPL/SERVICE/digitalInputs.json") {
|
||||
const mockPath = path.join(
|
||||
process.cwd(),
|
||||
"mocks",
|
||||
"device-cgi-simulator",
|
||||
"SERVICE",
|
||||
"digitalInputsMockData.json"
|
||||
);
|
||||
if (exists(mockPath)) return streamRaw(res, mockPath);
|
||||
}
|
||||
// Kabelüberwachung main JS (kueData.js)
|
||||
if (rp === "CPL/SERVICE/kueData.js") {
|
||||
const mockPath = path.join(
|
||||
process.cwd(),
|
||||
"mocks",
|
||||
"device-cgi-simulator",
|
||||
"SERVICE",
|
||||
"kabelueberwachungMockData.js"
|
||||
);
|
||||
if (exists(mockPath)) return streamRaw(res, mockPath);
|
||||
}
|
||||
// Kabelüberwachung Knotenpunkte slot JS files
|
||||
if (rp.startsWith("CPL/SERVICE/knotenpunkte/") && rp.endsWith(".js")) {
|
||||
const mockPath = path.join(
|
||||
process.cwd(),
|
||||
"mocks",
|
||||
"device-cgi-simulator",
|
||||
rp.replace(/^CPL\//, "")
|
||||
);
|
||||
if (exists(mockPath)) return streamRaw(res, mockPath);
|
||||
}
|
||||
if (rp === "CPL/SERVICE/systemVoltTemp.js") {
|
||||
const mockPath = path.join(
|
||||
process.cwd(),
|
||||
@@ -108,6 +140,16 @@ function tryServeSpecialMocks(res, relPath) {
|
||||
);
|
||||
if (exists(mockPath)) return streamRaw(res, mockPath);
|
||||
}
|
||||
// TDR reference curves (if mocks exist)
|
||||
if (rp.startsWith("CPL/tdr-reference-curves/")) {
|
||||
const mockPath = path.join(
|
||||
process.cwd(),
|
||||
"mocks",
|
||||
"device-cgi-simulator",
|
||||
rp.replace(/^CPL\//, "")
|
||||
);
|
||||
if (exists(mockPath)) return streamRaw(res, mockPath);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user