Line

You are reading the unreleased docs (next). See latest (v0.9)

ui/server/src/rulesApi

thin REST adapter over packages/core/rules-catalog.mjs: every rule construct validate can report, with severity resolved against the open project's architecture.yml (falls back to the built-in default with no over...

Cockpit server, next. Source: ui/server/src/rulesApi.mjs.

Functions#

createRulesRouter()#

createRulesRouter(deps): any

Defined in: ui/server/src/rulesApi.mjs:241

Parameters#

deps
afterSave?

(root, rel) => unknown = ...

clientOrigin?

string

getRoot

() => { ok: true; root: string; } | { error: string; ok: false; }

Returns#

any


globListSave()#

globListSave(root, body): object

Defined in: ui/server/src/rulesApi.mjs:141

Preview or save adding/removing one glob to nonLayer: or frozen: -- both are a flat list of glob strings, so this one function covers both fields rather than duplicating ruleExceptionSave's add/remove shape for each. Same preview/commit/contentHash/validateArchitectureConfig shape as the other two.

Parameters#

root

any

body

any

Returns#

object

body

body: any

status

status: any


presetApply()#

presetApply(root, body): object

Defined in: ui/server/src/rulesApi.mjs:216

Preview or save switching to a named preset -- a confirmed bulk severity change, never a silent apply. The diff reported is per-rule (ruleId, before, after) for only the rules a preset switch would actually change, on top of the usual before/after YAML text and contentHash. Same preview/commit/contentHash/validateArchitectureConfig shape as the other four writers.

Parameters#

root

any

body

any

Returns#

object

body

body: any

status

status: any


projectSettingsSave()#

projectSettingsSave(root, body): object

Defined in: ui/server/src/rulesApi.mjs:176

Preview or save features.root and/or project.framework (the route adapter) -- slice 5. Both are project-wide settings rather than per-rule, so this takes whichever of the two the client sends and leaves the other untouched. Same preview/commit/contentHash/ validateArchitectureConfig shape as the other three writers.

Parameters#

root

any

body

any

Returns#

object

body

body: any

status

status: any


ruleExceptionSave()#

ruleExceptionSave(root, body): object

Defined in: ui/server/src/rulesApi.mjs:101

Preview or save adding/removing one exception. action: 'add' needs a path glob and a rule id (an existing, known rule -- rules: arrays are not exposed by this UI yet, one rule per exception); expires/reason are optional. action: 'remove' needs the index readExceptions() reported for that entry -- indexes are only ever valid for the architecture.yml text they were read from, which is exactly what contentHash guards against drifting out from under a remove. Same preview/commit/contentHash/validateArchitectureConfig shape as ruleSeveritySave.

Parameters#

root

any

body

any

Returns#

object

body

body: any

status

status: any


ruleSeveritySave()#

ruleSeveritySave(root, body): object

Defined in: ui/server/src/rulesApi.mjs:74

Preview (commit false: nothing written, returns before/after text) or save (commit true) one rule's severity override. Unknown rule ids and invalid severities are refused before anything is computed; the proposed whole-file result is re-validated through validateArchitectureConfig before it is ever written, so a bad edit can never reach disk.

Parameters#

root

any

body

any

Returns#

object

body

body: any

status

status: any


rulesIndex()#

rulesIndex(root): object

Defined in: ui/server/src/rulesApi.mjs:21

Parameters#

root

any

Returns#

object

body

body: any

status

status: number