process-graph 1.1.1 → 1.3.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 (50) hide show
  1. package/README.md +22 -19
  2. package/dist/bin.js +4 -3
  3. package/dist/cli.d.ts +100 -14
  4. package/dist/cli.js +3 -2
  5. package/dist/{control-aDk9560d.js → control-DiygoEhm.js} +163 -1
  6. package/dist/data-file-BVMxkTug.js +95 -0
  7. package/dist/dist-81kTKnMq.js +3 -0
  8. package/dist/{dist-HLlW8vgT.js → dist-BI01yxFA.js} +256 -103
  9. package/dist/{dist-BpCBmnMl.js → dist-arkejVz2.js} +2 -112
  10. package/dist/{graphql-C1j5wQFz.d.ts → graphql-BE7xm5dB.d.ts} +3 -2
  11. package/dist/{index-DricKcyl.d.ts → index-9Au8pAmP.d.ts} +4 -4
  12. package/dist/{index-CrM5qWUA.d.ts → index-BC4tmAuQ.d.ts} +2 -2
  13. package/dist/{index-DhbvDgK4.d.ts → index-CR8xUK3S.d.ts} +388 -580
  14. package/dist/{index-CoA6vXqe.d.ts → index-D06bcdfw.d.ts} +1 -1
  15. package/dist/{index-CCfe0csl.d.ts → index-D4CnOhNf.d.ts} +34 -3
  16. package/dist/{index-CmZOswkx.d.ts → index-Dvz_I_uQ.d.ts} +17 -8
  17. package/dist/{index-CptUHq6F.d.ts → index-hri2a13-.d.ts} +1 -1
  18. package/dist/index.d.ts +4 -4
  19. package/dist/index.js +5 -5
  20. package/dist/layout.d.ts +1 -1
  21. package/dist/{parse-CuipC_2K.js → parse-C1Q1zsGt.js} +1 -1
  22. package/dist/{queries-CCexJAE2.js → queries-C8kIDRiY.js} +2 -93
  23. package/dist/react-flow.d.ts +5 -5
  24. package/dist/react-flow.js +3 -3
  25. package/dist/react.d.ts +1 -1
  26. package/dist/react.js +2 -2
  27. package/dist/{router-D4gtTlXm.js → router-Dk91O_9p.js} +27 -2
  28. package/dist/{schema-CVnS6HiX.js → schema-BPT8fmfa.js} +2 -2
  29. package/dist/{selection-BW_xXWOy.js → selection-iet5RAlP.js} +1 -1
  30. package/dist/source/github/node.d.ts +1 -1
  31. package/dist/source/github.d.ts +2 -2
  32. package/dist/source/github.js +1 -1
  33. package/dist/{source-DRDpEA8Q.js → source-D51N7K3A.js} +23 -3
  34. package/dist/store/node.d.ts +27 -2
  35. package/dist/store/node.js +2 -2
  36. package/dist/store/wasm/worker.js +2 -2
  37. package/dist/store/wasm.d.ts +1 -1
  38. package/dist/{store-BcR70CaO.js → store-DKzvLGgl.js} +252 -37
  39. package/dist/store.d.ts +115 -3
  40. package/dist/store.js +43 -9
  41. package/dist/theme-values-BJJhAkUn-ORyRUrPf.js +114 -0
  42. package/dist/theme-values-BybZ-cle.d.ts +116 -0
  43. package/dist/ui/theme.d.ts +2 -0
  44. package/dist/ui/theme.js +2 -0
  45. package/dist/ui.d.ts +6 -120
  46. package/dist/ui.js +2 -1
  47. package/dist/version-Dagrkvwt.js +5 -0
  48. package/package.json +28 -23
  49. package/dist/dist-IjrgWhHQ.js +0 -3
  50. package/dist/open-CyRXJ4bt.js +0 -29
@@ -1,4 +1,4 @@
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";
1
+ import { A as Transition, F as Notation, K as IdSpace, N as FragmentOperator, P as MessageMode, R as PseudoRole, S as Element, _ as Model } from "./index-Dvz_I_uQ.js";
2
2
  //#region ../../core/graph/projection/dist/loss.d.ts
3
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
4
  type UnrepresentedKind = "activity" | "decision" | "state" | "message" | PseudoRole;
@@ -1,5 +1,5 @@
1
- import { G as IdSpace, a as Overlay, g as Model } from "./index-CmZOswkx.js";
2
- import { JsonValue, Resolution } from "trilean";
1
+ import { K as IdSpace, _ as Model, o as Overlay } from "./index-Dvz_I_uQ.js";
2
+ import { ComputedValue, ExpressionNode, JsonValue, PredicateNode, Resolution } from "trilean";
3
3
  //#region ../../core/graph/domain/dist/status.d.ts
4
4
  /** The derived states of an element, in the order the derivation considers them. */
5
5
  declare const statuses: readonly ["done", "unknown", "skipped", "ready", "blocked"];
@@ -41,6 +41,37 @@ declare const elementStatusKey: (id: string) => JsonValue;
41
41
  * @returns The key the port is asked.
42
42
  */
43
43
  declare const artefactKey: (id: string) => JsonValue;
44
+ /**
45
+ * What is known from outside the process about one run, as plain data a store can keep: which artefacts are provided, and the values of named facts that conditions read.
46
+ *
47
+ * Each part is three-valued by presence. An artefact mapped to `true` is provided and one mapped to `false` is known not to be; an artefact the record does not name is unknown, which `isProvided` treats as not provided but a condition reading `artefactKey` sees as indeterminate. A named fact holds a trilean value; a name the record does not hold is unknown, so a condition reading it is indeterminate.
48
+ */
49
+ interface FactRecord {
50
+ /** The artefacts whose provision is known, by artefact id. */
51
+ readonly artefacts: Readonly<Record<string, boolean>>;
52
+ /** The values of named facts, by the name a condition's `reference` node gives as its key. */
53
+ readonly values: Readonly<Record<string, ComputedValue>>;
54
+ }
55
+ /** A record that knows nothing: no artefact is provided and every named fact is unknown. */
56
+ declare const emptyFactRecord: FactRecord;
57
+ /**
58
+ * Adapts a fact record to the `Facts` port. A string key is a named fact, answered with its value when the record holds it; a key built by `artefactKey` is answered with the boolean the record holds for that artefact; every other key, and any name or artefact the record does not hold, is not found.
59
+ * @param record - What is known.
60
+ * @returns A `Facts` port reading the record.
61
+ */
62
+ declare const factsFrom: (record: FactRecord) => Facts;
63
+ /**
64
+ * The named facts a condition reads: the string key of every `reference` node in it, each once, in the order first met walking the tree depth first. Reserved keys and other non-string keys are not names, so they are left out, and a reference's own key is never searched for further references.
65
+ * @param condition - A trilean predicate or expression, such as a transition's `condition`.
66
+ * @returns The names, each once.
67
+ */
68
+ declare const factNamesIn: (condition: PredicateNode | ExpressionNode) => readonly string[];
69
+ /**
70
+ * Layers facts ports: each key is answered by the first port that finds it, so an earlier port overrides a later one only where it knows the answer.
71
+ * @param ports - The ports, most authoritative first.
72
+ * @returns A `Facts` port that is not found only when no port finds the key.
73
+ */
74
+ declare const layeredFacts: (...ports: readonly Facts[]) => Facts;
44
75
  /**
45
76
  * 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
77
  */
