fetchCableData.mjs
Sends Authorization: Basic <base64(user:pass)> with configurable credentials.
Accepts --user and --pass, or env CPL_USER/CPL_PASS; defaults to Littwin/Littwin.
Uses an https.Agent({ rejectUnauthorized: false }) when --insecure is set.
Corrected output folder to cable-monitoring-data.
CLI parser supports both --key=value and --key value (PowerShell friendly).
Quick usage (PowerShell)
All 32 slots, both types (iso=3, rsl=4), all DIA modes, last 30 days:
npm run mocks:cable
Specific date range (e.g., 2025-07-13 to 2025-08-12), all slots and types:
node .\mocks\scripts\fetchCableData.mjs --from 2025-07-13 --to 2025-08-12 --insecure
Only slot 0, Isolationswiderstand, DIA1:
node .\mocks\scripts\fetchCableData.mjs --slots 0 --modes DIA1 --types iso --from 2025-07-13 --to 2025-08-12 --insecure
Provide credentials explicitly:
node .\mocks\scripts\fetchCableData.mjs --user Littwin --pass Littwin --insecure
Or via environment variables for the session:
$env:CPL_USER = "Littwin"; $env:CPL_PASS = "Littwin"
node .\mocks\scripts\fetchCableData.mjs --insecure
Output structure
mocks/device-cgi-simulator/cable-monitoring-data/slot{0..31}/
isolationswiderstand/DIA0.json, DIA1.json, DIA2.json
schleifenwiderstand/DIA0.json, DIA1.json, DIA2.json
I smoke-tested slot 0, DIA1, iso with login and it produced DIA1.json under slot0/isolationswiderstand. If you need me to also add a convenience npm script with user/pass placeholders, say the credentials source you prefer (env vs args), and I’ll wire it.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cpl-v4",
|
||||
"version": "1.6.696",
|
||||
"version": "1.6.697",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
@@ -17,7 +17,10 @@
|
||||
"test:e2e:debug": "playwright test --debug",
|
||||
"test:e2e:report": "playwright show-report",
|
||||
"prepare": "husky install",
|
||||
"bump-version": "node ./scripts/bumpVersion.js"
|
||||
"bump-version": "node ./scripts/bumpVersion.js",
|
||||
"mocks:cable": "node ./mocks/scripts/fetchCableData.mjs --insecure",
|
||||
"mocks:cable:range": "node ./mocks/scripts/fetchCableData.mjs --from %FROM% --to %TO% --insecure",
|
||||
"mocks:cable:slot": "node ./mocks/scripts/fetchCableData.mjs --slots %SLOTS% --insecure"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fontsource/roboto": "^5.1.0",
|
||||
|
||||
Reference in New Issue
Block a user