@arqlet/contracts 0.3.0 → 0.4.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 (2) hide show
  1. package/dist/index.d.ts +171 -21
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -113,7 +113,13 @@ sizePins?: { [key in string]: SizePin },
113
113
  */
114
114
  labels?: { [key in string]: Point }, };
115
115
 
116
- export type Edge = { id: string, kind: string, source: string, target: string | null, };
116
+ export type Edge = { id: string, kind: string, source: string, target: string | null,
117
+ /**
118
+ * Provisional: how many edges this edge stands for (a pre-aggregated relation), at least 1; 1 when left out. It
119
+ * counts where edges are counted: a bundled or aggregated route weighs the sum of its edges, and the overview and
120
+ * the communities pull by it. Omitted from output when left out.
121
+ */
122
+ weight?: number, };
117
123
 
118
124
  export type EdgePorts = { edgeId: string, sourcePort: string | null, targetPort: string | null, };
119
125
 
@@ -176,31 +182,25 @@ origin?: Point | null, };
176
182
  * A graph: the canonical data of a view. Direction and layout strategy are two constraints, each set for the root and for
177
183
  * containers and inherited by containers that declare nothing (docs/adr/0003-container-direction-constraints.md).
178
184
  */
179
- export type Graph = { defaultDirection: "lr" | "rl" | "tb" | "bt" | "auto" | Array<"lr" | "rl" | "tb" | "bt">, containerDirections: { [key in string]: "lr" | "rl" | "tb" | "bt" | "auto" | Array<"lr" | "rl" | "tb" | "bt"> }, defaultStrategy?: "none" | "tree" | "radial" | "auto" | Array<"none" | "tree" | "radial">, containerStrategies?: { [key in string]: "none" | "tree" | "radial" | "auto" | Array<"none" | "tree" | "radial"> },
185
+ export type Graph = { defaultDirection?: "lr" | "rl" | "tb" | "bt" | "auto" | Array<"lr" | "rl" | "tb" | "bt">, containerDirections?: { [key in string]: "lr" | "rl" | "tb" | "bt" | "auto" | Array<"lr" | "rl" | "tb" | "bt"> }, defaultStrategy?: "none" | "tree" | "radial" | "auto" | Array<"none" | "tree" | "radial">, containerStrategies?: { [key in string]: "none" | "tree" | "radial" | "auto" | Array<"none" | "tree" | "radial"> },
180
186
  /**
181
187
  * The edge routing of the root and its containers (docs/adr/0005-routing-constraints.md).
182
188
  */
183
- defaultRouting?: "straight" | "orthogonal" | "roundedOrthogonal" | "polyline" | "roundedPolyline" | "octilinear" | "curve" | "bus" | "auto" | Array<"straight" | "orthogonal" | "roundedOrthogonal" | "polyline" | "roundedPolyline" | "octilinear" | "curve" | "bus">, containerRouting?: { [key in string]: "straight" | "orthogonal" | "roundedOrthogonal" | "polyline" | "roundedPolyline" | "octilinear" | "curve" | "bus" | "auto" | Array<"straight" | "orthogonal" | "roundedOrthogonal" | "polyline" | "roundedPolyline" | "octilinear" | "curve" | "bus"> }, ports: Array<Port>, edgePorts: Array<EdgePorts>, nodes: Array<Node>, edges: Array<Edge>,
189
+ defaultRouting?: "straight" | "orthogonal" | "roundedOrthogonal" | "polyline" | "roundedPolyline" | "octilinear" | "curve" | "bus" | "auto" | Array<"straight" | "orthogonal" | "roundedOrthogonal" | "polyline" | "roundedPolyline" | "octilinear" | "curve" | "bus">, containerRouting?: { [key in string]: "straight" | "orthogonal" | "roundedOrthogonal" | "polyline" | "roundedPolyline" | "octilinear" | "curve" | "bus" | "auto" | Array<"straight" | "orthogonal" | "roundedOrthogonal" | "polyline" | "roundedPolyline" | "octilinear" | "curve" | "bus"> }, ports?: Array<Port>, edgePorts?: Array<EdgePorts>, nodes: Array<Node>, edges: Array<Edge>,
184
190
  /**
185
191
  * Provisional: explicit buses (ADR 0005): each groups edges drawn on one shared trunk with branches. Membership is never
186
192
  * inferred. Omitted when empty, so earlier documents and drawings do not change.
187
193
  */
188
194
  buses?: Array<Bus>, };
189
195
 
190
- export type HybridCriterion = "compact" | "endToEnd";
191
-
192
- /**
193
- * Which containers an import shows collapsed (`LayoutOptions::initial_collapse`).
194
- */
195
- export type InitialCollapse = {
196
196
  /**
197
- * Containers at this depth or deeper (the top level is 0).
198
- */
199
- depth?: number | null,
200
- /**
201
- * Containers of these kinds.
197
+ * What a view hides (provisional, view state set by the `filter` operation): nodes of these kinds, these nodes (each with
198
+ * everything below it) and edges of these kinds. The layout keeps their room, so what stays keeps its place; the scene
199
+ * leaves them out, and an edge that stands for collapsed content counts only the edges still shown.
202
200
  */
203
- kinds?: Array<string>, };
201
+ export type Hidden = { nodeKinds?: Array<string>, nodes?: Array<string>, edgeKinds?: Array<string>, };
202
+
203
+ export type HybridCriterion = "compact" | "endToEnd";
204
204
 
205
205
  export type Integrity = {
206
206
  /**
@@ -431,17 +431,21 @@ visibleNodeBudget?: number,
431
431
  communities?: number,
432
432
  /**
433
433
  * Provisional: groups given by the data or its domain, by node id: the path of groups the node belongs to inside its
434
- * container (`["ECU A", "X1"]`). They become containers of kind `group` in the view only, nested along the path,
434
+ * container (`["Billing", "Invoices"]`). They become containers of kind `group` in the view only, nested along the path,
435
435
  * before `communities` divides what is still large. Ids the graph does not have are ignored (a mapping may cover more
436
436
  * than the imported view). Omitted when empty.
437
437
  */
438
438
  groups?: { [key in string]: Array<string> },
439
439
  /**
440
- * Provisional: which containers an import shows collapsed: those at `depth` or deeper (0: every one; the top level is
441
- * depth 0) and those of the `kinds` listed. Unset (the default, omitted): none, except the containers that
442
- * `communities` and `groups` add, which start collapsed.
440
+ * Provisional: the level of detail, which containers an import shows collapsed: those at `depth` or deeper (0: every
441
+ * one; the top level is depth 0) and those of the `kinds` listed. Unset (the default, omitted): none, except the
442
+ * containers that `communities` and `groups` add, which start collapsed.
443
+ */
444
+ levelOfDetail?: LevelOfDetail | null,
445
+ /**
446
+ * Provisional (view state, set by `filter`): what the view hides, keeping the place of the rest. Omitted when empty.
443
447
  */
444
- initialCollapse?: InitialCollapse | null,
448
+ hidden?: Hidden,
445
449
  /**
446
450
  * Provisional (view state, set by `reveal`): containers shown in part. The children listed for a container are shown;
447
451
  * the others are gathered in a collapsed container `rest:<id>` of kind `rest` ("+N more"), which a `toggle` dissolves.
@@ -575,6 +579,21 @@ orderHints?: { [key in string]: OrderHint }, };
575
579
  */
576
580
  export type LayoutStrategy = "none" | "shortest" | "tree" | "radial" | "organic";
577
581
 
582
+ /**
583
+ * The level of detail (provisional): which containers a view shows collapsed at first, by depth and by kind; opening
584
+ * them is up to the user (`toggle`, `reveal`, or a click in the cluster overview). The same value for the layered view
585
+ * (`LayoutOptions::level_of_detail`) and the cluster overview (`OverviewConfig::level_of_detail`).
586
+ */
587
+ export type LevelOfDetail = {
588
+ /**
589
+ * Containers at this depth or deeper (the top level is 0).
590
+ */
591
+ depth?: number | null,
592
+ /**
593
+ * Containers of these kinds.
594
+ */
595
+ kinds?: Array<string>, };
596
+
578
597
  /**
579
598
  * A geometry observation for one element: the realized outline and the revision of the measurement. The revision rises with
580
599
  * every new measurement of that element, so that an old one is recognised when it arrives late.
@@ -690,6 +709,49 @@ after: string | null, };
690
709
  */
691
710
  export type Orientation = "lr" | "rl" | "tb" | "bt";
692
711
 
712
+ /**
713
+ * Provisional (ADR 0018): the answer of the `overview` operation, `{ok, overview}`. Arrays are indexed by node: the
714
+ * graph's nodes in input order, then the clusters the overview added (communities, satellite groups).
715
+ */
716
+ export type Overview = {
717
+ /**
718
+ * 1.
719
+ */
720
+ schemaVersion: number,
721
+ /**
722
+ * The values of the order user, rules, zoom, as the engine checked them.
723
+ */
724
+ representation: OverviewRepresentation, ids: Array<string>,
725
+ /**
726
+ * Each node's label from the data; an added cluster is named after its most connected member (`≈ <name>` for a
727
+ * community, `<name> +<n>` for a hub with its satellites).
728
+ */
729
+ labels: Array<string>,
730
+ /**
731
+ * The parent's index, or -1 at the top level.
732
+ */
733
+ parent: number[], x: Array<number>, y: Array<number>,
734
+ /**
735
+ * Disc radii: leaves share the leaf radius, a container holds its children.
736
+ */
737
+ r: Array<number>,
738
+ /**
739
+ * The radius of the disc around everything, centred on the origin.
740
+ */
741
+ rootRadius: number,
742
+ /**
743
+ * Node kinds in order of first use (`community` for added clusters), and each node's kind as an index into them.
744
+ */
745
+ kinds: Array<string>, kind: number[],
746
+ /**
747
+ * Resolved edges as index pairs, source first, in input order (flat).
748
+ */
749
+ edges: number[],
750
+ /**
751
+ * Per container, the links between its children: child, child, number of edges (flat triples).
752
+ */
753
+ links: Array<number>, stats: OverviewStats, };
754
+
693
755
  /**
694
756
  * Provisional (ADR 0018, addendum): the rules of the data for the cluster overview, the second step of the order
695
757
  * user, rules, zoom.
@@ -702,7 +764,12 @@ rules?: { [key in string]: Representation },
702
764
  /**
703
765
  * Whether the zoom decides what neither the user nor a rule decided. Absent: yes.
704
766
  */
705
- auto?: boolean, };
767
+ auto?: boolean,
768
+ /**
769
+ * What is collapsed at first, after the user's decisions and the rules, before the zoom (the same value as
770
+ * `LayoutOptions::level_of_detail`).
771
+ */
772
+ levelOfDetail?: LevelOfDetail, };
706
773
 