@@ -350,4 +381,4 @@ interface UnmetOutput<I extends IdSpace> {
350
381
  */
351
382
  declare const unmetOutputs: <I extends IdSpace>(model: Model<I>, overlay: Readonly<Overlay<I>>, facts: Facts) => readonly UnmetOutput<I>[];
352
383
  //#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 };
384
+ export { Facts as A, Status as B, CriticalPath as C, UnknownReference as D, NodeId as E, evaluateBranches as F, factNamesIn as I, factsFrom as L, artefactKey as M, elementStatusKey as N, buildDag as O, emptyFactRecord as P, layeredFacts as R, loopTransitions as S, Dag as T, statuses as V, 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, UnsupportedConditionError as j, FactRecord 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, Branch as z };
@@ -282,12 +282,8 @@ declare const validateOverlay: <I extends IdSpace>(model: Model<I>, overlay: Rea
282
282
  declare const parseOverlay: (input: unknown) => Overlay<OpenIds>;
283
283
  //#endregion
284
284
  //#region ../../core/graph/schema/dist/schema.d.ts
285
- /**
286
- * The open (runtime) shape of a model: identifiers are plain strings, so references are not checked here. `validate` checks what the shape cannot, and `parseModel` runs both.
287
- *
288
- * Every object is strict. The inferred type is exactly `Model<OpenIds>`, which a type-level test pins in both directions.
289
- */
290
- declare const modelSchema: z.ZodReadonly<z.ZodObject<{
285
+ /** The strict object schema inside `modelSchema`, before it is made read-only. */
286
+ declare const modelObjectSchema: z.ZodObject<{
291
287
  participants: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
292
288
  id: z.ZodString;
293
289
  label: z.ZodString;
@@ -476,7 +472,20 @@ declare const modelSchema: z.ZodReadonly<z.ZodObject<{
476
472
  x: z.ZodNumber;
477
473
  y: z.ZodNumber;
478
474
  }, z.core.$strict>>>>>>>;
479
- }, z.core.$strict>>;
475
+ }, z.core.$strict>;
476
+ /**
477
+ * The type of `modelSchema`, declared by name so that a declaration file that embeds the schema, such as a consumer's `z.object({ model: modelSchema })` under `declaration: true`, refers to `ModelSchema` rather than writing out the whole model schema with every record and trilean's JSON value inline, which can exceed the length the compiler will serialise (TS7056).
478
+ */
479
+ interface ModelSchema extends z.ZodReadonly<typeof modelObjectSchema> {
480
+ /** The strict object schema inside, whose `shape` holds each record's own schema. */
481
+ readonly unwrap: () => typeof modelObjectSchema;
482
+ }
483
+ /**
484
+ * The open (runtime) shape of a model: identifiers are plain strings, so references are not checked here. `validate` checks what the shape cannot, and `parseModel` runs both.
485
+ *
486
+ * Every object is strict. The inferred type is exactly `Model<OpenIds>`, which a type-level test pins in both directions.
487
+ */
488
+ declare const modelSchema: ModelSchema;
480
489
  //#endregion
481
490
  //#region ../../core/graph/schema/dist/parse.d.ts
482
491
  /** A problem found while loading a model: a shape violation located by JSON pointer, or a rule `validate` reports. */
@@ -509,4 +518,4 @@ declare class ModelParseError extends Error {
509
518
  */
510
519
  declare const parseModel: (input: unknown) => Model<OpenIds>;
511
520
  //#endregion
512
- export { Views as A, messageModes as B, Extensions as C, Point as D, Participant as E, OverlayStatus as F, IdSpace as G, overlayStatuses as H, ParticipantKind as I, OpenIds as K, PseudoRole as L, FragmentOperator as M, MessageMode as N, Projection as O, Notation as P, elementKinds as R, EventDef as S, FragmentOperand as T, participantKinds as U, notations as V, pseudoRoles as W, ModelParts as _, Overlay as a, ArtefactDef as b, overlaySchema as c, Issue as d, IssueCode as f, Model as g, outputsOf as h, modelSchema as i, ElementKind as j, Transition as k, parseOverlay as l, inputsOf as m, ModelParseError as n, OverlayIssue as o, validate as p, parseModel as r, OverlayParseError as s, ModelIssue as t, validateOverlay as u, defineModel as v, Fragment as w, Element as x, ActionDef as y, fragmentOperators as z };
521
+ export { Transition as A, fragmentOperators as B, EventDef as C, Participant as D, FragmentOperand as E, Notation as F, pseudoRoles as G, notations as H, OverlayStatus as I, IdSpace as K, ParticipantKind as L, ElementKind as M, FragmentOperator as N, Point as O, MessageMode as P, PseudoRole as R, Element as S, Fragment as T, overlayStatuses as U, messageModes as V, participantKinds as W, Model as _, modelSchema as a, ActionDef as b, OverlayParseError as c, validateOverlay as d, Issue as f, outputsOf as g, inputsOf as h, ModelSchema as i, Views as j, Projection as k, overlaySchema as l, validate as m, ModelParseError as n, Overlay as o, IssueCode as p, OpenIds as q, parseModel as r, OverlayIssue as s, ModelIssue as t, parseOverlay as u, ModelParts as v, Extensions as w, ArtefactDef as x, defineModel as y, elementKinds as z };
@@ -1,4 +1,4 @@
1
- import { n as GraphqlFetch, t as GitHubTokenPort, u as GraphSourcePager } from "./graphql-C1j5wQFz.js";
1
+ import { n as GraphqlFetch, t as GitHubTokenPort, u as GraphSourcePager } from "./graphql-BE7xm5dB.js";
2
2
  //#region ../../adapters/graph/source-github-issues/dist/source.d.ts
3
3
  /** What the GitHub issues source needs. */
4
4
  interface GitHubIssuesSourceOptions {
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { A as UnsupportedConditionError, C as CriticalPath, D as UnknownReference, E as NodeId, F as Status, I as statuses, M as elementStatusKey, N as evaluateBranches, O as buildDag, P as Branch, S as loopTransitions, T as Dag, _ as StatusRule, a as criticalPath, b as controlDag, c as unmetOutputs, d as StatusExplanation, f as explainStatus, g as StatusBasis, h as ProducerBasis, i as blockedBy, j as artefactKey, k as Facts, l as whatIfDone, m as IncomingBasis, n as UnmetOutput, o as impact, p as ArtefactBasis, r as WhatIf, s as readySet, t as StatusChange, u as ChainLink, v as deriveStatuses, w as criticalPath$1, x as illegalCycles, y as statusRules } from "./index-CCfe0csl.js";
2
- import { A as Views, B as messageModes, C as Extensions, D as Point, E as Participant, F as OverlayStatus, G as IdSpace, H as overlayStatuses, I as ParticipantKind, K as OpenIds, L as PseudoRole, M as FragmentOperator, N as MessageMode, O as Projection, P as Notation, R as elementKinds, S as EventDef, T as FragmentOperand, U as participantKinds, V as notations, W as pseudoRoles, _ as ModelParts, a as Overlay, b as ArtefactDef, c as overlaySchema, d as Issue, f as IssueCode, g as Model, h as outputsOf, i as modelSchema, j as ElementKind, k as Transition, l as parseOverlay, m as inputsOf, n as ModelParseError, o as OverlayIssue, p as validate, r as parseModel, s as OverlayParseError, t as ModelIssue, u as validateOverlay, v as defineModel, w as Fragment, x as Element, y as ActionDef, z as fragmentOperators } from "./index-CmZOswkx.js";
3
- import { A as Flowchart, C as StateMachineTransition, D as toSwimlane, E as Swimlane, F as UnrepresentedElement, I as UnrepresentedKind, M as Handoff, N as handoffs, O as FlowEdge, P as Loss, S as StateMachineState, T as Lane, _ as SequenceItem, a as Addressing, b as toSequence, c as Ends, d as TransitionChange, f as TransitionFieldChange, g as SequenceDiagram, h as confirmChanges, i as diffSwimlane, j as toFlowchart, k as FlowNode, l as EventChange, m as applyModelDiff, n as diffStateMachine, o as Change, p as UnconfirmedChangeError, r as diffFlowchart, s as ElementChange, t as diffSequence, u as ModelDiff, v as SequenceMessage, w as toStateMachine, x as StateMachine, y as SequenceOperand } from "./index-CoA6vXqe.js";
1
+ import { A as Facts, B as Status, C as CriticalPath, D as UnknownReference, E as NodeId, F as evaluateBranches, I as factNamesIn, L as factsFrom, M as artefactKey, N as elementStatusKey, O as buildDag, P as emptyFactRecord, R as layeredFacts, S as loopTransitions, T as Dag, V as statuses, _ as StatusRule, a as criticalPath, b as controlDag, c as unmetOutputs, d as StatusExplanation, f as explainStatus, g as StatusBasis, h as ProducerBasis, i as blockedBy, j as UnsupportedConditionError, k as FactRecord, l as whatIfDone, m as IncomingBasis, n as UnmetOutput, o as impact, p as ArtefactBasis, r as WhatIf, s as readySet, t as StatusChange, u as ChainLink, v as deriveStatuses, w as criticalPath$1, x as illegalCycles, y as statusRules, z as Branch } from "./index-D4CnOhNf.js";
2
+ import { A as Transition, B as fragmentOperators, C as EventDef, D as Participant, E as FragmentOperand, F as Notation, G as pseudoRoles, H as notations, I as OverlayStatus, K as IdSpace, L as ParticipantKind, M as ElementKind, N as FragmentOperator, O as Point, P as MessageMode, R as PseudoRole, S as Element, T as Fragment, U as overlayStatuses, V as messageModes, W as participantKinds, _ as Model, a as modelSchema, b as ActionDef, c as OverlayParseError, d as validateOverlay, f as Issue, g as outputsOf, h as inputsOf, i as ModelSchema, j as Views, k as Projection, l as overlaySchema, m as validate, n as ModelParseError, o as Overlay, p as IssueCode, q as OpenIds, r as parseModel, s as OverlayIssue, t as ModelIssue, u as parseOverlay, v as ModelParts, w as Extensions, x as ArtefactDef, y as defineModel, z as elementKinds } from "./index-Dvz_I_uQ.js";
3
+ import { A as Flowchart, C as StateMachineTransition, D as toSwimlane, E as Swimlane, F as UnrepresentedElement, I as UnrepresentedKind, M as Handoff, N as handoffs, O as FlowEdge, P as Loss, S as StateMachineState, T as Lane, _ as SequenceItem, a as Addressing, b as toSequence, c as Ends, d as TransitionChange, f as TransitionFieldChange, g as SequenceDiagram, h as confirmChanges, i as diffSwimlane, j as toFlowchart, k as FlowNode, l as EventChange, m as applyModelDiff, n as diffStateMachine, o as Change, p as UnconfirmedChangeError, r as diffFlowchart, s as ElementChange, t as diffSequence, u as ModelDiff, v as SequenceMessage, w as toStateMachine, x as StateMachine, y as SequenceOperand } from "./index-D06bcdfw.js";
4
4
  //#region ../../core/graph/dag/dist/errors.d.ts
5
5
  /**
6
6
  * Thrown when an operation that is only defined on an acyclic graph is given one that contains a cycle.
@@ -108,4 +108,4 @@ declare namespace index_d_exports {
108
108
  export { CriticalPath, CycleError, Dag, NodeId, TopologicalLayers, UnknownNodeError, UnknownReference, ancestorsOf, buildDag, criticalPath$1 as criticalPath, descendantsOf, findCycles, immediateDominators, stronglyConnectedComponents, topologicalLayers, transitiveReduction };
109
109
  }
110
110
  //#endregion
111
- export { type ActionDef, type Addressing, type ArtefactBasis, type ArtefactDef, type Branch, type ChainLink, type Change, type Element, type ElementChange, type ElementKind, type Ends, type EventChange, type EventDef, type Extensions, type Facts, type FlowEdge, type FlowNode, type Flowchart, type Fragment, type FragmentOperand, type FragmentOperator, type Handoff, type IdSpace, type IncomingBasis, type Issue, type IssueCode, type Lane, type Loss, type MessageMode, type Model, type ModelDiff, type ModelIssue, ModelParseError, type ModelParts, type Notation, type OpenIds, type Overlay, type OverlayIssue, OverlayParseError, type OverlayStatus, type Participant, type ParticipantKind, type Point, type ProducerBasis, type Projection, type PseudoRole, type SequenceDiagram, type SequenceItem, type SequenceMessage, type SequenceOperand, type StateMachine, type StateMachineState, type StateMachineTransition, type Status, type StatusBasis, type StatusChange, type StatusExplanation, type StatusRule, type Swimlane, type Transition, type TransitionChange, type TransitionFieldChange, UnconfirmedChangeError, type UnmetOutput, type UnrepresentedElement, type UnrepresentedKind, UnsupportedConditionError, type Views, type WhatIf, applyModelDiff, artefactKey, blockedBy, confirmChanges, controlDag, criticalPath, index_d_exports as dag, defineModel, deriveStatuses, diffFlowchart, diffSequence, diffStateMachine, diffSwimlane, elementKinds, elementStatusKey, evaluateBranches, explainStatus, fragmentOperators, handoffs, illegalCycles, impact, inputsOf, loopTransitions, messageModes, modelSchema, notations, outputsOf, overlaySchema, overlayStatuses, parseModel, parseOverlay, participantKinds, pseudoRoles, readySet, statusRules, statuses, toFlowchart, toSequence, toStateMachine, toSwimlane, unmetOutputs, validate, validateOverlay, whatIfDone };
111
+ export { type ActionDef, type Addressing, type ArtefactBasis, type ArtefactDef, type Branch, type ChainLink, type Change, type Element, type ElementChange, type ElementKind, type Ends, type EventChange, type EventDef, type Extensions, type FactRecord, type Facts, type FlowEdge, type FlowNode, type Flowchart, type Fragment, type FragmentOperand, type FragmentOperator, type Handoff, type IdSpace, type IncomingBasis, type Issue, type IssueCode, type Lane, type Loss, type MessageMode, type Model, type ModelDiff, type ModelIssue, ModelParseError, type ModelParts, type ModelSchema, type Notation, type OpenIds, type Overlay, type OverlayIssue, OverlayParseError, type OverlayStatus, type Participant, type ParticipantKind, type Point, type ProducerBasis, type Projection, type PseudoRole, type SequenceDiagram, type SequenceItem, type SequenceMessage, type SequenceOperand, type StateMachine, type StateMachineState, type StateMachineTransition, type Status, type StatusBasis, type StatusChange, type StatusExplanation, type StatusRule, type Swimlane, type Transition, type TransitionChange, type TransitionFieldChange, UnconfirmedChangeError, type UnmetOutput, type UnrepresentedElement, type UnrepresentedKind, UnsupportedConditionError, type Views, type WhatIf, applyModelDiff, artefactKey, blockedBy, confirmChanges, controlDag, criticalPath, index_d_exports as dag, defineModel, deriveStatuses, diffFlowchart, diffSequence, diffStateMachine, diffSwimlane, elementKinds, elementStatusKey, emptyFactRecord, evaluateBranches, explainStatus, factNamesIn, factsFrom, fragmentOperators, handoffs, illegalCycles, impact, inputsOf, layeredFacts, loopTransitions, messageModes, modelSchema, notations, outputsOf, overlaySchema, overlayStatuses, parseModel, parseOverlay, participantKinds, pseudoRoles, readySet, statusRules, statuses, toFlowchart, toSequence, toStateMachine, toSwimlane, unmetOutputs, validate, validateOverlay, whatIfDone };
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
- import { a as validateOverlay, c as fragmentOperators, d as overlayStatuses, f as participantKinds, i as parseOverlay, l as messageModes, n as OverlayParseError, p as pseudoRoles, r as overlaySchema, s as elementKinds, t as modelSchema, u as notations } from "./schema-CVnS6HiX.js";
2
+ import { a as validateOverlay, c as fragmentOperators, d as overlayStatuses, f as participantKinds, i as parseOverlay, l as messageModes, n as OverlayParseError, p as pseudoRoles, r as overlaySchema, s as elementKinds, t as modelSchema, u as notations } from "./schema-BPT8fmfa.js";
3
3
  import { t as validate } from "./validate-DF3mQZww.js";
4
- import { n as parseModel, t as ModelParseError } from "./parse-CuipC_2K.js";
5
- import { C as topologicalLayers, S as immediateDominators, _ as toSwimlane, a as unmetOutputs, b as handoffs, c as deriveStatuses, d as artefactKey, f as elementStatusKey, g as toStateMachine, h as stateMachineParts, i as readySet, l as statusRules, m as toSequence, n as criticalPath, o as whatIfDone, p as evaluateBranches, r as impact, s as explainStatus, t as blockedBy, u as UnsupportedConditionError, v as flowchartParts, w as actorMap, x as criticalPath$1, y as toFlowchart } from "./queries-CCexJAE2.js";
6
- import { a as findCycles, c as descendantsOf, d as lookup, f as CycleError, i as assertAcyclic, l as assembleDag, n as illegalCycles, o as stronglyConnectedComponents, p as UnknownNodeError, r as loopTransitions, s as ancestorsOf, t as controlDag, u as buildDag } from "./control-aDk9560d.js";
4
+ import { n as parseModel, t as ModelParseError } from "./parse-C1Q1zsGt.js";
5
+ import { _ as criticalPath$1, a as unmetOutputs, b as actorMap, c as deriveStatuses, d as stateMachineParts, f as toStateMachine, g as handoffs, h as toFlowchart, i as readySet, l as statusRules, m as flowchartParts, n as criticalPath, o as whatIfDone, p as toSwimlane, r as impact, s as explainStatus, t as blockedBy, u as toSequence, v as immediateDominators, y as topologicalLayers } from "./queries-C8kIDRiY.js";
6
+ import { S as UnknownNodeError, _ as descendantsOf, a as artefactKey, b as lookup, c as evaluateBranches, f as layeredFacts, g as ancestorsOf, h as stronglyConnectedComponents, i as UnsupportedConditionError, l as factNamesIn, m as findCycles, n as illegalCycles, o as elementStatusKey, p as assertAcyclic, r as loopTransitions, s as emptyFactRecord, t as controlDag, u as factsFrom, v as assembleDag, x as CycleError, y as buildDag } from "./control-DiygoEhm.js";
7
7
  import { t as statuses } from "./status-Bm1CGu9C.js";
8
8
  //#region ../../core/graph/schema/dist/artefacts.js
9
9
  /**
@@ -926,4 +926,4 @@ const diffSequence = (model, scenario, edited) => {
926
926
  };
927
927
  };
928
928
  //#endregion
929
- export { ModelParseError, OverlayParseError, UnconfirmedChangeError, UnsupportedConditionError, applyModelDiff, artefactKey, blockedBy, confirmChanges, controlDag, criticalPath, dist_exports as dag, defineModel, deriveStatuses, diffFlowchart, diffSequence, diffStateMachine, diffSwimlane, elementKinds, elementStatusKey, evaluateBranches, explainStatus, fragmentOperators, handoffs, illegalCycles, impact, inputsOf, loopTransitions, messageModes, modelSchema, notations, outputsOf, overlaySchema, overlayStatuses, parseModel, parseOverlay, participantKinds, pseudoRoles, readySet, statusRules, statuses, toFlowchart, toSequence, toStateMachine, toSwimlane, unmetOutputs, validate, validateOverlay, whatIfDone };
929
+ export { ModelParseError, OverlayParseError, UnconfirmedChangeError, UnsupportedConditionError, applyModelDiff, artefactKey, blockedBy, confirmChanges, controlDag, criticalPath, dist_exports as dag, defineModel, deriveStatuses, diffFlowchart, diffSequence, diffStateMachine, diffSwimlane, elementKinds, elementStatusKey, emptyFactRecord, evaluateBranches, explainStatus, factNamesIn, factsFrom, fragmentOperators, handoffs, illegalCycles, impact, inputsOf, layeredFacts, loopTransitions, messageModes, modelSchema, notations, outputsOf, overlaySchema, overlayStatuses, parseModel, parseOverlay, participantKinds, pseudoRoles, readySet, statusRules, statuses, toFlowchart, toSequence, toStateMachine, toSwimlane, unmetOutputs, validate, validateOverlay, whatIfDone };
package/dist/layout.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as layout, c as EngineBox, d as EngineGroup, f as EngineLeaf, i as LayoutView, l as EngineEdge, m as LayoutEngine, n as LayoutOptions, o as Size, p as EngineNode, r as LayoutResult, s as Direction, t as LaneBounds, u as EngineGraph } from "./index-CrM5qWUA.js";
1
+ import { a as layout, c as EngineBox, d as EngineGroup, f as EngineLeaf, i as LayoutView, l as EngineEdge, m as LayoutEngine, n as LayoutOptions, o as Size, p as EngineNode, r as LayoutResult, s as Direction, t as LaneBounds, u as EngineGraph } from "./index-BC4tmAuQ.js";
2
2
  //#region ../../core/graph/layout/dist/elk-engine.d.ts
3
3
  /**
4
4
  * The default engine: elkjs's layered algorithm, run in the calling context from the bundled build so it needs neither a Worker nor Node-only modules. Groups are laid out together with their children (`INCLUDE_CHILDREN`), so an edge between lanes takes part in layer assignment.
@@ -1,4 +1,4 @@
1
- import { o as toPointer, t as modelSchema } from "./schema-CVnS6HiX.js";
1
+ import { o as toPointer, t as modelSchema } from "./schema-BPT8fmfa.js";
2
2
  import { t as validate } from "./validate-DF3mQZww.js";
3
3
  //#region ../../core/graph/schema/dist/parse.js
4
4
  /** Thrown by `parseModel` when the input is not a valid model. */
@@ -1,5 +1,4 @@
1
- import { a as findCycles, d as lookup$1, f as CycleError, i as assertAcyclic, o as stronglyConnectedComponents, p as UnknownNodeError, r as loopTransitions, t as controlDag, u as buildDag } from "./control-aDk9560d.js";
2
- import { createSyncEvaluator } from "trilean";
1
+ import { S as UnknownNodeError, b as lookup$1, c as evaluateBranches, d as isProvided, h as stronglyConnectedComponents, m as findCycles, p as assertAcyclic, r as loopTransitions, t as controlDag, x as CycleError, y as buildDag } from "./control-DiygoEhm.js";
3
2
  //#region ../../core/graph/projection/dist/actors.js
4
3
  const actorMap = (model) => {
5
4
  const actors = /* @__PURE__ */ new Map();
@@ -1746,96 +1745,6 @@ const sequenceObserved = (model, scenario, observe) => {
1746
1745
  */
1747
1746
  const toSequence = (model, scenario) => sequenceObserved(model, scenario, void 0);
1748
1747
  //#endregion
1749
- //#region ../../core/graph/domain/dist/facts.js
1750
- /** The only field of a reserved key. Keys that carry it are resolved from the overlay, so a `Facts` implementation must not use it. */
1751
- const elementField = "$element";
1752
- /**
1753
- * 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.
1754
- *
1755
- * 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.
1756
- * @param id - The element whose state is read.
1757
- * @returns A key to put in a trilean `reference` node.
1758
- */
1759
- const elementStatusKey = (id) => ({ [elementField]: id });
1760
- /** The only field of the key the package puts to the port to ask whether an input artefact is provided. */
1761
- const artefactField = "$artefact";
1762
- /**
1763
- * 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.
1764
- *
1765
- * A provided artefact satisfies every consumer, whether or not an activity also produces it.
1766
- * @param id - The artefact.
1767
- * @returns The key the port is asked.
1768
- */
1769
- const artefactKey = (id) => ({ [artefactField]: id });
1770
- /**
1771
- * Whether the facts port reports an artefact as provided.
1772
- * @param facts - The injected source of facts.
1773
- * @param id - The artefact.
1774
- */
1775
- const isProvided = (facts, id) => {
1776
- const answer = facts(artefactKey(id));
1777
- return answer.found && answer.value.kind === "boolean" && answer.value.value;
1778
- };
1779
- /**
1780
- * Thrown when a condition uses a node whose evaluation needs a table or a collection from the facts port, which answers single keys only.
1781
- */
1782
- var UnsupportedConditionError = class extends Error {
1783
- /** The kind of reference the condition used. */
1784
- reference;
1785
- /**
1786
- * @param reference - The unsupported kind of reference.
1787
- */
1788
- constructor(reference) {
1789
- super(`A condition uses a ${reference} reference, which the Facts port does not answer: it resolves single keys only`);
1790
- this.name = "UnsupportedConditionError";
1791
- this.reference = reference;
1792
- }
1793
- };
1794
- const evaluator = createSyncEvaluator({});
1795
- const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
1796
- /**
1797
- * Evaluates every transition's condition.
1798
- *
1799
- * 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.
1800
- * @param model - The model whose transitions are evaluated.
1801
- * @param overlay - Run state, read by `elementStatusKey` references.
1802
- * @param facts - The injected source of facts.
1803
- * @returns The outcome of every transition, in transition order.
1804
- * @throws UnsupportedConditionError when a condition contains a `lookup`, `some`, `every` or fold node.
1805
- */
1806
- const evaluateBranches = (model, overlay, facts) => {
1807
- const elementIds = new Set(model.elements.map(({ id }) => id));
1808
- const overlayOf = new Map(Object.entries(overlay));
1809
- const resolvers = {
1810
- resolveValue: (key) => {
1811
- if (!isRecord(key) || !(elementField in key)) return facts(key);
1812
- const id = key[elementField];
1813
- if (typeof id !== "string" || !elementIds.has(id)) return { found: false };
1814
- const state = overlayOf.get(id);
1815
- if (state === "unknown") return { found: false };
1816
- return {
1817
- found: true,
1818
- value: {
1819
- kind: "text",
1820
- value: state === "done" ? "done" : "open"
1821
- }
1822
- };
1823
- },
1824
- resolveLookup: () => {
1825
- throw new UnsupportedConditionError("lookup");
1826
- },
1827
- resolveCollection: () => {
1828
- throw new UnsupportedConditionError("collection");
1829
- }
1830
- };
1831
- return new Map(model.transitions.map(({ id, condition }) => {
1832
- if (condition === void 0) return [id, "taken"];
1833
- const result = evaluator.evaluatePredicate(condition, void 0, resolvers);
1834
- if (result.status === "indeterminate") return [id, "indeterminate"];
1835
- return [id, result.value ? "taken" : "not-taken"];
1836
- }));
1837
- };
1838
- //#endregion
1839
1748
  //#region ../../core/graph/domain/dist/lookup.js
1840
1749
  /**
1841
1750
  * Reads a value out of a map built over every element of a model.
@@ -2199,4 +2108,4 @@ const unmetOutputs = (model, overlay, facts) => {
2199
2108
  return unmet;
2200
2109
  };
2201
2110
  //#endregion
2202
- export { topologicalLayers as C, immediateDominators as S, toSwimlane as _, unmetOutputs as a, handoffs as b, deriveStatuses as c, artefactKey as d, elementStatusKey as f, toStateMachine as g, stateMachineParts as h, readySet as i, statusRules as l, toSequence as m, criticalPath as n, whatIfDone as o, evaluateBranches as p, impact as r, explainStatus as s, blockedBy as t, UnsupportedConditionError as u, flowchartParts as v, actorMap as w, criticalPath$1 as x, toFlowchart as y };
2111
+ export { criticalPath$1 as _, unmetOutputs as a, actorMap as b, deriveStatuses as c, stateMachineParts as d, toStateMachine as f, handoffs as g, toFlowchart as h, readySet as i, statusRules as l, flowchartParts as m, criticalPath as n, whatIfDone as o, toSwimlane as p, impact as r, explainStatus as s, blockedBy as t, toSequence as u, immediateDominators as v, topologicalLayers as y };
@@ -1,8 +1,8 @@
1
- import { F as Status } from "./index-CCfe0csl.js";
2
- import { G as IdSpace, O as Projection, g as Model, x as Element } from "./index-CmZOswkx.js";
3
- import { A as Flowchart, E as Swimlane, x as StateMachine } from "./index-CoA6vXqe.js";
4
- import { i as LayoutView, n as LayoutOptions, r as LayoutResult, s as Direction } from "./index-CrM5qWUA.js";
5
- import { A as ElementFilter, rt as Run, y as NamedElement } from "./index-DricKcyl.js";
1
+ import { B as Status } from "./index-D4CnOhNf.js";
2
+ import { K as IdSpace, S as Element, _ as Model, k as Projection } from "./index-Dvz_I_uQ.js";
3
+ import { A as Flowchart, E as Swimlane, x as StateMachine } from "./index-D06bcdfw.js";
4
+ import { i as LayoutView, n as LayoutOptions, r as LayoutResult, s as Direction } from "./index-BC4tmAuQ.js";
5
+ import { A as ElementFilter, rt as Run, y as NamedElement } from "./index-9Au8pAmP.js";
6
6
  import { ReactElement } from "react";
7
7
  import { ColorMode, Edge, EdgeProps, Node, NodeProps } from "@xyflow/react";
8
8
  //#region ../../ui/graph/react-flow/dist/use-layout.d.ts
@@ -1,8 +1,8 @@
1
- import { _ as toSwimlane, g as toStateMachine, m as toSequence, y as toFlowchart } from "./queries-CCexJAE2.js";
1
+ import { f as toStateMachine, h as toFlowchart, p as toSwimlane, u as toSequence } from "./queries-C8kIDRiY.js";
2
2
  import { t as layout } from "./layout-CCM-KBdp.js";
3
- import { d as useBlockers, f as useCriticalPath, h as useStatuses, i as filterElements, r as emptyFilter, t as useGraphSelection } from "./selection-BW_xXWOy.js";
3
+ import { d as useBlockers, f as useCriticalPath, h as useStatuses, i as filterElements, r as emptyFilter, t as useGraphSelection } from "./selection-iet5RAlP.js";
4
4
  import { c as elementLabel } from "./detail-panel-B1ZmMuJT.js";
5
- import { a as Lane, n as ElementCard, s as SequenceDiagram } from "./dist-BpCBmnMl.js";
5
+ import { a as Lane, n as ElementCard, s as SequenceDiagram } from "./dist-arkejVz2.js";
6
6
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
8
  import { BaseEdge, Handle, MarkerType, Position, ReactFlow, getSmoothStepPath } from "@xyflow/react";
package/dist/react.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as useWhyStatus, A as ElementFilter, B as useElementFilter, C as ruleDescriptions, D as SelectionContainerProps, E as GraphSelectionOptions, F as emptyFilter, G as BlockedChain, H as ViewsByNotation, I as filterElements, J as useBlockers, K as stepWeight, L as filterOptions, M as FilterOption, N as FilterOptions, O as SelectionItemProps, P as actorsOf, Q as useStatuses, R as matchesFilter, S as elementLabel, T as GraphSelection, U as project, V as ProjectedView, W as useProjection, X as useImpact, Y as useCriticalPath, Z as useReadySet, _ as ElementCardPart, a as FilterPanelPart, b as StatusBadge, c as LegendPart, d as LanePart, et as ModelClient, f as LaneProps, g as ElementCard, h as TransitionItemProps, i as FilterPanel, it as noFacts, j as ElementFilterState, k as useGraphSelection, l as LegendProps, m as TransitionItemPart, n as DetailPanelPart, nt as useModel, o as FilterPanelProps, p as TransitionItem, q as useBlockedChain, r as DetailPanelProps, rt as Run, s as Legend, t as DetailPanel, tt as ModelState, u as Lane, v as ElementCardProps, w as statusLabels, x as StatusBadgeProps, y as NamedElement, z as sourceScope } from "./index-DricKcyl.js";
1
+ import { $ as useWhyStatus, A as ElementFilter, B as useElementFilter, C as ruleDescriptions, D as SelectionContainerProps, E as GraphSelectionOptions, F as emptyFilter, G as BlockedChain, H as ViewsByNotation, I as filterElements, J as useBlockers, K as stepWeight, L as filterOptions, M as FilterOption, N as FilterOptions, O as SelectionItemProps, P as actorsOf, Q as useStatuses, R as matchesFilter, S as elementLabel, T as GraphSelection, U as project, V as ProjectedView, W as useProjection, X as useImpact, Y as useCriticalPath, Z as useReadySet, _ as ElementCardPart, a as FilterPanelPart, b as StatusBadge, c as LegendPart, d as LanePart, et as ModelClient, f as LaneProps, g as ElementCard, h as TransitionItemProps, i as FilterPanel, it as noFacts, j as ElementFilterState, k as useGraphSelection, l as LegendProps, m as TransitionItemPart, n as DetailPanelPart, nt as useModel, o as FilterPanelProps, p as TransitionItem, q as useBlockedChain, r as DetailPanelProps, rt as Run, s as Legend, t as DetailPanel, tt as ModelState, u as Lane, v as ElementCardProps, w as statusLabels, x as StatusBadgeProps, y as NamedElement, z as sourceScope } from "./index-9Au8pAmP.js";
2
2
  export { type BlockedChain, DetailPanel, type DetailPanelPart, type DetailPanelProps, ElementCard, type ElementCardPart, type ElementCardProps, type ElementFilter, type ElementFilterState, type FilterOption, type FilterOptions, FilterPanel, type FilterPanelPart, type FilterPanelProps, type GraphSelection, type GraphSelectionOptions, Lane, type LanePart, type LaneProps, Legend, type LegendPart, type LegendProps, type ModelClient, type ModelState, type NamedElement, type ProjectedView, type Run, type SelectionContainerProps, type SelectionItemProps, StatusBadge, type StatusBadgeProps, TransitionItem, type TransitionItemPart, type TransitionItemProps, type ViewsByNotation, actorsOf, elementLabel, emptyFilter, filterElements, filterOptions, matchesFilter, noFacts, project, ruleDescriptions, sourceScope, statusLabels, stepWeight, useBlockedChain, useBlockers, useCriticalPath, useElementFilter, useGraphSelection, useImpact, useModel, useProjection, useReadySet, useStatuses, useWhyStatus };
package/dist/react.js CHANGED
@@ -1,5 +1,5 @@
1
- import { _ as toSwimlane, g as toStateMachine, m as toSequence, y as toFlowchart } from "./queries-CCexJAE2.js";
2
- import { a as filterOptions, c as useElementFilter, d as useBlockers, f as useCriticalPath, g as useWhyStatus, h as useStatuses, i as filterElements, l as stepWeight, m as useReadySet, n as actorsOf, o as matchesFilter, p as useImpact, r as emptyFilter, s as sourceScope, t as useGraphSelection, u as useBlockedChain } from "./selection-BW_xXWOy.js";
1
+ import { f as toStateMachine, h as toFlowchart, p as toSwimlane, u as toSequence } from "./queries-C8kIDRiY.js";
2
+ import { a as filterOptions, c as useElementFilter, d as useBlockers, f as useCriticalPath, g as useWhyStatus, h as useStatuses, i as filterElements, l as stepWeight, m as useReadySet, n as actorsOf, o as matchesFilter, p as useImpact, r as emptyFilter, s as sourceScope, t as useGraphSelection, u as useBlockedChain } from "./selection-iet5RAlP.js";
3
3
  import { a as TransitionItem, c as elementLabel, i as Lane, l as ruleDescriptions, n as FilterPanel, o as ElementCard, r as Legend, s as StatusBadge, t as DetailPanel, u as statusLabels } from "./detail-panel-B1ZmMuJT.js";
4
4
  import { ORPCError } from "@orpc/client";
5
5
  import { useEffect, useMemo, useState } from "react";
@@ -1,5 +1,5 @@
1
- import { r as overlaySchema, t as modelSchema } from "./schema-CVnS6HiX.js";
2
- import { C as modelSummarySchema, D as revisionSchema, E as relationSchema, O as storeChangeSchema, S as modelIdSchema, _ as GraphStoreError, k as storedModelSchema, w as reachSchema, x as issueSchema, y as boundItemsSchema } from "./store-BcR70CaO.js";
1
+ import { r as overlaySchema, t as modelSchema } from "./schema-BPT8fmfa.js";
2
+ import { A as modelIdSchema, C as boundItemsSchema, E as factClearingSchema, F as revisionSchema, I as storeChangeSchema, L as storedFactsSchema, M as reachSchema, P as relationSchema, R as storedModelSchema, T as factChangeSchema, j as modelSummarySchema, k as issueSchema, x as GraphStoreError } from "./store-DKzvLGgl.js";
3
3
  import { z } from "zod";
4
4
  import { eventIterator, oc } from "@orpc/contract";
5
5
  import { implement } from "@orpc/server";
@@ -44,6 +44,17 @@ const graphStoreContract = { v1: oc.errors(graphStoreErrors).router({
44
44
  modelId: modelIdSchema,
45
45
  overlay: overlaySchema
46
46
  }).readonly()).output(written) },
47
+ facts: {
48
+ read: oc.input(modelRef).output(storedFactsSchema),
49
+ set: oc.input(z.strictObject({
50
+ modelId: modelIdSchema,
51
+ facts: factChangeSchema
52
+ }).readonly()).output(written),
53
+ clear: oc.input(z.strictObject({
54
+ modelId: modelIdSchema,
55
+ facts: factClearingSchema
56
+ }).readonly()).output(written)
57
+ },
47
58
  items: { upsert: oc.input(z.strictObject({
48
59
  modelId: modelIdSchema,
49
60
  items: boundItemsSchema
@@ -125,6 +136,20 @@ const createGraphStoreRouter = (store) => os.router({ v1: {
125
136
  ...input,
126
137
  signal
127
138
  }) }))) },
139
+ facts: {
140
+ read: os.v1.facts.read.handler(async ({ input, signal, errors }) => call(signal, errors, async () => store.readFacts({
141
+ ...input,
142
+ signal
143
+ }))),
144
+ set: os.v1.facts.set.handler(async ({ input, signal, errors }) => call(signal, errors, async () => ({ revision: await store.setFacts({
145
+ ...input,
146
+ signal
147
+ }) }))),
148
+ clear: os.v1.facts.clear.handler(async ({ input, signal, errors }) => call(signal, errors, async () => ({ revision: await store.clearFacts({
149
+ ...input,
150
+ signal
151
+ }) })))
152
+ },
128
153
  items: { upsert: os.v1.items.upsert.handler(async ({ input, signal, errors }) => call(signal, errors, async () => ({ revision: await store.upsertItems({
129
154
  ...input,
130
155
  signal
@@ -219,7 +219,7 @@ const viewsSchema = z.partialRecord(z.enum(notations), z.partialRecord(z.string(
219
219
  *
220
220
  * Every object is strict. The inferred type is exactly `Model<OpenIds>`, which a type-level test pins in both directions.
221
221
  */
222
- const modelSchema = record({
222
+ const modelSchema = z.strictObject({
223
223
  participants: z.array(participantSchema).readonly(),
224
224
  events: z.array(eventSchema).readonly(),
225
225
  actions: z.array(actionSchema).readonly(),
@@ -229,6 +229,6 @@ const modelSchema = record({
229
229
  fragments: z.array(fragmentSchema).readonly(),
230
230
  projections: z.array(projectionSchema).readonly(),
231
231
  views: viewsSchema.exactOptional()
232
- });
232
+ }).readonly();
233
233
  //#endregion
234
234
  export { validateOverlay as a, fragmentOperators as c, overlayStatuses as d, participantKinds as f, parseOverlay as i, messageModes as l, OverlayParseError as n, toPointer as o, pseudoRoles as p, overlaySchema as r, elementKinds as s, modelSchema as t, notations as u };
@@ -1,4 +1,4 @@
1
- import { c as deriveStatuses, i as readySet, n as criticalPath, r as impact, s as explainStatus, t as blockedBy } from "./queries-CCexJAE2.js";
1
+ import { c as deriveStatuses, i as readySet, n as criticalPath, r as impact, s as explainStatus, t as blockedBy } from "./queries-C8kIDRiY.js";
2
2
  import { useCallback, useMemo, useRef, useState } from "react";
3
3
  //#region ../../ui/graph/react/dist/analysis.js
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { t as GitHubTokenPort } from "../../graphql-C1j5wQFz.js";
1
+ import { t as GitHubTokenPort } from "../../graphql-BE7xm5dB.js";
2
2
  //#region ../../adapters/graph/source-github-issues/dist/node.d.ts
3
3
  /** Where `githubTokenFromEnvironment` looks. Both are ports, so a test supplies its own. */
4
4
  export interface EnvironmentTokenOptions {
@@ -1,5 +1,5 @@
1
- import { $ as scopeRootsInputSchema, A as ScopeEntry, B as badRequestReasons, C as Gap, D as Relation, E as OrderField, F as SourceParticipant, G as orderDirections, H as filterStates, I as SourceTransition, J as relationKinds, K as orderFields, L as SyncFilter, M as ScopeListingInput, N as ScopeRootsInput, O as RelationKind, P as SourceDescription, Q as scopeListingSchema, R as SyncInput, S as FilterState, T as OrderDirection, U as gapReasons, V as boundActivitySchema, W as gapSchema, X as scopeChildrenInputSchema, Y as relationSchema, Z as scopeEntrySchema, _ as GraphSourceFailure, a as FakePage, b as BadRequestReason, c as assembleSync, d as GraphSourceRouter, et as sourceDescriptionSchema, f as GraphSourceScopes, g as GraphSourceError, h as createGraphSourceRouter, i as FakeGraphSourceOptions, it as transitionSchema, j as ScopeListing, k as ScopeChildrenInput, l as ChildrenRequest, m as PageRequest, n as GraphqlFetch, nt as syncInputSchema, o as createFakeGraphSource, p as ListingRequest, q as participantSchema, r as githubGraphqlEndpoint, rt as syncPageSchema, s as AssembledSync, t as GitHubTokenPort, tt as syncFilterSchema, u as GraphSourcePager, v as GraphSourceClient, w as GapReason, x as BoundActivity, y as graphSourceContract, z as SyncPage } from "../graphql-C1j5wQFz.js";
2
- import { a as GitHubIssuesSourceOptions, i as storedTokenPort, n as StoredTokenPortOptions, o as createGitHubIssuesSource, r as selectStoredToken, t as StoredGitHubToken } from "../index-CptUHq6F.js";
1
+ import { $ as scopeRootsInputSchema, A as ScopeEntry, B as badRequestReasons, C as Gap, D as Relation, E as OrderField, F as SourceParticipant, G as orderDirections, H as filterStates, I as SourceTransition, J as relationKinds, K as orderFields, L as SyncFilter, M as ScopeListingInput, N as ScopeRootsInput, O as RelationKind, P as SourceDescription, Q as scopeListingSchema, R as SyncInput, S as FilterState, T as OrderDirection, U as gapReasons, V as boundActivitySchema, W as gapSchema, X as scopeChildrenInputSchema, Y as relationSchema, Z as scopeEntrySchema, _ as GraphSourceFailure, a as FakePage, b as BadRequestReason, c as assembleSync, d as GraphSourceRouter, et as sourceDescriptionSchema, f as GraphSourceScopes, g as GraphSourceError, h as createGraphSourceRouter, i as FakeGraphSourceOptions, it as transitionSchema, j as ScopeListing, k as ScopeChildrenInput, l as ChildrenRequest, m as PageRequest, n as GraphqlFetch, nt as syncInputSchema, o as createFakeGraphSource, p as ListingRequest, q as participantSchema, r as githubGraphqlEndpoint, rt as syncPageSchema, s as AssembledSync, t as GitHubTokenPort, tt as syncFilterSchema, u as GraphSourcePager, v as GraphSourceClient, w as GapReason, x as BoundActivity, y as graphSourceContract, z as SyncPage } from "../graphql-BE7xm5dB.js";
2
+ import { a as GitHubIssuesSourceOptions, i as storedTokenPort, n as StoredTokenPortOptions, o as createGitHubIssuesSource, r as selectStoredToken, t as StoredGitHubToken } from "../index-hri2a13-.js";
3
3
  //#region ../../core/graph/source-contract/dist/paginate.d.ts
4
4
  /**
5
5
  * Pages through a cursor-linked sequence on demand: each `next()` reads one page, starting after `first`, and the sequence ends after the page whose `next` is absent. Nothing is read ahead of the consumer, so a consumer that stops early stops the reads.
@@ -1,4 +1,4 @@
1
- import { A as syncPageSchema, C as scopeChildrenInputSchema, D as sourceDescriptionSchema, E as scopeRootsInputSchema, O as syncFilterSchema, S as relationSchema, T as scopeListingSchema, _ as gapSchema, a as ownerScopeId, b as participantSchema, c as githubGraphqlEndpoint, d as paginate, f as graphSourceContract, g as gapReasons, h as filterStates, i as issueId, j as transitionSchema, k as syncInputSchema, l as assembleSync, m as boundActivitySchema, n as accountId, o as parseScope, p as badRequestReasons, r as githubSource, s as repositoryId, t as createGitHubIssuesSource, u as createGraphSourceRouter, v as orderDirections, w as scopeEntrySchema, x as relationKinds, y as orderFields } from "../source-DRDpEA8Q.js";
1
+ import { A as syncPageSchema, C as scopeChildrenInputSchema, D as sourceDescriptionSchema, E as scopeRootsInputSchema, O as syncFilterSchema, S as relationSchema, T as scopeListingSchema, _ as gapSchema, a as ownerScopeId, b as participantSchema, c as githubGraphqlEndpoint, d as paginate, f as graphSourceContract, g as gapReasons, h as filterStates, i as issueId, j as transitionSchema, k as syncInputSchema, l as assembleSync, m as boundActivitySchema, n as accountId, o as parseScope, p as badRequestReasons, r as githubSource, s as repositoryId, t as createGitHubIssuesSource, u as createGraphSourceRouter, v as orderDirections, w as scopeEntrySchema, x as relationKinds, y as orderFields } from "../source-D51N7K3A.js";
2
2
  import { t as GraphSourceError } from "../errors-BZe5WzCn.js";
3
3
  //#region ../../core/graph/source-contract/dist/fake.js
4
4
  const gapIndex = -1;
@@ -1,4 +1,4 @@
1
- import { r as overlaySchema, t as modelSchema } from "./schema-CVnS6HiX.js";
1
+ import { r as overlaySchema, t as modelSchema } from "./schema-BPT8fmfa.js";
2
2
  import { t as GraphSourceError } from "./errors-BZe5WzCn.js";
3
3
  import { z } from "zod";
4
4
  import { eventIterator, oc } from "@orpc/contract";
@@ -545,16 +545,36 @@ const readJson = async (response) => {
545
545
  }
546
546
  };
547
547
  /**
548
+ * Asks the token port for the token a request needs. A port that cannot supply one has failed to provide credentials, which ends the sync exactly as GitHub rejecting them would, so whatever it throws is reported as `unauthorised`: a `GraphSourceError` the port threw as it is, and anything else wrapped in one whose message names the token port and the owner and whose cause is the port's own error. An abort is passed through, since it is the caller's, not the port's.
549
+ * @param transport - The token port.
550
+ * @param owner - The login the request is about, or `undefined` for the token's own holder.
551
+ * @param signal - The caller's abort signal.
552
+ * @returns The token.
553
+ * @throws GraphSourceError with `unauthorised` when the port fails.
554
+ */
555
+ const tokenFor = async (transport, owner, signal) => {
556
+ try {
557
+ return await transport.token(owner, signal);
558
+ } catch (error) {
559
+ if (error instanceof GraphSourceError || signal?.aborted === true) throw error;
560
+ const reason = error instanceof Error ? error.message : String(error);
561
+ throw new GraphSourceError({
562
+ kind: "unauthorised",
563
+ message: `the GitHub token port gave no token${owner === void 0 ? "" : ` for ${owner}`}: ${reason}`
564
+ }, { cause: error });
565
+ }
566
+ };
567
+ /**
548
568
  * Sends one GraphQL request and classifies the answer.
549
569
  * @param transport - The token, fetch and clock ports.
550
570
  * @param request - The document, its variables, the owner whose token to use and the schema for `data`.
551
571
  * @param signal - The caller's abort signal, passed to `fetch`.
552
572
  * @returns The parsed data and any `NOT_FOUND` or `FORBIDDEN` problems beside it.
553
- * @throws GraphSourceError with `unauthorised` for HTTP 401, and `rate-limited` (with the reset instant when GitHub gives one) for any form of rate limiting.
573
+ * @throws GraphSourceError with `unauthorised` for HTTP 401 or a token port that fails, and `rate-limited` (with the reset instant when GitHub gives one) for any form of rate limiting.
554
574
  * @throws Error for any other failure: an HTTP error, another GraphQL error type, or data that does not match the schema.
555
575
  */
556
576
  const graphql = async (transport, request, signal) => {
557
- const token = await transport.token(request.owner, signal);
577
+ const token = await tokenFor(transport, request.owner, signal);
558
578
  const response = await transport.fetch(githubGraphqlEndpoint, {
559
579
  method: "POST",
560
580
  headers: {
@@ -1,4 +1,4 @@
1
- import { b as GraphStore } from "../index-DhbvDgK4.js";
1
+ import { w as GraphStore } from "../index-CR8xUK3S.js";
2
2
  import { DatabaseSyncOptions } from "node:sqlite";
3
3
  import { NodeSQLiteDatabase } from "drizzle-orm/node-sqlite";
4
4
  //#region ../../adapters/graph/sqlite-node/dist/open.d.ts
@@ -21,4 +21,29 @@ interface NodeGraphStore {
21
21
  */
22
22
  export declare const openNodeGraphStore: (path: string, options?: DatabaseSyncOptions) => NodeGraphStore;
23
23
  //#endregion
24
- export type { NodeGraphStore };
24
+ //#region ../../adapters/graph/sqlite-node/dist/data-file.d.ts
25
+ /** The data directory's mode: only its owner may list or enter it, since the store holds synced work (titles, relationships) that other users on the host must not read. */
26
+ export declare const privateDirectoryMode = 448;
27
+ /** The data file's mode: only its owner may read or write it. SQLite creates the `-wal` and `-shm` files beside it with the same mode on Unix. */
28
+ export declare const privateFileMode = 384;
29
+ /** Where a store's data file lives, and how much of its path the caller owns. */
30
+ interface DataFileOptions {
31
+ /**
32
+ * Whether the directory is the caller's own, such as an application's default data directory or one a host keeps under its own home, which is created private and kept private. A directory someone else chose, such as a path a user names on a command line, is created when missing but never has its mode changed.
33
+ */
34
+ readonly ownsDirectory: boolean;
35
+ /** The platform; on Windows, file modes mean nothing and nothing is set. */
36
+ readonly platform: NodeJS.Platform;
37
+ }
38
+ /**
39
+ * Makes a data file ready for `openNodeGraphStore` to open, so a store holding synced work is never readable by other users on the host. Call it before opening the store; it does not open the database itself.
40
+ *
41
+ * The directory is created when missing (with any missing parents), with `privateDirectoryMode` when it is the caller's own. The database file is created with `privateFileMode` when missing, before SQLite opens it, so the file and the `-wal` and `-shm` files SQLite derives from it are never readable by others, whatever the umask. A file that already exists is left alone unless the directory is the caller's own; there, an existing directory or store file (database, `-wal` or `-shm`) that group or others can read is narrowed to the private mode. On Windows, where file modes mean nothing, only the directory is created.
42
+ * @param path - The database file; not `":memory:"`, which has no file.
43
+ * @param options - Whether the caller owns the directory, and the platform.
44
+ * @returns One warning line naming what was narrowed, for the caller to show, or nothing when nothing was.
45
+ * @throws Error from the file system when the directory or file cannot be created or its mode read or changed.
46
+ */
47
+ export declare const prepareDataFile: (path: string, options: DataFileOptions) => readonly string[];
48
+ //#endregion
49
+ export type { DataFileOptions, NodeGraphStore };
@@ -1,2 +1,2 @@
1
- import { t as openNodeGraphStore } from "../open-CyRXJ4bt.js";
2
- export { openNodeGraphStore };
1
+ import { i as openNodeGraphStore, n as privateDirectoryMode, r as privateFileMode, t as prepareDataFile } from "../data-file-BVMxkTug.js";
2
+ export { openNodeGraphStore, prepareDataFile, privateDirectoryMode, privateFileMode };
@@ -1,5 +1,5 @@
1
- import { O as storeChangeSchema, h as ChangeFeed, t as createSqliteGraphStore } from "../../store-BcR70CaO.js";
2
- import { t as createGraphStoreRouter } from "../../router-D4gtTlXm.js";
1
+ import { I as storeChangeSchema, t as createSqliteGraphStore, y as ChangeFeed } from "../../store-DKzvLGgl.js";
2
+ import { t as createGraphStoreRouter } from "../../router-Dk91O_9p.js";
3
3
  import sqlite3InitModule from "@sqlite.org/sqlite-wasm";
4
4
  import { RPCHandler } from "@orpc/server/message-port";
5
5
  import { drizzle } from "drizzle-orm/sqlite-proxy";
@@ -1,4 +1,4 @@
1
- import { Q as GraphStoreClient } from "../index-DhbvDgK4.js";
1
+ import { ut as GraphStoreClient } from "../index-CR8xUK3S.js";
2
2
  //#region ../../adapters/graph/sqlite-wasm/dist/client.d.ts
3
3
  /**
4
4
  * A client for the graph store a worker serves with `serveGraphStoreInWorker`. Every procedure of the contract is available, with its abort signal and typed errors, as if the store were in the page.