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.
Files changed (58) hide show
  1. package/README.md +85 -17
  2. package/dist/bin.d.ts +1 -0
  3. package/dist/bin.js +92 -0
  4. package/dist/cli.d.ts +512 -0
  5. package/dist/cli.js +3 -0
  6. package/dist/control-aDk9560d.js +294 -0
  7. package/dist/detail-panel-B1ZmMuJT.js +341 -0
  8. package/dist/dist-BpCBmnMl.js +582 -0
  9. package/dist/dist-HLlW8vgT.js +1388 -0
  10. package/dist/dist-IjrgWhHQ.js +3 -0
  11. package/dist/errors-BZe5WzCn.js +19 -0
  12. package/dist/exit-codes-0ultCqdS.js +23 -0
  13. package/dist/graphql-C1j5wQFz.d.ts +631 -0
  14. package/dist/index-CCfe0csl.d.ts +353 -0
  15. package/dist/index-CmZOswkx.d.ts +512 -0
  16. package/dist/index-CoA6vXqe.d.ts +404 -0
  17. package/dist/index-CptUHq6F.d.ts +58 -0
  18. package/dist/index-CrM5qWUA.d.ts +110 -0
  19. package/dist/index-DhbvDgK4.d.ts +1582 -0
  20. package/dist/index-DricKcyl.d.ts +421 -0
  21. package/dist/index.d.ts +111 -4
  22. package/dist/index.js +929 -5
  23. package/dist/layout-CCM-KBdp.js +307 -0
  24. package/dist/layout.d.ts +8 -0
  25. package/dist/layout.js +2 -0
  26. package/dist/node-AchI1T-K.js +40 -0
  27. package/dist/open-CyRXJ4bt.js +29 -0
  28. package/dist/parse-CuipC_2K.js +41 -0
  29. package/dist/queries-CCexJAE2.js +2202 -0
  30. package/dist/react-flow/style.css +658 -0
  31. package/dist/react-flow.d.ts +173 -0
  32. package/dist/react-flow.js +450 -0
  33. package/dist/react.d.ts +2 -0
  34. package/dist/react.js +107 -0
  35. package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
  36. package/dist/router-D4gtTlXm.js +188 -0
  37. package/dist/schema-CVnS6HiX.js +234 -0
  38. package/dist/selection-BW_xXWOy.js +314 -0
  39. package/dist/source/github/node.d.ts +16 -0
  40. package/dist/source/github/node.js +2 -0
  41. package/dist/source/github.d.ts +49 -0
  42. package/dist/source/github.js +201 -0
  43. package/dist/source-DRDpEA8Q.js +1316 -0
  44. package/dist/status-Bm1CGu9C.js +11 -0
  45. package/dist/store/node.d.ts +24 -0
  46. package/dist/store/node.js +2 -0
  47. package/dist/store/wasm/worker.d.ts +16 -0
  48. package/dist/store/wasm/worker.js +98 -0
  49. package/dist/store/wasm.d.ts +9 -0
  50. package/dist/store/wasm.js +11 -0
  51. package/dist/store-BcR70CaO.js +1287 -0
  52. package/dist/store.d.ts +1328 -0
  53. package/dist/store.js +238 -0
  54. package/dist/ui/style.css +351 -0
  55. package/dist/ui.d.ts +235 -0
  56. package/dist/ui.js +2 -0
  57. package/dist/validate-DF3mQZww.js +125 -0
  58. package/package.json +148 -13