707
774
  /**
708
775
  * Provisional (ADR 0018, addendum; ADR 0015): the user's decisions in the cluster overview as one value, by node id.
@@ -710,6 +777,89 @@ auto?: boolean, };
710
777
  */
711
778
  export type OverviewIntent = { decisions?: { [key in string]: Representation }, };
712
779
 
780
+ /**
781
+ * Provisional: the layout options of an overview (defaults in brackets).
782
+ */
783
+ export type OverviewLayoutOptions = {
784
+ /**
785
+ * The radius of a leaf (4).
786
+ */
787
+ nodeRadius?: number,
788
+ /**
789
+ * The gap between discs (2).
790
+ */
791
+ gap?: number,
792
+ /**
793
+ * The padding inside a container (6).
794
+ */
795
+ padding?: number, charge?: number, gravity?: number,
796
+ /**
797
+ * Children above which a container is divided into communities (120; 0: never).
798
+ */
799
+ communities?: number,
800
+ /**
801
+ * The share of a hub's links a satellite must have to be gathered with it (0: never; at most 1).
802
+ */
803
+ satellites?: number,
804
+ /**
805
+ * Chains of single children share one disc (false).
806
+ */
807
+ chains?: boolean,
808
+ /**
809
+ * Force steps per container (1..=10000).
810
+ */
811
+ ticks?: number,
812
+ /**
813
+ * Groups the data gives: node id → path of group names.
814
+ */
815
+ groups?: { [key in string]: Array<string> }, };
816
+
817
+ /**
818
+ * Provisional (ADR 0018, addendum): the representation values of an overview request, as the engine checked them.
819
+ */
820
+ export type OverviewRepresentation = {
821
+ /**
822
+ * The user's decisions by node id.
823
+ */
824
+ decisions: { [key in string]: Representation },
825
+ /**
826
+ * The rules by node kind.
827
+ */
828
+ rules: { [key in string]: Representation },
829
+ /**
830
+ * Whether the zoom decides what neither a decision nor a rule does.
831
+ */
832
+ auto: boolean,
833
+ /**
834
+ * Rule kinds the graph does not have (reported, not refused: a config set serves many graphs).
835
+ */
836
+ unknownKinds: Array<string>, levelOfDetail?: LevelOfDetail, };
837
+
838
+ /**
839
+ * Provisional (ADR 0018): a request of the `overview` operation. In a session `graph` may be left out after the
840
+ * first request, and `start` without positions continues from the last overview.
841
+ */
842
+ export type OverviewRequest = { graph?: Graph, options?: OverviewLayoutOptions, intent?: OverviewIntent, configSet?: ConfigSet,
843
+ /**
844
+ * Radii by node id, for clusters a host shows structured.
845
+ */
846
+ radii?: { [key in string]: number }, start?: OverviewStart,
847
+ /**
848
+ * Worker threads (native only); the answer is the same for any number.
849
+ */
850
+ threads?: number, };
851
+
852
+ /**
853
+ * Provisional: where an overview continues from. Positions (`x`, `y`, `r`) of a previous overview of the same
854
+ * clusters, or none in a session (its last overview); `settle` lets the changed containers settle again.
855
+ */
856
+ export type OverviewStart = { x?: Array<number>, y?: Array<number>, r?: Array<number>, settle?: boolean, };
857
+
858
+ /**
859
+ * Provisional: the counts of an overview.
860
+ */
861
+ export type OverviewStats = { nodes: number, containers: number, communities: number, levels: number, edges: number, unresolvedEdges: number, overlaps: number, };
862
+
713
863
  export type PlacedLabel = { id: string, kind: string, text: string, bounds: Rect, };
714
864
 
715
865
  export type Point = { x: number, y: number, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arqlet/contracts",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "TypeScript types of Arqlet's engine contracts (Snapshot, Scene, ConfigSet, LayoutOptions, ...), generated from the Rust types. Types only; provisional.",
5
5
  "keywords": [
6
6
  "graph",