@arqlet/contracts 0.2.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 +218 -4
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1,5 +1,10 @@
1
1
  // Generated by crates/contracts (ts-rs) and bundled by tools/npm-prepack.mjs. Do not edit by hand.
2
2
 
3
+ /**
4
+ * The edges one aggregated edge stands for, by direction (see `LayoutOptions::aggregate_weights`).
5
+ */
6
+ export type AggregateWeight = { forward: number, backward: number, };
7
+
3
8
  /**
4
9
  * Provisional annotation shape; the annotation model of section 5 is not implemented yet.
5
10
  */
@@ -108,7 +113,13 @@ sizePins?: { [key in string]: SizePin },
108
113
  */
109
114
  labels?: { [key in string]: Point }, };
110
115
 
111
- 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, };
112
123
 
113
124
  export type EdgePorts = { edgeId: string, sourcePort: string | null, targetPort: string | null, };
114
125
 
@@ -171,17 +182,24 @@ origin?: Point | null, };
171
182
  * A graph: the canonical data of a view. Direction and layout strategy are two constraints, each set for the root and for
172
183
  * containers and inherited by containers that declare nothing (docs/adr/0003-container-direction-constraints.md).
173
184
  */
174
- 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"> },
175
186
  /**
176
187
  * The edge routing of the root and its containers (docs/adr/0005-routing-constraints.md).
177
188
  */
178
- 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>,
179
190
  /**
180
191
  * Provisional: explicit buses (ADR 0005): each groups edges drawn on one shared trunk with branches. Membership is never
181
192
  * inferred. Omitted when empty, so earlier documents and drawings do not change.
182
193
  */
183
194
  buses?: Array<Bus>, };
184
195
 
196
+ /**
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.
200
+ */
201
+ export type Hidden = { nodeKinds?: Array<string>, nodes?: Array<string>, edgeKinds?: Array<string>, };
202
+
185
203
  export type HybridCriterion = "compact" | "endToEnd";
186
204
 
187
205
  export type Integrity = {
@@ -308,6 +326,13 @@ strictClearance?: boolean,
308
326
  * decides between them. Omitted when off, so the default output does not change.
309
327
  */
310
328
  componentPacking?: boolean,
329
+ /**
330
+ * Experimental: the children of a layered area that have no edge to another child (a file of unrelated functions)
331
+ * are spread over the ranks as a grid instead of all standing in the first rank, one long column. They fill the
332
+ * ranks the connected children use, and more when there are many of them, so the grid comes out about square.
333
+ * Omitted when off, so the default output does not change.
334
+ */
335
+ isolatedGrid?: boolean,
311
336
  /**
312
337
  * How edges are drawn: orthogonal routes (the default, omitted) or straight segments between the port positions.
313
338
  * Straight routing never bends: an edge that would cross a foreign node is reported as a routing issue.
@@ -397,6 +422,36 @@ orderSeed?: number,
397
422
  * 0 (the default, omitted) lays out every node.
398
423
  */
399
424
  visibleNodeBudget?: number,
425
+ /**
426
+ * Provisional: containers with more children than this (the root included) are divided into communities of their
427
+ * children, found from the edges between them (the cluster overview's Louvain), shown as containers of kind
428
+ * `community`, collapsed at first and opened with `toggle`. They exist only in the view: the source graph is
429
+ * unchanged. 0 (the default, omitted) adds none.
430
+ */
431
+ communities?: number,
432
+ /**
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 (`["Billing", "Invoices"]`). They become containers of kind `group` in the view only, nested along the path,
435
+ * before `communities` divides what is still large. Ids the graph does not have are ignored (a mapping may cover more
436
+ * than the imported view). Omitted when empty.
437
+ */
438
+ groups?: { [key in string]: Array<string> },
439
+ /**
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.
447
+ */
448
+ hidden?: Hidden,
449
+ /**
450
+ * Provisional (view state, set by `reveal`): containers shown in part. The children listed for a container are shown;
451
+ * the others are gathered in a collapsed container `rest:<id>` of kind `rest` ("+N more"), which a `toggle` dissolves.
452
+ * Omitted when empty.
453
+ */
454
+ partial?: { [key in string]: Array<string> },
400
455
  /**
401
456
  * Experimental (plan section 4a, global layering, iteration 2; needs `layered_construction`): in a layered area with a
402
457
  * fixed flow, an expanded child container of the same flow axis takes part with its children in the area's ranks, as
@@ -418,6 +473,13 @@ simplexRanks?: boolean,
418
473
  * content (inside out), so that expanding it moves the outer picture little. Omitted when empty.
419
474
  */
420
475
  collapsedSizes?: { [key in string]: NodeSize },
476
+ /**
477
+ * Provisional (derived by the runtime with `communities`, not set by a user): what an edge that stands for collapsed
478
+ * content represents, by edge id: the edges between its two visible ends in its own direction (`forward`) and in the
479
+ * other (`backward`). The route takes `forward` as its weight; the scene reports `backward` as `backWeight`, so a
480
+ * renderer can draw both directions on one route. Omitted when empty.
481
+ */
482
+ aggregateWeights?: { [key in string]: AggregateWeight },
421
483
  /**
422
484
  * Optional limit on the drawing's larger extent, in units. Not a constraint the search enforces: when the result
423
485
  * spans more, a routing issue reports it (the search is not extent-aware, so this proves nothing about feasibility).
@@ -517,6 +579,21 @@ orderHints?: { [key in string]: OrderHint }, };
517
579
  */
518
580
  export type LayoutStrategy = "none" | "shortest" | "tree" | "radial" | "organic";
519
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
+
520
597
  /**
521
598
  * A geometry observation for one element: the realized outline and the revision of the measurement. The revision rises with
522
599
  * every new measurement of that element, so that an old one is recognised when it arrives late.
@@ -632,6 +709,49 @@ after: string | null, };
632
709
  */
633
710
  export type Orientation = "lr" | "rl" | "tb" | "bt";
634
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
+
635
755
  /**
636
756
  * Provisional (ADR 0018, addendum): the rules of the data for the cluster overview, the second step of the order
637
757
  * user, rules, zoom.
@@ -644,7 +764,12 @@ rules?: { [key in string]: Representation },
644
764
  /**
645
765
  * Whether the zoom decides what neither the user nor a rule decided. Absent: yes.
646
766
  */
647
- 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, };
648
773
 
649
774
  /**
650
775
  * Provisional (ADR 0018, addendum; ADR 0015): the user's decisions in the cluster overview as one value, by node id.
@@ -652,6 +777,89 @@ auto?: boolean, };
652
777
  */
653
778
  export type OverviewIntent = { decisions?: { [key in string]: Representation }, };
654
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
+
655
863
  export type PlacedLabel = { id: string, kind: string, text: string, bounds: Rect, };
656
864
 
657
865
  export type Point = { x: number, y: number, };
@@ -866,6 +1074,12 @@ export type SceneRoute = { id: string,
866
1074
  * The edge's kind: for a relationship, its type (the verb), drawn as the route's label.
867
1075
  */
868
1076
  kind?: string, source: string, target: string, points: Array<Point>, weight: number,
1077
+ /**
1078
+ * Provisional (communities): the route stands for collapsed content in both directions; this many edges run the
1079
+ * other way (from `target` to `source`), `weight` in its own. Present only on such routes, 0 when every one of them
1080
+ * runs one way; a renderer draws an arrow at the start too when it is above 0.
1081
+ */
1082
+ backWeight?: number | null,
869
1083
  /**
870
1084
  * True when the engine reported a structured conflict for this route.
871
1085
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arqlet/contracts",
3
- "version": "0.2.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",