ui/server/src/requirementApi
(part of epic ) -- the requirement chain, read back before anything is written.
Cockpit server, next. Source: ui/server/src/requirementApi.mjs.
Variables#
MAX_ANSWERS#
constMAX_ANSWERS:20=20
Defined in: ui/server/src/requirementApi.mjs:41
MAX_REQUEST_BYTES#
constMAX_REQUEST_BYTES:number
Defined in: ui/server/src/requirementApi.mjs:42
MAX_TEXT#
constMAX_TEXT:2000=2000
Defined in: ui/server/src/requirementApi.mjs:40
Functions#
createRequirementRouter()#
createRequirementRouter(
deps):any
Defined in: ui/server/src/requirementApi.mjs:180
Parameters#
deps
proofRunner and proofTimeoutMs are test seams for the proof routes. allowPlugins lets a project's
decision.plugin file be imported (default: only when CONSTRUCT_DECISION_PLUGINS=on, because a plugin is code the
project brings); decisionLog receives the load and fallback lines (default: the server's stderr).
allowPlugins?
boolean = ...
capabilities?
{ available: boolean; reason: string; }
capabilities.available
boolean
capabilities.reason
string
clientOrigin?
string
decisionLog?
(line) => void = ...
getRoot
() => { ok: true; root: string; } | { body?: any; ok: false; status?: number; }
proofRunner?
Function
proofTimeoutMs?
number
Returns#
any
featureNameOf()#
featureNameOf(
screen):string
Defined in: ui/server/src/requirementApi.mjs:53
"SubscriptionPlan" -> "subscription-plan": the feature the units go in, derived from the screen name the blocks chose.
Parameters#
screen
any
Returns#
string
readRequirement()#
readRequirement(
body,root,trace?):object
Defined in: ui/server/src/requirementApi.mjs:68
Read one requirement. Pure over (text, answers, root): it reads the project's architecture.yml (layers, framework) and the folder listing of its features root, nothing else.
Parameters#
body
answers?
unknown
text?
unknown
root
string
the open project's root
trace?
filled in as it reads: the closed questions answered so far
(as recordChoices takes them), the questions and offers still open (which the decision provider is asked about) and
whether the plan from them validated (undefined while no plan was built)
choices
any[]
planValidated?
boolean
questions?
any[]
Returns#
object
body
body:
any
status
status:
number
withDecisions()#
withDecisions(
out,trace,root,deps?):Promise<{choices:any[];out: {body:any;status:number; }; }>
Defined in: ui/server/src/requirementApi.mjs:152
: what the project's decision provider says about a read. Adds suggestions (per open question or offer id: option, reason,
runner-up, provider name and version) and decisionProvider (who answers, what was asked for, the load and fallback lines) to
the response body, and attaches to every choice a person made the suggestion that was on offer, with outcome.accepted
(true when the person took it, false when they chose another option). Suggest-only: nothing is chosen for the person.
Never throws: a failing provider costs the response its suggestions and nothing else.
Parameters#
out
The result of readRequirement.
body
any
status
number
trace
What readRequirement filled in.
choices
any[]
questions?
any[]
root
string
The open project's root.
deps?
Whether a plugin file may be imported, where lines go, and (a test seam) the machine's modelProposals answer: a machine that cannot load a model answers "rules only: ".
allowPlugins?
boolean
capabilities?
{ available: boolean; reason: string; }
capabilities.available
boolean
capabilities.reason
string
log?
(line) => void
Returns#
Promise<{ choices: any[]; out: { body: any; status: number; }; }>
The response and the choices ready to record.