process-graph 1.0.5 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +85 -17
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +92 -0
- package/dist/cli.d.ts +512 -0
- package/dist/cli.js +3 -0
- package/dist/control-aDk9560d.js +294 -0
- package/dist/detail-panel-B1ZmMuJT.js +341 -0
- package/dist/dist-BpCBmnMl.js +582 -0
- package/dist/dist-HLlW8vgT.js +1388 -0
- package/dist/dist-IjrgWhHQ.js +3 -0
- package/dist/errors-BZe5WzCn.js +19 -0
- package/dist/exit-codes-0ultCqdS.js +23 -0
- package/dist/graphql-C1j5wQFz.d.ts +631 -0
- package/dist/index-CCfe0csl.d.ts +353 -0
- package/dist/index-CmZOswkx.d.ts +512 -0
- package/dist/index-CoA6vXqe.d.ts +404 -0
- package/dist/index-CptUHq6F.d.ts +58 -0
- package/dist/index-CrM5qWUA.d.ts +110 -0
- package/dist/index-DhbvDgK4.d.ts +1582 -0
- package/dist/index-DricKcyl.d.ts +421 -0
- package/dist/index.d.ts +111 -4
- package/dist/index.js +929 -5
- package/dist/layout-CCM-KBdp.js +307 -0
- package/dist/layout.d.ts +8 -0
- package/dist/layout.js +2 -0
- package/dist/node-AchI1T-K.js +40 -0
- package/dist/open-CyRXJ4bt.js +29 -0
- package/dist/parse-CuipC_2K.js +41 -0
- package/dist/queries-CCexJAE2.js +2202 -0
- package/dist/react-flow/style.css +658 -0
- package/dist/react-flow.d.ts +173 -0
- package/dist/react-flow.js +450 -0
- package/dist/react.d.ts +2 -0
- package/dist/react.js +107 -0
- package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/router-D4gtTlXm.js +188 -0
- package/dist/schema-CVnS6HiX.js +234 -0
- package/dist/selection-BW_xXWOy.js +314 -0
- package/dist/source/github/node.d.ts +16 -0
- package/dist/source/github/node.js +2 -0
- package/dist/source/github.d.ts +49 -0
- package/dist/source/github.js +201 -0
- package/dist/source-DRDpEA8Q.js +1316 -0
- package/dist/status-Bm1CGu9C.js +11 -0
- package/dist/store/node.d.ts +24 -0
- package/dist/store/node.js +2 -0
- package/dist/store/wasm/worker.d.ts +16 -0
- package/dist/store/wasm/worker.js +98 -0
- package/dist/store/wasm.d.ts +9 -0
- package/dist/store/wasm.js +11 -0
- package/dist/store-BcR70CaO.js +1287 -0
- package/dist/store.d.ts +1328 -0
- package/dist/store.js +238 -0
- package/dist/ui/style.css +351 -0
- package/dist/ui.d.ts +235 -0
- package/dist/ui.js +2 -0
- package/dist/validate-DF3mQZww.js +125 -0
- package/package.json +148 -13
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import { G as IdSpace, a as Overlay, g as Model } from "./index-CmZOswkx.js";
|
|
2
|
+
import { JsonValue, Resolution } from "trilean";
|
|
3
|
+
//#region ../../core/graph/domain/dist/status.d.ts
|
|
4
|
+
/** The derived states of an element, in the order the derivation considers them. */
|
|
5
|
+
declare const statuses: readonly ["done", "unknown", "skipped", "ready", "blocked"];
|
|
6
|
+
/**
|
|
7
|
+
* Where an element stands in a run, derived from the model, the run overlay and the facts, never stored.
|
|
8
|
+
*
|
|
9
|
+
* - `done`: finished, as reported by the overlay or, for a pure control element, derived.
|
|
10
|
+
* - `unknown`: cannot be told apart, because the overlay says so, a need is unknown, or a condition on an incoming transition is indeterminate.
|
|
11
|
+
* - `skipped`: every incoming path is cut, so the element will not run.
|
|
12
|
+
* - `ready`: not done, with every live need done and every consumed artefact produced or provided.
|
|
13
|
+
* - `blocked`: not done and still waiting.
|
|
14
|
+
*/
|
|
15
|
+
type Status = (typeof statuses)[number];
|
|
16
|
+
/**
|
|
17
|
+
* What a transition's `condition` evaluates to: `taken`, `not-taken`, or `indeterminate` when facts the condition reads are missing, so both outcomes stay possible. A transition without a condition is always `taken`.
|
|
18
|
+
*/
|
|
19
|
+
type Branch = "taken" | "not-taken" | "indeterminate";
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region ../../core/graph/domain/dist/facts.d.ts
|
|
22
|
+
/**
|
|
23
|
+
* The injected source of facts a condition reads: an opaque, JSON-valued key in, a found or not-found value out (trilean's `Resolution`). A key the port cannot answer is `{ found: false }`, which makes any condition that depends on it indeterminate, never false.
|
|
24
|
+
*
|
|
25
|
+
* Keys of the reserved shape built by `elementStatusKey` are answered by this package from the overlay and never reach the port. The port is asked keys of the shape built by `artefactKey` to learn which input artefacts are provided; it should answer every other key it does not know with `{ found: false }`.
|
|
26
|
+
*/
|
|
27
|
+
type Facts = (key: JsonValue) => Resolution;
|
|
28
|
+
/**
|
|
29
|
+
* Builds the reserved key that reads another element's run state inside a condition. It resolves to the text `"done"` or `"open"`, and is not found (so the condition is indeterminate) when the overlay says `"unknown"` or the id is not an element of the model.
|
|
30
|
+
*
|
|
31
|
+
* The value is the overlay's own state, not the derived status: a condition therefore never depends on the derivation that evaluates it, and cannot form a cycle.
|
|
32
|
+
* @param id - The element whose state is read.
|
|
33
|
+
* @returns A key to put in a trilean `reference` node.
|
|
34
|
+
*/
|
|
35
|
+
declare const elementStatusKey: (id: string) => JsonValue;
|
|
36
|
+
/**
|
|
37
|
+
* Builds the key the package asks the facts port when it needs to know whether an artefact has been provided from outside the process. An artefact is provided exactly when the port answers `{ found: true }` with the boolean `true`; a not-found or `false` answer means it is not.
|
|
38
|
+
*
|
|
39
|
+
* A provided artefact satisfies every consumer, whether or not an activity also produces it.
|
|
40
|
+
* @param id - The artefact.
|
|
41
|
+
* @returns The key the port is asked.
|
|
42
|
+
*/
|
|
43
|
+
declare const artefactKey: (id: string) => JsonValue;
|
|
44
|
+
/**
|
|
45
|
+
* Thrown when a condition uses a node whose evaluation needs a table or a collection from the facts port, which answers single keys only.
|
|
46
|
+
*/
|
|
47
|
+
declare class UnsupportedConditionError extends Error {
|
|
48
|
+
/** The kind of reference the condition used. */
|
|
49
|
+
readonly reference: "lookup" | "collection";
|
|
50
|
+
/**
|
|
51
|
+
* @param reference - The unsupported kind of reference.
|
|
52
|
+
*/
|
|
53
|
+
constructor(reference: "lookup" | "collection");
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Evaluates every transition's condition.
|
|
57
|
+
*
|
|
58
|
+
* A definite true is `taken`, a definite false is `not-taken` and an indeterminate result is `indeterminate`. A transition without a condition is `taken`. Conditions are evaluated for every transition regardless of the state of its source.
|
|
59
|
+
* @param model - The model whose transitions are evaluated.
|
|
60
|
+
* @param overlay - Run state, read by `elementStatusKey` references.
|
|
61
|
+
* @param facts - The injected source of facts.
|
|
62
|
+
* @returns The outcome of every transition, in transition order.
|
|
63
|
+
* @throws UnsupportedConditionError when a condition contains a `lookup`, `some`, `every` or fold node.
|
|
64
|
+
*/
|
|
65
|
+
declare const evaluateBranches: <I extends IdSpace>(model: Model<I>, overlay: Readonly<Overlay<I>>, facts: Facts) => ReadonlyMap<I["transition"], Branch>;
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region ../../core/graph/dag/dist/dag.d.ts
|
|
68
|
+
/**
|
|
69
|
+
* The identifier of a node. Restricted to primitives so that two ids denote the same node exactly when they are strictly equal.
|
|
70
|
+
*/
|
|
71
|
+
type NodeId = string | number;
|
|
72
|
+
/**
|
|
73
|
+
* A `needs` target that is not a node of the graph, reported as data instead of being absorbed.
|
|
74
|
+
*/
|
|
75
|
+
interface UnknownReference<Id extends NodeId> {
|
|
76
|
+
/** The node whose `needs` named the missing target. */
|
|
77
|
+
readonly from: Id;
|
|
78
|
+
/** The target that is not a node. */
|
|
79
|
+
readonly missing: Id;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* An immutable snapshot of a dependency graph: every node, the direct `needs` of each, the inverse relation, and the references that pointed outside the node set.
|
|
83
|
+
*
|
|
84
|
+
* The type does not promise acyclicity: a graph built from arbitrary input may contain cycles, which `findCycles` reports and the operations that need acyclicity document how they treat. Nothing here may be mutated by a caller.
|
|
85
|
+
*/
|
|
86
|
+
interface Dag<Id extends NodeId> {
|
|
87
|
+
/** Every node once, in the order the input first produced it. All other orderings in this package derive from this one. */
|
|
88
|
+
readonly nodes: readonly Id[];
|
|
89
|
+
/** For every node, the nodes it directly needs, without duplicates, in the order `needs` produced them, restricted to nodes of the graph. */
|
|
90
|
+
readonly needs: ReadonlyMap<Id, readonly Id[]>;
|
|
91
|
+
/** For every node, the nodes that directly need it, in node order. The inverse of `needs`. */
|
|
92
|
+
readonly dependents: ReadonlyMap<Id, readonly Id[]>;
|
|
93
|
+
/** Every `needs` target that is not a node, once per `{ from, missing }` pair, in node order and then `needs` order. These are not edges of the graph. */
|
|
94
|
+
readonly unknownReferences: readonly UnknownReference<Id>[];
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Builds a graph once from a node set and a `needs` accessor.
|
|
98
|
+
*
|
|
99
|
+
* `nodes` is iterated once and duplicates are dropped, keeping the first occurrence. `needs` is called exactly once per distinct node, in node order, and its result is iterated once. A target that is not a node is recorded in `unknownReferences` and is not an edge. A node may need itself; that is a cycle of one, reported by `findCycles`.
|
|
100
|
+
*
|
|
101
|
+
* Never throws for malformed structure: cycles and unknown references are data on the result and in the analyses.
|
|
102
|
+
* @param nodes - Every node of the graph.
|
|
103
|
+
* @param needs - The direct needs of a node: the nodes that must come before it.
|
|
104
|
+
*/
|
|
105
|
+
declare function buildDag<Id extends NodeId>(nodes: Readonly<Iterable<Id>>, needs: (id: Id) => Iterable<Id>): Dag<Id>;
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region ../../core/graph/dag/dist/critical-path.d.ts
|
|
108
|
+
/**
|
|
109
|
+
* The most expensive chain through a graph.
|
|
110
|
+
*/
|
|
111
|
+
interface CriticalPath<Id extends NodeId> {
|
|
112
|
+
/** The chain in dependency order: each node needs the one before it. Empty only for a graph with no nodes. */
|
|
113
|
+
readonly path: readonly Id[];
|
|
114
|
+
/** The sum of the weights of the nodes on `path`. */
|
|
115
|
+
readonly weight: number;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* The longest weighted chain along `needs`, where a chain's weight is the sum of its nodes' weights.
|
|
119
|
+
*
|
|
120
|
+
* `weight` is called exactly once per node, in node order, and must return a finite number that is not negative. The returned path always runs back to a node with no needs and ends at the node whose chain is heaviest.
|
|
121
|
+
*
|
|
122
|
+
* Ties are broken deterministically, and the rule is part of the contract. Where several needs of a node give an equally heavy chain, the one that comes first in node order is followed. Where several nodes end an equally heavy chain, the one that comes first in node order ends it. A zero-weight node therefore never shortens the path back to the start, and a zero-weight dependent never extends the path past an earlier node of equal total.
|
|
123
|
+
*
|
|
124
|
+
* Defined for acyclic graphs. An empty graph returns `{ path: [], weight: 0 }`. Unknown references are not edges.
|
|
125
|
+
* @throws CycleError when the graph contains a cycle: a chain through a cycle has no greatest weight.
|
|
126
|
+
* @throws RangeError when `weight` returns a negative or non-finite number.
|
|
127
|
+
*/
|
|
128
|
+
declare function criticalPath$1<Id extends NodeId>(dag: Dag<Id>, weight: (id: Id) => number): CriticalPath<Id>;
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region ../../core/graph/domain/dist/control.d.ts
|
|
131
|
+
/**
|
|
132
|
+
* The transitions that re-enter earlier work: a transition leaving a `decision` element whose target can reach its source (or is its source), so that it closes a cycle through the decision.
|
|
133
|
+
*
|
|
134
|
+
* Reachability is over the whole graph, transitions and artefact dependencies alike. Only a decision's own outgoing transitions are candidates: a cycle that contains no decision has no loop edge and is illegal.
|
|
135
|
+
* @param model - The model to read.
|
|
136
|
+
* @returns The loop transitions, in transition order.
|
|
137
|
+
* @throws UnknownNodeError when such a transition's target is not an element of the model.
|
|
138
|
+
*/
|
|
139
|
+
declare const loopTransitions: <I extends IdSpace>(model: Model<I>) => readonly I["transition"][];
|
|
140
|
+
/**
|
|
141
|
+
* The control graph the whole analysis is computed on, with the loop edges removed.
|
|
142
|
+
*
|
|
143
|
+
* Its nodes are the element ids. A node needs the source of every incoming transition that is not a loop edge (see `loopTransitions`) and, for an activity, the producer of every artefact in `consumes`. Excluding loop edges makes a legal retry or review loop acyclic here, so readiness, layers and the critical path are well defined: a loop edge is a way back to earlier work, never a prerequisite of it. A node whose only incoming transitions are loop edges therefore has no needs.
|
|
144
|
+
*
|
|
145
|
+
* The graph is not guaranteed acyclic: cycles that no decision closes remain and are reported by `illegalCycles`. A transition whose source is not an element appears in `unknownReferences`.
|
|
146
|
+
* @param model - The model to read.
|
|
147
|
+
* @returns The graph over element ids, as a `graph-dag` `Dag`.
|
|
148
|
+
* @throws UnknownNodeError when a decision's transition targets something that is not an element.
|
|
149
|
+
*/
|
|
150
|
+
declare const controlDag: <I extends IdSpace>(model: Model<I>) => Dag<I["element"]>;
|
|
151
|
+
/**
|
|
152
|
+
* The cycles of the control graph: every cycle that is not a legal decision loop.
|
|
153
|
+
*
|
|
154
|
+
* A cycle that passes through a `decision` element is a legal loop and is not reported; the loop edge that closes it is left out of `controlDag`. Any cycle that remains has no decision in it, so it can never make progress, and is reported with its path.
|
|
155
|
+
*
|
|
156
|
+
* A path follows `graph-dag`'s convention: each element needs the next one and the last needs the first, which is repeated at the end. `["a", "b", "a"]` means a needs b and b needs a. One path is reported per strongly connected component; break it and call again for the rest.
|
|
157
|
+
* @param model - The model to read.
|
|
158
|
+
* @returns The illegal cycles, empty exactly when every cycle is a legal decision loop.
|
|
159
|
+
* @throws UnknownNodeError when a decision's transition targets something that is not an element.
|
|
160
|
+
*/
|
|
161
|
+
declare const illegalCycles: <I extends IdSpace>(model: Model<I>) => readonly (readonly I["element"][])[];
|
|
162
|
+
//#endregion
|
|
163
|
+
//#region ../../core/graph/domain/dist/derive.d.ts
|
|
164
|
+
/** Which of the derivation's rules decided an element's status, in the order the rules are applied. */
|
|
165
|
+
declare const statusRules: readonly ["overlay-done", "overlay-unknown", "unknown-need", "all-cut", "needs-met", "waiting"];
|
|
166
|
+
/**
|
|
167
|
+
* Which rule decided a status.
|
|
168
|
+
*
|
|
169
|
+
* - `overlay-done`: the overlay says `done`.
|
|
170
|
+
* - `overlay-unknown`: the overlay says `unknown`.
|
|
171
|
+
* - `unknown-need`: a live transition's condition is indeterminate or its source is `unknown`, or a consumed artefact that is not provided and has no done producer has an `unknown` producer.
|
|
172
|
+
* - `all-cut`: the element has incoming transitions and every one is cut, so it is `skipped`.
|
|
173
|
+
* - `needs-met`: every live need is done and every consumed artefact is satisfied, so it is `ready`, or `done` for a decision or pseudo-state.
|
|
174
|
+
* - `waiting`: anything else, so it is `blocked`.
|
|
175
|
+
*/
|
|
176
|
+
type StatusRule = (typeof statusRules)[number];
|
|
177
|
+
/** An incoming transition of an element, as the derivation saw it. Loop edges are not incoming transitions. */
|
|
178
|
+
interface IncomingBasis<I extends IdSpace> {
|
|
179
|
+
readonly transition: I["transition"];
|
|
180
|
+
readonly source: I["element"];
|
|
181
|
+
/** What the transition's condition evaluated to. */
|
|
182
|
+
readonly branch: Branch;
|
|
183
|
+
/** The derived status of the source. */
|
|
184
|
+
readonly sourceStatus: Status;
|
|
185
|
+
/** Whether the transition is cut: its condition is definitely false or its source is skipped. A cut transition is not a need. */
|
|
186
|
+
readonly cut: boolean;
|
|
187
|
+
}
|
|
188
|
+
/** A producer of a consumed artefact and its derived status. */
|
|
189
|
+
interface ProducerBasis<I extends IdSpace> {
|
|
190
|
+
readonly element: I["element"];
|
|
191
|
+
readonly status: Status;
|
|
192
|
+
}
|
|
193
|
+
/** A consumed artefact of an activity, as the derivation saw it. */
|
|
194
|
+
interface ArtefactBasis<I extends IdSpace> {
|
|
195
|
+
readonly artefact: I["artefact"];
|
|
196
|
+
/** Whether the facts port reports it provided from outside the process. */
|
|
197
|
+
readonly provided: boolean;
|
|
198
|
+
/** The activities that produce it, in model order. Empty when none does. */
|
|
199
|
+
readonly producers: readonly ProducerBasis<I>[];
|
|
200
|
+
/** Whether it is provided or a producer is done. */
|
|
201
|
+
readonly satisfied: boolean;
|
|
202
|
+
}
|
|
203
|
+
/** What one element's status was derived from. */
|
|
204
|
+
interface StatusBasis<I extends IdSpace> {
|
|
205
|
+
readonly rule: StatusRule;
|
|
206
|
+
/** The element's incoming transitions other than loop edges, in model order. */
|
|
207
|
+
readonly transitions: readonly IncomingBasis<I>[];
|
|
208
|
+
/** The artefacts the element consumes, in the order it lists them; empty for anything but an activity. */
|
|
209
|
+
readonly artefacts: readonly ArtefactBasis<I>[];
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* The derived status of every element. See `analyse` for the rules; the semantics are documented in the package README.
|
|
213
|
+
* @param model - The model to read.
|
|
214
|
+
* @param overlay - Run state by element id.
|
|
215
|
+
* @param facts - The injected source of facts conditions read, and of which input artefacts are provided (see `artefactKey`).
|
|
216
|
+
* @returns A status for every element, in model order.
|
|
217
|
+
* @throws CycleError when the control graph contains an illegal cycle (see `illegalCycles`), since status is undefined on it.
|
|
218
|
+
* @throws UnknownNodeError when a transition refers to an element the model does not declare.
|
|
219
|
+
* @throws UnsupportedConditionError when a condition needs a table or collection from the facts port.
|
|
220
|
+
*/
|
|
221
|
+
declare const deriveStatuses: <I extends IdSpace>(model: Model<I>, overlay: Readonly<Overlay<I>>, facts: Facts) => ReadonlyMap<I["element"], Status>;
|
|
222
|
+
//#endregion
|
|
223
|
+
//#region ../../core/graph/domain/dist/explain.d.ts
|
|
224
|
+
/** One element of a blocked-by chain and the unfinished needs it still waits on. */
|
|
225
|
+
interface ChainLink<I extends IdSpace> {
|
|
226
|
+
readonly element: I["element"];
|
|
227
|
+
readonly status: Status;
|
|
228
|
+
/** The element's live needs that are not done, in model order. Empty for the open work at the end of the chain. */
|
|
229
|
+
readonly waitingOn: readonly I["element"][];
|
|
230
|
+
}
|
|
231
|
+
/** Why an element has the status it has. */
|
|
232
|
+
interface StatusExplanation<I extends IdSpace> {
|
|
233
|
+
readonly element: I["element"];
|
|
234
|
+
readonly status: Status;
|
|
235
|
+
/** The rule that decided the status. */
|
|
236
|
+
readonly rule: StatusRule;
|
|
237
|
+
/** The element's incoming transitions other than loop edges, each with its branch, its source's status and whether it is cut, in model order. */
|
|
238
|
+
readonly transitions: readonly IncomingBasis<I>[];
|
|
239
|
+
/** The artefacts the element consumes, each with whether it is provided and its producers' statuses. */
|
|
240
|
+
readonly artefacts: readonly ArtefactBasis<I>[];
|
|
241
|
+
/**
|
|
242
|
+
* The blocked-by chain: the element, then every unfinished need reached from it by following unfinished needs, in model order. The links after the first that wait on nothing are the elements `blockedBy` returns. A done or skipped element waits on nothing, so its chain is the element alone.
|
|
243
|
+
*/
|
|
244
|
+
readonly chain: readonly ChainLink<I>[];
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Explains an element's status: the rule that decided it, the transitions and artefacts it was decided from, and the chain of unfinished work behind it. The explanation is the derivation's own record, so it always agrees with `deriveStatuses` and `blockedBy`.
|
|
248
|
+
* @param model - The model to read.
|
|
249
|
+
* @param overlay - Run state by element id.
|
|
250
|
+
* @param facts - The injected source of facts conditions read, and of which input artefacts are provided.
|
|
251
|
+
* @param id - The element asked about.
|
|
252
|
+
* @returns The explanation.
|
|
253
|
+
* @throws UnknownNodeError when `id` is not an element.
|
|
254
|
+
* @throws CycleError when the control graph has an illegal cycle.
|
|
255
|
+
*/
|
|
256
|
+
declare const explainStatus: <I extends IdSpace>(model: Model<I>, overlay: Readonly<Overlay<I>>, facts: Facts, id: I["element"]) => StatusExplanation<I>;
|
|
257
|
+
//#endregion
|
|
258
|
+
//#region ../../core/graph/domain/dist/queries.d.ts
|
|
259
|
+
/**
|
|
260
|
+
* The elements that can be worked on now: every element whose status is `ready`, in model order. Pure control elements (decisions and pseudo-states) are derived `done` and never appear.
|
|
261
|
+
* @param model - The model to read.
|
|
262
|
+
* @param overlay - Run state by element id.
|
|
263
|
+
* @param facts - The injected source of facts conditions read, and of which input artefacts are provided.
|
|
264
|
+
* @returns The ready elements.
|
|
265
|
+
* @throws CycleError when the control graph has an illegal cycle.
|
|
266
|
+
*/
|
|
267
|
+
declare const readySet: <I extends IdSpace>(model: Model<I>, overlay: Readonly<Overlay<I>>, facts: Facts) => readonly I["element"][];
|
|
268
|
+
/**
|
|
269
|
+
* What is holding an element back: the minimal set of open elements to finish first.
|
|
270
|
+
*
|
|
271
|
+
* Starting from the element's unfinished needs, follows each one's own unfinished needs until it reaches elements that wait on nothing further, and returns exactly those leaves, in model order. Cut transitions (a branch not taken, a skipped source) and provided artefacts are not needs. A leaf is open work that is `ready`, or an element whose own state or condition is `unknown`. An element that is `done`, `skipped` or `ready` is blocked by nothing, and neither is one whose only obstacle is its own unknown state.
|
|
272
|
+
* @param model - The model to read.
|
|
273
|
+
* @param overlay - Run state by element id.
|
|
274
|
+
* @param facts - The injected source of facts conditions read, and of which input artefacts are provided.
|
|
275
|
+
* @param id - The element asked about.
|
|
276
|
+
* @returns The leaves of the unfinished-needs closure, in model order.
|
|
277
|
+
* @throws UnknownNodeError when `id` is not an element.
|
|
278
|
+
* @throws CycleError when the control graph has an illegal cycle.
|
|
279
|
+
*/
|
|
280
|
+
declare const blockedBy: <I extends IdSpace>(model: Model<I>, overlay: Readonly<Overlay<I>>, facts: Facts, id: I["element"]) => readonly I["element"][];
|
|
281
|
+
/**
|
|
282
|
+
* What finishing, delaying or dropping an element affects: the elements that transitively depend on it through paths that are still live.
|
|
283
|
+
*
|
|
284
|
+
* Traversal follows each dependent's live needs (see `Analysis.liveNeeds`), so a transition cut by a branch not taken, a skipped element and a loop edge carry no impact, and an element already `done` is neither affected nor traversed through. The element itself is not included.
|
|
285
|
+
* @param model - The model to read.
|
|
286
|
+
* @param overlay - Run state by element id.
|
|
287
|
+
* @param facts - The injected source of facts conditions read, and of which input artefacts are provided.
|
|
288
|
+
* @param id - The element asked about.
|
|
289
|
+
* @returns The affected elements, in model order.
|
|
290
|
+
* @throws UnknownNodeError when `id` is not an element.
|
|
291
|
+
* @throws CycleError when the control graph has an illegal cycle.
|
|
292
|
+
*/
|
|
293
|
+
declare const impact: <I extends IdSpace>(model: Model<I>, overlay: Readonly<Overlay<I>>, facts: Facts, id: I["element"]) => readonly I["element"][];
|
|
294
|
+
/** A status that changed. */
|
|
295
|
+
interface StatusChange<I extends IdSpace> {
|
|
296
|
+
readonly id: I["element"];
|
|
297
|
+
readonly before: Status;
|
|
298
|
+
readonly after: Status;
|
|
299
|
+
}
|
|
300
|
+
/** The effect of finishing one element. */
|
|
301
|
+
interface WhatIf<I extends IdSpace> {
|
|
302
|
+
/** Elements that were not ready and become ready, in model order. */
|
|
303
|
+
readonly becomesReady: readonly I["element"][];
|
|
304
|
+
/** Every element whose status changes, in model order. Includes the finished element itself unless it was done already. */
|
|
305
|
+
readonly changes: readonly StatusChange<I>[];
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Derives the run again with an element marked `done` in the overlay and reports what changes. Nothing is mutated.
|
|
309
|
+
* @param model - The model to read.
|
|
310
|
+
* @param overlay - Run state by element id.
|
|
311
|
+
* @param facts - The injected source of facts conditions read, and of which input artefacts are provided.
|
|
312
|
+
* @param id - The element to finish.
|
|
313
|
+
* @returns The elements that become ready and every status change.
|
|
314
|
+
* @throws UnknownNodeError when `id` is not an element.
|
|
315
|
+
* @throws CycleError when the control graph has an illegal cycle.
|
|
316
|
+
*/
|
|
317
|
+
declare const whatIfDone: <I extends IdSpace>(model: Model<I>, overlay: Readonly<Overlay<I>>, facts: Facts, id: I["element"]) => WhatIf<I>;
|
|
318
|
+
/**
|
|
319
|
+
* The heaviest chain through the work that is still ahead: the live elements, those that are neither `done` nor `skipped`, ordered by the live needs that are themselves live.
|
|
320
|
+
*
|
|
321
|
+
* A finished or skipped element contributes nothing and does not appear. The chain is computed with `graph-dag`'s `criticalPath`, so its tie-breaking rule holds (the earliest element in model order wins).
|
|
322
|
+
* @param model - The model to read.
|
|
323
|
+
* @param overlay - Run state by element id.
|
|
324
|
+
* @param facts - The injected source of facts conditions read, and of which input artefacts are provided.
|
|
325
|
+
* @param weight - The cost of an element: finite and not negative.
|
|
326
|
+
* @returns The path in dependency order and its total weight; empty when nothing is live.
|
|
327
|
+
* @throws RangeError when `weight` returns a negative or non-finite number.
|
|
328
|
+
* @throws CycleError when the control graph has an illegal cycle.
|
|
329
|
+
*/
|
|
330
|
+
declare const criticalPath: <I extends IdSpace>(model: Model<I>, overlay: Readonly<Overlay<I>>, facts: Facts, weight: (id: I["element"]) => number) => CriticalPath<I["element"]>;
|
|
331
|
+
/** A deliverable artefact that has not been produced yet and what it still takes. */
|
|
332
|
+
interface UnmetOutput<I extends IdSpace> {
|
|
333
|
+
readonly artefact: I["artefact"];
|
|
334
|
+
/** The activities that declare they produce it. Empty when none does, so it can never be produced. */
|
|
335
|
+
readonly producers: readonly I["element"][];
|
|
336
|
+
/** The open elements still needed to produce it: its unfinished producers and, transitively, every unfinished live need of those, in model order. */
|
|
337
|
+
readonly needed: readonly I["element"][];
|
|
338
|
+
/** The artefacts among those needs that nothing produces and the run has not provided, in declaration order. */
|
|
339
|
+
readonly missingInputs: readonly I["artefact"][];
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Every deliverable artefact that is still to be produced, with what is needed to produce it.
|
|
343
|
+
*
|
|
344
|
+
* A deliverable is met when it is provided or one of its producers is `done`. An unmet one lists its producers, the unfinished elements that must finish (its unfinished producers and everything those transitively wait on, skipped elements excluded) and the inputs that no one produces and nobody has provided, so a deliverable that can only ever be reached through an unproduced input shows exactly which input is missing.
|
|
345
|
+
* @param model - The model to read.
|
|
346
|
+
* @param overlay - Run state by element id.
|
|
347
|
+
* @param facts - The injected source of facts conditions read, and of which input artefacts are provided.
|
|
348
|
+
* @returns One entry per unmet deliverable, in declaration order.
|
|
349
|
+
* @throws CycleError when the control graph has an illegal cycle.
|
|
350
|
+
*/
|
|
351
|
+
declare const unmetOutputs: <I extends IdSpace>(model: Model<I>, overlay: Readonly<Overlay<I>>, facts: Facts) => readonly UnmetOutput<I>[];
|
|
352
|
+
//#endregion
|
|
353
|
+
export { UnsupportedConditionError as A, CriticalPath as C, UnknownReference as D, NodeId as E, Status as F, statuses as I, elementStatusKey as M, evaluateBranches as N, buildDag as O, Branch as P, loopTransitions as S, Dag as T, StatusRule as _, criticalPath as a, controlDag as b, unmetOutputs as c, StatusExplanation as d, explainStatus as f, StatusBasis as g, ProducerBasis as h, blockedBy as i, artefactKey as j, Facts as k, whatIfDone as l, IncomingBasis as m, UnmetOutput as n, impact as o, ArtefactBasis as p, WhatIf as r, readySet as s, StatusChange as t, ChainLink as u, deriveStatuses as v, criticalPath$1 as w, illegalCycles as x, statusRules as y };
|