Files
boc/EOS/policy-dependency-map.mjs
T
Bernt 05ed037fe8 pilot.landvex.com: HTTPS + Full Stack Verified
- DNS: pilot.landvex.com -> 16.170.83.169
- TLS: Let's Encrypt certificate (expires 2026-09-30)
- Nginx: reverse proxy with SSL termination
- API: https://pilot.landvex.com/api/v1/missions
- UI: https://pilot.landvex.com/
- Upload: POST /api/v1/missions/import (multipart/form-data)

Verified:
 https://pilot.landvex.com/health
 https://pilot.landvex.com/version
 https://pilot.landvex.com/api/v1/missions (list)
 https://pilot.landvex.com/api/v1/missions/:id (get)
 POST /api/v1/missions/import (video upload)
 UI loads with title 'LandveX Intelligence Lab'

Next: Pilot 001 — Break the system!
2026-07-02 17:34:19 +00:00

118 lines
3.0 KiB
JavaScript

#!/usr/bin/env node
// ═══════════════════════════════════════════════════════════════════════════
// Policy Dependency Map — Visa beroenden mellan policyer
// ═══════════════════════════════════════════════════════════════════════════
/**
* Policy Dependency Map
*
* Visar hur policyer beror på varandra:
*
* pipeline-required
* │
* ▼
* deployment-policy
* │
* ▼
* rollback-policy
*/
const DEPENDENCIES = {
'POL-DEP-001': {
dependsOn: [],
requiredBy: ['POL-SEC-001', 'POL-DAT-001'],
description: 'Deployment kräver pipeline'
},
'POL-SEC-001': {
dependsOn: ['POL-DEP-001'],
requiredBy: [],
description: 'SSH-blockering bygger på deployment-policy'
},
'POL-SEC-002': {
dependsOn: [],
requiredBy: ['POL-DEP-001'],
description: 'Secrets-skydd är grundläggande'
},
'POL-DAT-001': {
dependsOn: ['POL-DEP-001'],
requiredBy: [],
description: 'Data-skydd bygger på deployment-policy'
},
'POL-INFRA-001': {
dependsOn: ['POL-DEP-001'],
requiredBy: [],
description: 'Infra-skydd bygger på deployment-policy'
}
};
/**
* Hämta alla beroenden för en policy
*/
function getDependencies(policyId) {
const deps = DEPENDENCIES[policyId];
if (!deps) return null;
return {
policy: policyId,
dependsOn: deps.dependsOn,
requiredBy: deps.requiredBy,
description: deps.description
};
}
/**
* Hämta transitiva beroenden (alla policyer som påverkas)
*/
function getTransitiveDependencies(policyId, visited = new Set()) {
if (visited.has(policyId)) return [];
visited.add(policyId);
const deps = DEPENDENCIES[policyId];
if (!deps) return [];
const result = [policyId];
for (const dep of deps.dependsOn) {
result.push(...getTransitiveDependencies(dep, visited));
}
return result;
}
/**
* Hämta alla policyer som påverkas av en ändring
*/
function getAffectedPolicies(policyId) {
const deps = DEPENDENCIES[policyId];
if (!deps) return [];
return deps.requiredBy;
}
/**
* Visualisera beroendekarta som text
*/
function visualizeDependencies() {
let output = 'Policy Dependency Map\n';
output += '═════════════════════\n\n';
for (const [policyId, deps] of Object.entries(DEPENDENCIES)) {
output += `${policyId}\n`;
output += ` ${deps.description}\n`;
if (deps.dependsOn.length > 0) {
output += ` Beror på: ${deps.dependsOn.join(', ')}\n`;
}
if (deps.requiredBy.length > 0) {
output += ` Krävs av: ${deps.requiredBy.join(', ')}\n`;
}
output += '\n';
}
return output;
}
export { DEPENDENCIES, getDependencies, getTransitiveDependencies, getAffectedPolicies, visualizeDependencies };