Files
MikrotikManager/backend/scripts/writer-profile/fixed56-build-definition.ts
T

23 lines
1.0 KiB
TypeScript

import { canonical, sha } from "./application-writer-profile-canonical.js"
import { sorted, type Inventory } from "./catalogue-projection.js"
import { FIXED44_ROLE_TEMPLATE } from "./fixed44-build-definition.js"
import { FIXED56_DELTA } from "./fixed56-build-delta.js"
export const BUILD56_PROVENANCE = Object.freeze({
format: "source56-build-candidate-v1",
manifestSha256: "b371d8d261f7dd69cf0e2ebc48d4316e3ad804360046bbaaf20e715da8812521",
templateSha256: "e6c2ea106e6fcbd8af7a3ed3ded052c2267be92d3bad41c2ef9e62ec95d2b3d9",
})
export const FIXED56_ROLE_TEMPLATE: Readonly<Inventory> = Object.freeze(Object.fromEntries(
Object.entries(FIXED44_ROLE_TEMPLATE).map(([section, rows]) => {
const delta = FIXED56_DELTA[section]
const removed = new Set(delta?.remove)
return [section, sorted([...rows.filter((_, index) => !removed.has(index)), ...(delta?.add ?? [])])]
}),
))
if (sha(canonical(FIXED56_ROLE_TEMPLATE)) !== BUILD56_PROVENANCE.templateSha256) {
throw new Error("Fixed56 writer catalogue changed")
}