@@ -0,0 +1,404 @@
1
+ import { G as IdSpace, L as PseudoRole, M as FragmentOperator, N as MessageMode, P as Notation, g as Model, k as Transition, x as Element } from "./index-CmZOswkx.js";
2
+ //#region ../../core/graph/projection/dist/loss.d.ts
3
+ /** What an element that a notation cannot draw is: an element kind, or the role of a pseudo-state. A `message` element is one only when the notation would fold it but folding it would multiply edges. */
4
+ type UnrepresentedKind = "activity" | "decision" | "state" | "message" | PseudoRole;
5
+ /** An element a projection could not draw, and what it was. */
6
+ interface UnrepresentedElement<I extends IdSpace> {
7
+ readonly element: I["element"];
8
+ readonly kind: UnrepresentedKind;
9
+ }
10
+ /**
11
+ * Something a projection does not carry from the model into its result. A projection returns every loss that applies, in this order: layout, extensions, message elements, fragments, then the notation's own choice (unrepresented elements, subject, scenario, unshown branches, skipped steps). A kind is only reported when something was actually dropped.
12
+ */
13
+ type Loss<I extends IdSpace> =
14
+ /** Positions recorded for this projection's notation in `views`. No projection reads or keeps coordinates. */
15
+ {
16
+ readonly kind: "layout";
17
+ readonly elements: readonly I["element"][];
18
+ } |
19
+ /** Elements carrying notation-only `extensions`, which no projection shows. */
20
+ {
21
+ readonly kind: "extensions";
22
+ readonly elements: readonly I["element"][];
23
+ } |
24
+ /** `message` elements the projection neither draws nor folds into an edge or transition. */
25
+ {
26
+ readonly kind: "message-elements";
27
+ readonly elements: readonly I["element"][];
28
+ } |
29
+ /** Authored fragments the projection does not draw. */
30
+ {
31
+ readonly kind: "fragments";
32
+ readonly fragments: readonly I["fragment"][];
33
+ } |
34
+ /** Elements, other than messages, that the notation has no way to draw, and the transitions left out because one end of them is such an element. */
35
+ {
36
+ readonly kind: "unrepresented-elements";
37
+ readonly notation: Notation;
38
+ readonly elements: readonly UnrepresentedElement<I>[];
39
+ readonly transitions: readonly I["transition"][];
40
+ } |
41
+ /** Activities left out of a state machine because they do not affect its subject. */
42
+ {
43
+ readonly kind: "subject";
44
+ readonly subject: I["entity"];
45
+ readonly elements: readonly I["element"][];
46
+ } |
47
+ /** Elements of the model that are not on the sequence diagram's scenario. */
48
+ {
49
+ readonly kind: "scenario";
50
+ readonly elements: readonly I["element"][];
51
+ } |
52
+ /** Transitions leaving an element on the scenario that the scenario does not take. */
53
+ {
54
+ readonly kind: "unshown-branches";
55
+ readonly transitions: readonly I["transition"][];
56
+ } |
57
+ /** Scenario steps that produced no message because an end of the transition has no actor. */
58
+ {
59
+ readonly kind: "skipped-steps";
60
+ readonly transitions: readonly I["transition"][];
61
+ };
62
+ //#endregion
63
+ //#region ../../core/graph/projection/dist/handoffs.d.ts
64
+ interface Handoff<I extends IdSpace> {
65
+ /** The transition the hand-off starts with. */
66
+ readonly transition: I["transition"];
67
+ readonly from: I["actor"];
68
+ readonly to: I["actor"];
69
+ /** The `message` elements the hand-off passes through, each once in the order met, when it is carried by a message; built when first read. */
70
+ readonly through?: readonly I["element"][];
71
+ }
72
+ /**
73
+ * Swimlane view: a transition between two elements with different actors is a hand-off. A transition into a `message` element continues through it to the element after it, so a message between two steps is part of the hand-off it carries, not an end of it. Elements without an actor never produce one.
74
+ * @param model - The model to read.
75
+ * @returns The hand-offs, in the order of the transitions they start with.
76
+ */
77
+ declare const handoffs: <I extends IdSpace>(model: Model<I>) => readonly Handoff<I>[];
78
+ //#endregion
79
+ //#region ../../core/graph/projection/dist/flowchart.d.ts
80
+ interface FlowNode<I extends IdSpace> {
81
+ readonly id: I["element"];
82
+ readonly label: string;
83
+ readonly shape: "terminator" | "process" | "decision" | "bar";
84
+ }
85
+ /** A drawn edge. It stands for one model transition, or for a chain of them through `message` elements, which a flowchart draws as the edge that carries the message rather than as a node. */
86
+ interface FlowEdge<I extends IdSpace> {
87
+ readonly from: I["element"];
88
+ readonly to: I["element"];
89
+ /** On a single route, its guards joined with "and", or, when there are none, the labels of the messages it carries. On several merged routes, the labels of the messages it carries. */
90
+ readonly label?: string;
91
+ /** The model transitions the edge stands for: one, or every transition on some route through the message elements it carries, each once, in the order they were met. An edit to the edge maps back to the model through these. */
92
+ readonly transitions: readonly I["transition"][];
93
+ /** The `message` elements the edge carries, each once, in the order they were met, when it stands for more than one transition. */
94
+ readonly through?: readonly I["element"][];
95
+ }
96
+ interface Flowchart<I extends IdSpace> {
97
+ readonly nodes: readonly FlowNode<I>[];
98
+ readonly edges: readonly FlowEdge<I>[];
99
+ /** What the projection dropped from the model. */
100
+ readonly loss: readonly Loss<I>[];
101
+ }
102
+ /**
103
+ * Activities, decisions and terminators, joined by the transitions between them. A `message` element is not a node: a transition into it continues through it, so the edge runs from the step before the message to the step after it and carries the message (`through`). There is one edge per transition leaving a node and node it leads to, however many routes through message elements connect them; such an edge's `transitions`, `through` and `label` are built when first read. A message element no edge carries is reported as a `message-elements` loss. `state` elements and `history` pseudo-states have no flowchart shape and are reported as unrepresented, with the transitions that touch them.
104
+ * @param model - The model to project.
105
+ * @returns The nodes in model order, the edges in the order of the transitions they start with, and what was dropped.
106
+ */
107
+ declare const toFlowchart: <I extends IdSpace>(model: Model<I>) => Flowchart<I>;
108
+ //#endregion
109
+ //#region ../../core/graph/projection/dist/swimlane.d.ts
110
+ /** One lane. `participant` is a declared role or system; in a runtime model it may instead be an actor that was named but never declared, which `validate` reports. */
111
+ interface Lane<I extends IdSpace> {
112
+ readonly participant: I["participant"] | I["actor"];
113
+ readonly label: string;
114
+ readonly nodes: readonly I["element"][];
115
+ }
116
+ interface Swimlane<I extends IdSpace> extends Flowchart<I> {
117
+ readonly lanes: readonly Lane<I>[];
118
+ /** Nodes with no actor, such as start and end terminators. */
119
+ readonly unassigned: readonly I["element"][];
120
+ readonly handoffs: readonly Handoff<I>[];
121
+ }
122
+ /**
123
+ * A flowchart plus partitions: a lane for every declared role or system, in declaration order and empty when nothing is assigned to it, then a lane for each actor that was named but never declared. Hand-offs are the edges that change lane.
124
+ */
125
+ declare const toSwimlane: <I extends IdSpace>(model: Model<I>) => Swimlane<I>;
126
+ //#endregion
127
+ //#region ../../core/graph/projection/dist/state-machine.d.ts
128
+ interface StateMachineState<I extends IdSpace> {
129
+ readonly id: I["element"];
130
+ readonly label: string;
131
+ readonly role: "initial" | "state" | "final";
132
+ }
133
+ interface StateMachineTransition<I extends IdSpace> {
134
+ readonly source: I["element"];
135
+ readonly target: I["element"];
136
+ readonly event?: I["event"];
137
+ readonly guard?: string;
138
+ readonly effect?: I["action"];
139
+ /** The model transitions this transition stands for: one, or every transition on some route through the elements folded into it, each once, in the order they were met. An edit to it maps back to the model through these. */
140
+ readonly transitions: readonly I["transition"][];
141
+ /** The elements folded into it, each once, in the order they were met: decisions, activities that do not affect the subject, and `message` elements. */
142
+ readonly through?: readonly I["element"][];
143
+ }
144
+ interface StateMachine<I extends IdSpace> {
145
+ readonly subject: I["entity"];
146
+ readonly states: readonly StateMachineState<I>[];
147
+ readonly transitions: readonly StateMachineTransition<I>[];
148
+ /** What the projection dropped from the model. */
149
+ readonly loss: readonly Loss<I>[];
150
+ }
151
+ /**
152
+ * Activity-as-state projection. Each activity that affects the subject becomes a state the subject entity rests in, and a decision collapses into guarded transitions leaving the state before it. The target activity's action becomes the effect of the transition that enters it.
153
+ *
154
+ * Which activities affect the subject is declared by their `affects`. An activity that does not list the subject is not a state of it: transitions through it are folded into the transition that leaves the previous state, exactly as a decision is. Authored `state` elements and pseudo-states are always kept. When no activity in the model declares `affects`, the model carries no such information and every activity is kept, which is the unscoped behaviour.
155
+ *
156
+ * A `message` element is folded the same way, and its `event`, when it has one, triggers the transition that carries it. A message element no drawn transition carries is reported as a `message-elements` loss.
157
+ *
158
+ * Each drawn transition lists the model `transitions` it stands for and the elements folded into it (`through`), so an edit to it maps back to the model. Several routes through folded elements from the same transition to the same state are one drawn transition whose `transitions` and `through` are the union over the routes, each once in the order met; it carries no event or guard, which differ by route, and its effect is only the target's entry action.
159
+ *
160
+ * Decisions are folded into guards by design and are not a loss. Fork, join and history pseudo-states have no state of their own here and are reported as unrepresented, together with the transitions that touch them, which are left out rather than pointing at a state that is not drawn.
161
+ *
162
+ * Other conventions exist, such as steps as transitions with states between them. Naming states such as "Paid" needs authored states, which the model can hold as `state` elements.
163
+ * @param model - The model to project.
164
+ * @param subject - The entity whose lifecycle the machine shows.
165
+ * @returns The states in model order, the transitions leaving each in turn, and what was dropped.
166
+ * @throws Error when `subject` is not a declared entity participant, which only a runtime model can cause.
167
+ */
168
+ declare const toStateMachine: <I extends IdSpace>(model: Model<I>, subject: I["entity"]) => StateMachine<I>;
169
+ //#endregion
170
+ //#region ../../core/graph/projection/dist/sequence.d.ts
171
+ interface SequenceMessage<I extends IdSpace> {
172
+ readonly transition: I["transition"];
173
+ readonly from: I["actor"];
174
+ /** Equal to `from` for a self-message. */
175
+ readonly to: I["actor"];
176
+ readonly label: string;
177
+ /** The `message` element drawn, when the step arrives at one; its `from`, `to`, `label` and `mode` are the message's own. In an edited diagram passed to `diffSequence`, a new message names here the element it arrives at instead. */
178
+ readonly element?: I["element"];
179
+ /** How the message is sent, when it is a `message` element's. A step between two activities has no mode of its own. */
180
+ readonly mode?: MessageMode;
181
+ }
182
+ /** One operand of an emitted fragment: the operand's guard, when it has one, and what happens inside it. */
183
+ interface SequenceOperand<I extends IdSpace> {
184
+ readonly guard?: string;
185
+ readonly items: readonly SequenceItem<I>[];
186
+ }
187
+ /** What every drawn fragment carries, authored or derived. */
188
+ interface FragmentItem<I extends IdSpace> {
189
+ readonly kind: "fragment";
190
+ readonly operator: FragmentOperator;
191
+ /** The operands the scenario takes, in authored or branch order. */
192
+ readonly operands: readonly SequenceOperand<I>[];
193
+ }
194
+ /** A message, or a fragment wrapping the messages of the scenario that fall inside it: an authored one, named by `fragment`, or one derived from the decision or fork named by `element`. */
195
+ type SequenceItem<I extends IdSpace> = {
196
+ readonly kind: "message";
197
+ readonly message: SequenceMessage<I>;
198
+ } | (FragmentItem<I> & {
199
+ readonly fragment: I["fragment"];
200
+ readonly element?: never;
201
+ }) | (FragmentItem<I> & {
202
+ readonly element: I["element"];
203
+ readonly fragment?: never;
204
+ });
205
+ interface SequenceDiagram<I extends IdSpace> {
206
+ /** Actors in order of first appearance. */
207
+ readonly lifelines: readonly I["actor"][];
208
+ /** Every message in scenario order, including those inside fragments. */
209
+ readonly messages: readonly SequenceMessage<I>[];
210
+ /** The same messages, with authored and derived fragments wrapped around the ones that fall inside them. */
211
+ readonly items: readonly SequenceItem<I>[];
212
+ /** What the projection dropped from the model. */
213
+ readonly loss: readonly Loss<I>[];
214
+ }
215
+ /**
216
+ * One path through the process as messages.
217
+ *
218
+ * A step between two elements with actors becomes a message, labelled by the transition's event when it has one and by the target's label otherwise. A step arriving at a `message` element draws that message, with its own `from`, `to`, `label` and `mode`, and the step leaving it continues the same message rather than drawing another. An element with no actor that the scenario passes through, such as a fork or join, passes on whoever reached it: a step leaving it is sent by the actor of the step that arrived. A step that still has no sender, or that arrives at an element with no actor, draws nothing and is reported as `skipped-steps`. Branches off the path are not drawn, which is why this direction is lossy and one-to-many.
219
+ *
220
+ * `messages` is the flat list. `items` is the same messages with fragments wrapped around the ones that fall inside them: the authored `fragments` the scenario passes through, and those its structure implies (an `alt` or `opt` at a decision, a `loop` back through a decision, a `par` at a fork), each derived fragment naming the decision or fork it comes from. A fragment that cannot be drawn faithfully is left out, and an authored one left out is reported in `loss`.
221
+ * @param model - The model to project.
222
+ * @param scenario - The transitions the path takes, in order.
223
+ * @returns Lifelines in order of first appearance, the messages, the items and what was dropped.
224
+ * @throws Error when a scenario step is not a declared transition.
225
+ */
226
+ declare const toSequence: <I extends IdSpace>(model: Model<I>, scenario: readonly I["transition"][]) => SequenceDiagram<I>;
227
+ //#endregion
228
+ //#region ../../core/graph/projection/dist/diff.d.ts
229
+ /** Where a transition runs from and to. */
230
+ interface Ends<I extends IdSpace> {
231
+ readonly source: I["element"];
232
+ readonly target: I["element"];
233
+ }
234
+ /** Who sends and who receives a `message` element. */
235
+ interface Addressing<I extends IdSpace> {
236
+ readonly from: I["actor"];
237
+ readonly to: I["actor"];
238
+ }
239
+ /**
240
+ * A change to one element that an edited view implies. `inferred` is true when the view did not determine the change and the inverse chose it, for instance a new step a sequence diagram implies; such a change stays unapplied until it is confirmed with `confirmChanges`.
241
+ */
242
+ type ElementChange<I extends IdSpace> = {
243
+ readonly kind: "added";
244
+ readonly element: Element<I["element"], I>;
245
+ readonly inferred: boolean;
246
+ } | {
247
+ readonly kind: "removed";
248
+ readonly element: I["element"];
249
+ readonly inferred: boolean;
250
+ } | {
251
+ readonly kind: "renamed";
252
+ readonly element: I["element"];
253
+ readonly from: string;
254
+ readonly to: string;
255
+ readonly inferred: boolean;
256
+ } |
257
+ /** The element moved to another actor's lane; `undefined` is no actor. */
258
+ {
259
+ readonly kind: "relaned";
260
+ readonly element: I["element"];
261
+ readonly from: I["actor"] | undefined;
262
+ readonly to: I["actor"] | undefined;
263
+ readonly inferred: boolean;
264
+ } |
265
+ /** A `message` element now goes between other actors. */
266
+ {
267
+ readonly kind: "readdressed";
268
+ readonly element: I["element"];
269
+ readonly from: Addressing<I>;
270
+ readonly to: Addressing<I>;
271
+ readonly inferred: boolean;
272
+ };
273
+ /** A change to one of a transition's labels: its human `guard`, its `trigger` event or its `effect` action. */
274
+ type TransitionFieldChange<I extends IdSpace> = {
275
+ readonly field: "guard";
276
+ readonly from: string | undefined;
277
+ readonly to: string | undefined;
278
+ } | {
279
+ readonly field: "trigger";
280
+ readonly from: I["event"] | undefined;
281
+ readonly to: I["event"] | undefined;
282
+ } | {
283
+ readonly field: "effect";
284
+ readonly from: I["action"] | undefined;
285
+ readonly to: I["action"] | undefined;
286
+ };
287
+ /** A change to one transition that an edited view implies. `inferred` has the same meaning as on `ElementChange`. */
288
+ type TransitionChange<I extends IdSpace> = {
289
+ readonly kind: "added";
290
+ readonly transition: Transition<I["transition"], I>;
291
+ readonly inferred: boolean;
292
+ } | {
293
+ readonly kind: "removed";
294
+ readonly transition: I["transition"];
295
+ readonly inferred: boolean;
296
+ } | {
297
+ readonly kind: "rewired";
298
+ readonly transition: I["transition"];
299
+ readonly from: Ends<I>;
300
+ readonly to: Ends<I>;
301
+ readonly inferred: boolean;
302
+ } | (TransitionFieldChange<I> & {
303
+ readonly kind: "changed";
304
+ readonly transition: I["transition"];
305
+ readonly inferred: boolean;
306
+ });
307
+ /** A renamed event: a sequence message labelled by its trigger's name was relabelled. */
308
+ interface EventChange<I extends IdSpace> {
309
+ readonly kind: "renamed";
310
+ readonly event: I["event"];
311
+ readonly from: string;
312
+ readonly to: string;
313
+ readonly inferred: boolean;
314
+ }
315
+ /** What an edited view changes in the model, by identifier. Each list is in the order the changes were found: the model's order for what was there, then the view's order for what is new. */
316
+ interface ModelDiff<I extends IdSpace> {
317
+ readonly elements: readonly ElementChange<I>[];
318
+ readonly transitions: readonly TransitionChange<I>[];
319
+ readonly events: readonly EventChange<I>[];
320
+ }
321
+ /** Any one change in a `ModelDiff`. */
322
+ type Change<I extends IdSpace> = ElementChange<I> | TransitionChange<I> | EventChange<I>;
323
+ /** Thrown by `applyModelDiff` when the diff still holds changes the inverse inferred and nobody confirmed. */
324
+ declare class UnconfirmedChangeError<I extends IdSpace> extends Error {
325
+ /** The changes still marked `inferred`. */
326
+ readonly changes: readonly Change<I>[];
327
+ constructor(changes: readonly Change<I>[]);
328
+ }
329
+ /**
330
+ * Marks inferred changes as confirmed, so `applyModelDiff` will apply them.
331
+ * @param diff - A diff returned by one of the view inverses.
332
+ * @param accept - Chooses which inferred changes to confirm; the rest stay inferred.
333
+ * @returns A new diff; `diff` is not modified.
334
+ */
335
+ declare const confirmChanges: <I extends IdSpace>(diff: ModelDiff<I>, accept: (change: Change<I>) => boolean) => ModelDiff<I>;
336
+ /**
337
+ * Applies a confirmed diff to the model, returning a new model.
338
+ *
339
+ * Removing an element also takes it out of fragment bodies and recorded positions; removing a transition also takes it out of every sequence scenario. Transitions that touched a removed element are only removed when the diff says so, as every view inverse does, so a diff built by hand that leaves one dangling yields a model `validate` reports.
340
+ * @param model - The model the diff was computed against.
341
+ * @param diff - The changes, with every inferred one confirmed.
342
+ * @returns The changed model; `model` is not modified.
343
+ * @throws UnconfirmedChangeError when a change is still marked `inferred`.
344
+ * @throws Error when a change names an element, transition or event the model does not have, or asks for something the element's kind cannot carry, such as a label on a pseudo-state.
345
+ */
346
+ declare const applyModelDiff: <I extends IdSpace>(model: Model<I>, diff: ModelDiff<I>) => Model<I>;
347
+ //#endregion
348
+ //#region ../../core/graph/projection/dist/inverse-flowchart.d.ts
349
+ /**
350
+ * The inverse of `toFlowchart`: what an edited flowchart changes in the model, matched by element and transition id.
351
+ *
352
+ * A node not in the projection is an added element: a process an activity, a decision a decision, both certain; a terminator or bar a pseudo-state whose role is inferred from its edges. A projected node missing from the edit is removed, and a changed label renames the element. An edge is matched by where it comes from: the transition it starts with and the node one of its transitions arrives at. A new edge must carry one new transition id and is an added transition; a projected edge missing from the edit removes its transition; moved ends rewire it; a changed label changes its guard. An edge that carries messages stands for every route through them, so its earlier steps are shared with other edges: moving its source rewires its first transition, which is certain, while removing it or moving its target acts on each step from a message into its end, once however many edges share them, and is inferred.
353
+ * @param model - The model the flowchart was projected from.
354
+ * @param edited - The projected flowchart after editing. Its `loss` is not read.
355
+ * @returns The changes, with no event changes, since a flowchart draws no events.
356
+ * @throws Error when the edit cannot be expressed in the model: a node that is a model element the flowchart does not draw, a changed shape, a relabelled terminator or bar, an unmatched edge that is not a single new transition, a relabelled edge that carries a message, or edges sharing their last steps moved to different ends.
357
+ */
358
+ declare const diffFlowchart: <I extends IdSpace>(model: Model<I>, edited: Readonly<{
359
+ nodes: readonly FlowNode<I>[];
360
+ edges: readonly FlowEdge<I>[];
361
+ }>) => ModelDiff<I>;
362
+ /**
363
+ * The inverse of `toSwimlane`: the flowchart changes plus the lane moves. A node is placed with the actor of the lane it is in, or with none when it is in `unassigned`; an activity or decision whose actor differs from the model's is relaned, and an added activity or decision takes its lane's actor. Hand-offs are derived and not read.
364
+ * @param model - The model the swimlane was projected from.
365
+ * @param edited - The projected swimlane after editing.
366
+ * @returns The changes; see `diffFlowchart` for nodes and edges.
367
+ * @throws Error in the cases `diffFlowchart` does, when a lane belongs to a participant that cannot act, or when a pseudo-state is put in a lane.
368
+ */
369
+ declare const diffSwimlane: <I extends IdSpace>(model: Model<I>, edited: Readonly<Pick<Swimlane<I>, "nodes" | "edges" | "lanes">>) => ModelDiff<I>;
370
+ //#endregion
371
+ //#region ../../core/graph/projection/dist/inverse-state-machine.d.ts
372
+ /**
373
+ * The inverse of `toStateMachine`: what an edited state machine changes in the model, matched by element and transition id.
374
+ *
375
+ * A state not in the projection is an added element: a `state` element for a plain state, or an initial or final pseudo-state. A projected state missing from the edit is removed, and a changed label renames the activity or state behind it.
376
+ *
377
+ * A drawn transition is matched by where it comes from: its first model transition and the state one of its model transitions arrives at. One that stands for a single transition maps straight back: moved ends rewire it, and a changed event, guard or effect changes that transition's trigger, guard or effect. One that stands for a chain through folded elements (decisions, activities that do not affect the subject, messages) shares its later steps with every other chain through the same elements, so the inverse has to choose: moving its source rewires the first step and is certain, but moving its target, changing its labels or removing it acts on each step from a folded element into its target state, once however many drawn transitions share it, and is marked `inferred`. A new transition must carry one new transition id and is added with its event, guard and effect.
378
+ * @param model - The model the machine was projected from.
379
+ * @param edited - The projected machine after editing; `subject` says which projection it was. Its `loss` is not read.
380
+ * @returns The changes, with no event changes, since a state machine names events by id.
381
+ * @throws Error when the edit cannot be expressed in the model: a state that is a model element the machine does not draw, a changed role, a relabelled initial or final state, an unmatched transition that is not a single new transition, or a changed effect where the effect is the target activity's action.
382
+ */
383
+ declare const diffStateMachine: <I extends IdSpace>(model: Model<I>, edited: Readonly<Pick<StateMachine<I>, "subject" | "states" | "transitions">>) => ModelDiff<I>;
384
+ //#endregion
385
+ //#region ../../core/graph/projection/dist/inverse-sequence.d.ts
386
+ /**
387
+ * The inverse of `toSequence`: what an edited sequence diagram changes in the model. A sequence diagram shows one path and leaves out who owns which step, so most of what it implies has to be inferred, and every such change is marked `inferred` until it is confirmed.
388
+ *
389
+ * Messages are matched to the projection by transition id, occurrence by occurrence, since a loop repeats a step. For a matched message:
390
+ *
391
+ * - a changed label renames what the label came from, which is certain: the `message` element it draws, the event that triggers the step, or the step's target element;
392
+ * - changed ends on a `message` element readdress it, which is certain;
393
+ * - a changed receiver relanes the step's target and a changed sender relanes its source, both inferred, since the edit could equally mean a different element.
394
+ *
395
+ * A projected message missing from the edit removes its transition, inferred, since it may only have left this scenario. A message with a new transition id is a new step, inferred: it must name the element it arrives at in `element` (an existing element, or a new activity owned by its receiver, labelled with the message), and it leaves from where the latest earlier message to its sender arrived. When the message after it was a step from that same place, that step is rewired to leave from the new element instead, inferred. Lifelines and items are derived from the messages and not read.
396
+ * @param model - The model the diagram was projected from.
397
+ * @param scenario - The scenario it was projected for.
398
+ * @param edited - The projected diagram after editing.
399
+ * @returns The changes, each listed once.
400
+ * @throws Error when the edit cannot be expressed in the model: a model transition added to the diagram that the scenario does not take (a scenario change, not a model change), a changed `element` on a drawn message, a changed sender on a step whose sender comes from an earlier step, or a new message with no `element` or with no earlier message to its sender.
401
+ */
402
+ declare const diffSequence: <I extends IdSpace>(model: Model<I>, scenario: readonly I["transition"][], edited: Readonly<Pick<SequenceDiagram<I>, "messages">>) => ModelDiff<I>;
403
+ //#endregion
404
+ export { Flowchart as A, StateMachineTransition as C, toSwimlane as D, Swimlane as E, UnrepresentedElement as F, UnrepresentedKind as I, Handoff as M, handoffs as N, FlowEdge as O, Loss as P, StateMachineState as S, Lane as T, SequenceItem as _, Addressing as a, toSequence as b, Ends as c, TransitionChange as d, TransitionFieldChange as f, SequenceDiagram as g, confirmChanges as h, diffSwimlane as i, toFlowchart as j, FlowNode as k, EventChange as l, applyModelDiff as m, diffStateMachine as n, Change as o, UnconfirmedChangeError as p, diffFlowchart as r, ElementChange as s, diffSequence as t, ModelDiff as u, SequenceMessage as v, toStateMachine as w, StateMachine as x, SequenceOperand as y };
@@ -0,0 +1,58 @@
1
+ import { n as GraphqlFetch, t as GitHubTokenPort, u as GraphSourcePager } from "./graphql-C1j5wQFz.js";
2
+ //#region ../../adapters/graph/source-github-issues/dist/source.d.ts
3
+ /** What the GitHub issues source needs. */
4
+ interface GitHubIssuesSourceOptions {
5
+ /** Supplies a token per owner. `githubTokenFromEnvironment`, from the `./node` entry point, reads `GITHUB_TOKEN` or `gh auth token`. */
6
+ readonly token: GitHubTokenPort;
7
+ /** The fetch implementation; the global `fetch` when absent. */
8
+ readonly fetch?: GraphqlFetch;
9
+ /** The clock, in milliseconds since the epoch; `Date.now` when absent. */
10
+ readonly now?: () => number;
11
+ /** Issues per page, and connection items per request, from 1 to GitHub's limit of 100. */
12
+ readonly pageSize?: number;
13
+ }
14
+ /**
15
+ * The GitHub issues `GraphSourcePager`. A page is one page of one repository's issues, or of one board's items: each issue becomes a bound activity (`github:owner/repo#n`) whose actor is its repository, each `blockedBy` and `blocking` entry a transition from the blocker to the blocked issue (one transition, whichever side it is read from), each sub-issue a `child-of` relation, each assignee an `assigned-to` relation, and the repository `part-of` its owner. Blockers, blocked issues and sub-issues in other repositories or organisations are included with their own repository and owner. Open issues are `open` in the overlay and closed ones `done`.
16
+ *
17
+ * Scopes are read in request order, each once: `github:owner/repo` for one repository, `github:owner` for every repository the account owns, by name, and `github:owner/projects/number` for the issues on an organisation's or user's Projects v2 board, in the board's order (its pull requests and draft issues are not issues, so they are passed over). A repository, owner or board that does not exist or that the token cannot see is a gap, and the sync continues. A filter narrows and orders each repository's issue listing on GitHub's side; a board has no such listing, so a filter with a board scope is a `bad-request` with `invalid-scope`.
18
+ *
19
+ * The pager also lists scopes: the viewer's own account and organisations at the top, and an owner's repositories, by name, inside it.
20
+ * @param options - The token port, and optionally fetch, clock and page size.
21
+ * @returns A pager for `createGraphSourceRouter`.
22
+ * @throws RangeError when `pageSize` is not an integer from 1 to 100.
23
+ */
24
+ declare const createGitHubIssuesSource: (options: GitHubIssuesSourceOptions) => GraphSourcePager;
25
+ //#endregion
26
+ //#region ../../adapters/graph/source-github-issues/dist/tokens.d.ts
27
+ /** A token a host keeps, such as one a person entered in a browser, with what it may be used for. */
28
+ interface StoredGitHubToken {
29
+ /** The token itself. It is only ever returned to the adapter, which sends it in the `Authorization` header. */
30
+ readonly token: string;
31
+ /** The logins of the owners it is for, or `"any"` for a token that serves every owner. */
32
+ readonly owners: readonly string[] | "any";
33
+ /** When it was last used, as an ISO 8601 instant; absent when it never has been. */
34
+ readonly lastUsedAt?: string;
35
+ }
36
+ /**
37
+ * Picks the stored token for a request about one owner. A token scoped to that owner wins over one scoped to any owner; among owner-scoped tokens the one naming the fewest owners wins, being the most specific, then the most recently used; among tokens for any owner the most recently used wins. A request about the token's own holder (`owner` undefined) can only use a token for any owner. Logins match without regard to case, as GitHub's do.
38
+ * @param tokens - The stored tokens.
39
+ * @param owner - The login the request is about, or `undefined` for the token's own holder.
40
+ * @returns The token to use, or `undefined` when none fits.
41
+ */
42
+ declare const selectStoredToken: (tokens: readonly StoredGitHubToken[], owner: string | undefined) => StoredGitHubToken | undefined;
43
+ /** Where `storedTokenPort` reads the host's tokens, and how it reports one being used. */
44
+ interface StoredTokenPortOptions {
45
+ /** Reads the stored tokens; called for every request, so a token added or removed takes effect on the next one. */
46
+ readonly list: (signal: AbortSignal | undefined) => Promise<readonly StoredGitHubToken[]>;
47
+ /** Told of each token chosen, so the host can record when it was used and keep the recency order current. */
48
+ readonly used?: (token: StoredGitHubToken) => void;
49
+ }
50
+ /**
51
+ * A token port over tokens a host keeps, choosing one per request with `selectStoredToken`.
52
+ * @param options - How to read the stored tokens, and how to report one being used.
53
+ * @returns The token port.
54
+ * @throws GraphSourceError with `unauthorised`, from the port, when no stored token fits the owner; the message names the owner and never a token.
55
+ */
56
+ declare const storedTokenPort: (options: StoredTokenPortOptions) => GitHubTokenPort;
57
+ //#endregion
58
+ export { GitHubIssuesSourceOptions as a, storedTokenPort as i, StoredTokenPortOptions as n, createGitHubIssuesSource as o, selectStoredToken as r, StoredGitHubToken as t };
@@ -0,0 +1,110 @@
1
+ import { A as Views, G as IdSpace } from "./index-CmZOswkx.js";
2
+ import { A as Flowchart, E as Swimlane, x as StateMachine } from "./index-CoA6vXqe.js";
3
+ //#region ../../core/graph/layout/dist/engine.d.ts
4
+ /** A box with a fixed size, which the engine places. */
5
+ interface EngineLeaf {
6
+ readonly id: string;
7
+ readonly width: number;
8
+ readonly height: number;
9
+ readonly children?: never;
10
+ }
11
+ /**
12
+ * A box that encloses other nodes. The engine sizes it to fit its children, and never makes it smaller than `width` by `height`, so an empty group keeps a usable extent.
13
+ */
14
+ interface EngineGroup {
15
+ readonly id: string;
16
+ readonly width: number;
17
+ readonly height: number;
18
+ readonly children: readonly EngineNode[];
19
+ }
20
+ type EngineNode = EngineLeaf | EngineGroup;
21
+ /** A directed edge between two leaves, which may sit in different groups. */
22
+ interface EngineEdge {
23
+ readonly id: string;
24
+ readonly source: string;
25
+ readonly target: string;
26
+ }
27
+ /** The direction in which edges generally point. */
28
+ type Direction = "right" | "down" | "left" | "up";
29
+ /** A layered layout request, free of any engine's own vocabulary. */
30
+ interface EngineGraph {
31
+ readonly direction: Direction;
32
+ /** The gap between two nodes in the same layer. */
33
+ readonly nodeGap: number;
34
+ /** The gap between two consecutive layers. */
35
+ readonly layerGap: number;
36
+ /** The space between a group's border and its children. */
37
+ readonly groupPadding: number;
38
+ readonly nodes: readonly EngineNode[];
39
+ readonly edges: readonly EngineEdge[];
40
+ }
41
+ /** One placed node, with its top-left corner in the coordinate space of the whole graph. */
42
+ interface EngineBox {
43
+ readonly id: string;
44
+ readonly x: number;
45
+ readonly y: number;
46
+ readonly width: number;
47
+ readonly height: number;
48
+ }
49
+ /**
50
+ * The layout engine behind `layout`. An implementation must place every node of the graph, groups included, and return the same boxes for the same graph. It may run in the calling context or across a transport such as a Worker; `layout` stops waiting for it when the signal aborts, and an implementation should stop work as well.
51
+ */
52
+ interface LayoutEngine {
53
+ readonly arrange: (graph: EngineGraph, signal: AbortSignal | undefined) => Promise<readonly EngineBox[]>;
54
+ }
55
+ //#endregion
56
+ //#region ../../core/graph/layout/dist/metrics.d.ts
57
+ /** The room a node of each kind of shape takes, in the coordinate space of the layout. */
58
+ interface Size {
59
+ readonly width: number;
60
+ readonly height: number;
61
+ }
62
+ //#endregion
63
+ //#region ../../core/graph/layout/dist/layout.d.ts
64
+ /**
65
+ * A projection result that can be laid out. A sequence diagram is not here: its lifelines and messages have a fixed arrangement, not a graph to place.
66
+ */
67
+ type LayoutView<I extends IdSpace> = Flowchart<I> | Swimlane<I> | StateMachine<I>;
68
+ interface LayoutOptions {
69
+ /** The direction in which edges generally point. Defaults to `"right"`. */
70
+ readonly direction?: Direction;
71
+ /** Overrides for the gaps, in layout units. Each defaults to a grid-derived constant. */
72
+ readonly spacing?: {
73
+ /** The gap between two nodes in the same layer. */
74
+ readonly node?: number;
75
+ /** The gap between consecutive layers. */
76
+ readonly layer?: number;
77
+ };
78
+ /** Rejects the returned promise with the signal's reason when it aborts. */
79
+ readonly signal?: AbortSignal;
80
+ /** The engine that places the nodes. Defaults to elkjs's layered algorithm run in the calling context. */
81
+ readonly engine?: LayoutEngine;
82
+ }
83
+ /** The bounds of one swimlane, in the same coordinate space as the node positions. */
84
+ interface LaneBounds<I extends IdSpace> {
85
+ readonly participant: I["participant"] | I["actor"];
86
+ readonly x: number;
87
+ readonly y: number;
88
+ readonly width: number;
89
+ readonly height: number;
90
+ }
91
+ interface LayoutResult<I extends IdSpace> {
92
+ /** Top-left positions keyed by notation and element id: the model's `views` shape, ready to assign to `Model.views`. */
93
+ readonly views: Views<I["element"]>;
94
+ /** The extent of each placed element, which a position alone does not give. */
95
+ readonly sizes: Readonly<Partial<Record<I["element"], Size>>>;
96
+ /** One entry per swimlane lane, in the view's lane order; empty for a flowchart and a state machine. */
97
+ readonly lanes: readonly LaneBounds<I>[];
98
+ }
99
+ /**
100
+ * Places a projected view with a layered layout and returns where each element goes, as the model's `views` shape.
101
+ *
102
+ * Pure with respect to the model: it reads only the view, never mutates it, and the model stores the result apart from its semantics, so no projection reads a coordinate. The same view and options give the same positions with the default engine. Swimlane lanes are groups, and every node lies inside its lane's bounds.
103
+ * @param view - A flowchart, swimlane or state machine from the projection package.
104
+ * @param options - Direction, spacing, abort signal and engine.
105
+ * @returns Positions keyed by notation and element id, element sizes and lane bounds.
106
+ * @throws The signal's reason when `options.signal` aborts before the layout completes.
107
+ */
108
+ declare const layout: <I extends IdSpace>(view: LayoutView<I>, options?: LayoutOptions) => Promise<LayoutResult<I>>;
109
+ //#endregion
110
+ export { layout as a, EngineBox as c, EngineGroup as d, EngineLeaf as f, LayoutView as i, EngineEdge as l, LayoutEngine as m, LayoutOptions as n, Size as o, EngineNode as p, LayoutResult as r, Direction as s, LaneBounds as t, EngineGraph as u };