@arqlet/contracts 0.7.0 → 0.8.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 +328 -3
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -167,6 +167,30 @@ sizePins?: { [key in string]: SizePin },
167
167
  */
168
168
  labels?: { [key in string]: Point }, };
169
169
 
170
+ /**
171
+ * Provisional (view details): the answer of `details` (besides `ok`) for a node or an edge: what the engine knows about it
172
+ * and the host cannot see in the scene (the groups above it, what a collapsed box holds, the edges a drawn line stands
173
+ * for). Domain attributes stay with the host, which looks them up by id. Read only.
174
+ */
175
+ export type DetailsAnswer = {
176
+ /**
177
+ * The node asked for (`nodeId`).
178
+ */
179
+ node?: NodeDetails,
180
+ /**
181
+ * The edge of the source graph asked for (`edgeId` naming one).
182
+ */
183
+ edge?: EdgeDetails,
184
+ /**
185
+ * The drawn line asked for (`edgeId` naming a route), or the one that carries the edge asked for.
186
+ */
187
+ route?: LineDetails,
188
+ /**
189
+ * Provisional (ADR 0023, R1): the revision of the session's content the properties were read at; omitted without
190
+ * content.
191
+ */
192
+ contentRevision?: bigint, };
193
+
170
194
  export type Edge = { id: string, kind: string, source: string, target: string | null,
171
195
  /**
172
196
  * Provisional: how many edges this edge stands for (a pre-aggregated relation), at least 1; 1 when left out. It
@@ -175,6 +199,19 @@ export type Edge = { id: string, kind: string, source: string, target: string |
175
199
  */
176
200
  weight?: number, };
177
201
 
202
+ /**
203
+ * Provisional: an edge of the source graph (`details`).
204
+ */
205
+ export type EdgeDetails = { id: string, kind: string, source: string, target: string | null,
206
+ /**
207
+ * The drawn line that carries it, or null when the view does not show it (an end hidden, both ends in one box).
208
+ */
209
+ route: string | null,
210
+ /**
211
+ * Provisional (ADR 0023, R1): the edge's properties from the session's content; omitted when it has none.
212
+ */
213
+ properties?: Record<string, unknown>, };
214
+
178
215
  export type EdgePorts = { edgeId: string, sourcePort: string | null, targetPort: string | null, };
179
216
 
180
217
  /**
@@ -210,6 +247,27 @@ preview?: boolean,
210
247
  */
211
248
  settle?: Settle | null, };
212
249
 
250
+ /**
251
+ * Provisional (search): the answer of `find` (besides `ok`): the nodes of the source graph whose label or id contains the
252
+ * query (ignoring case), best first: an exact match, then a prefix, then a word start, then anywhere; equal ones by label
253
+ * and id. At most `limit` matches; `total` counts them all.
254
+ */
255
+ export type FindAnswer = { matches: Array<FindMatch>, total: number,
256
+ /**
257
+ * Provisional (ADR 0023, R1): with `key`, the revision of the session's content that was searched.
258
+ */
259
+ contentRevision?: bigint, };
260
+
261
+ /**
262
+ * Provisional: a node `find` found, with the containers above it (outermost first) and the visible box that shows it
263
+ * (itself, the collapsed container it is in, or null when the view hides it), so that a host can `reveal` it.
264
+ */
265
+ export type FindMatch = { id: string, label: string, kind: string, parents: Array<string>, shownAs: string | null,
266
+ /**
267
+ * Provisional (ADR 0023, R1): with `key`, the value of that property that matched.
268
+ */
269
+ value?: unknown, };
270
+
213
271
  export type GeometryIssue = { kind: string, nodeIds: Array<string>, message: string, };
214
272
 
215
273
  /**
@@ -245,7 +303,13 @@ defaultRouting?: "straight" | "orthogonal" | "roundedOrthogonal" | "polyline" |
245
303
  * Provisional: explicit buses (ADR 0005): each groups edges drawn on one shared trunk with branches. Membership is never
246
304
  * inferred. Omitted when empty, so earlier documents and drawings do not change.
247
305
  */
248
- buses?: Array<Bus>, };
306
+ buses?: Array<Bus>,
307
+ /**
308
+ * Provisional (ADR 0022): memberships across the hierarchy — the groupings a node belongs to besides its container,
309
+ * by dimension. Never inferred, and never a second containment tree. Omitted when empty, so earlier documents and
310
+ * drawings do not change.
311
+ */
312
+ memberships?: Memberships, };
249
313
 
250
314
  /**
251
315
  * Provisional: the nodes within some hops of nodes of a graph (`overviewNeighbourhood`), without a view.
@@ -256,7 +320,19 @@ export type GraphNeighbourhood = { nodes: Array<string>, edges: Array<string>, h
256
320
  * Provisional: a change of the source graph of a view (`patch`): nodes and edges to add, and nodes (each with what it
257
321
  * holds and its edges) and edges to remove. Removals apply first.
258
322
  */
259
- export type GraphPatch = { nodes?: Array<Node>, edges?: Array<Edge>, removeNodes?: Array<string>, removeEdges?: Array<string>, };
323
+ export type GraphPatch = { nodes?: Array<Node>, edges?: Array<Edge>, removeNodes?: Array<string>, removeEdges?: Array<string>,
324
+ /**
325
+ * Provisional (ADR 0022 §5b): dimensions and groups to add or replace, as `nodes` and `edges` add: a dimension of the
326
+ * same id takes the groups given (a group of the same id replaced, a new one appended) and a label if one is given; a
327
+ * new dimension is appended. Applied after `removeMemberships`. Member ids the graph does not have are kept and
328
+ * counted, as anywhere.
329
+ */
330
+ memberships?: Memberships,
331
+ /**
332
+ * Provisional (ADR 0022 §5b): whole dimensions, or groups within one (with the groups nested in them), to remove;
333
+ * applied first. Unknown ones are refused.
334
+ */
335
+ removeMemberships?: Array<MembershipRemoval>, };
260
336
 
261
337
  /**
262
338
  * Provisional: the paths between two nodes of a graph (`overviewTrace`), without a view: the overview's viewer maps them
@@ -264,6 +340,34 @@ export type GraphPatch = { nodes?: Array<Node>, edges?: Array<Edge>, removeNodes
264
340
  */
265
341
  export type GraphTrace = { found: boolean, reversed: boolean, length: number | null, nodes: Array<string>, edges: Array<string>, };
266
342
 
343
+ /**
344
+ * Provisional (ADR 0022 §2): one criterion of `LayoutOptions::grouping_priority`.
345
+ */
346
+ export type GroupingCriterion = {
347
+ /**
348
+ * `parent` (containment from `parentId`) or the id of a declared membership dimension.
349
+ */
350
+ by: string,
351
+ /**
352
+ * The value priority of a dimension: when a node is in several of its groups that are not one path, the first of
353
+ * these that holds it owns it. Unlisted groups follow in their declared order. Not allowed on `parent`.
354
+ */
355
+ values?: Array<string>,
356
+ /**
357
+ * How the criterion's groups are rendered where it owns nodes. `lanes` is accepted and reported as not yet applied
358
+ * (ADR 0022, M4); its groups are drawn as containers until then.
359
+ */
360
+ as?: GroupingRendering,
361
+ /**
362
+ * The shape of this criterion's hulls where it holds nodes softly; `LayoutOptions::membership_hull` without it.
363
+ */
364
+ hull?: HullShape, };
365
+
366
+ /**
367
+ * Provisional (ADR 0022 §3): how an owning criterion's groups are drawn.
368
+ */
369
+ export type GroupingRendering = "containers" | "lanes";
370
+
267
371
  /**
268
372
  * What a view hides (provisional, view state set by the `filter` operation): nodes of these kinds, these nodes (each with
269
373
  * everything below it) and edges of these kinds. The layout keeps their room, so what stays keeps its place; the scene
@@ -282,6 +386,11 @@ compact?: boolean, };
282
386
  */
283
387
  export type HubRef = { edge: string, kind: string, node: string, hub: string, outgoing: boolean, };
284
388
 
389
+ /**
390
+ * Provisional (ADR 0022 §3): the outline of a membership hull. Both are comparison geometry, no trigonometry.
391
+ */
392
+ export type HullShape = "rectangle" | "polygon";
393
+
285
394
  export type HybridCriterion = "compact" | "endToEnd";
286
395
 
287
396
  export type Integrity = {
@@ -317,7 +426,12 @@ orderHints?: { [key in string]: OrderHint },
317
426
  * Provisional: the containers shown in part (`LayoutOptions::partial`, set by `reveal`), so that a step back undoes a
318
427
  * reveal or a page of `+N more`. Omitted when empty.
319
428
  */
320
- partial?: { [key in string]: Array<string> }, };
429
+ partial?: { [key in string]: Array<string> },
430
+ /**
431
+ * Provisional: what the view hides (`LayoutOptions::hidden`, set by `filter`), so that a step back undoes a filter.
432
+ * Omitted when nothing is hidden.
433
+ */
434
+ hidden?: Hidden, };
321
435
 
322
436
  /**
323
437
  * Measured text rectangle. Hosts may supply exact font measurements.
@@ -462,6 +576,19 @@ hubRefs?: number,
462
576
  * (as ELK's merged edges). `None` (the default, omitted): one track per edge.
463
577
  */
464
578
  sharedTracks?: SharedTracks,
579
+ /**
580
+ * Provisional (ADR 0022 §2): the structures the view shows, ranked. A criterion is the parent hierarchy (`parent`) or
581
+ * a membership dimension; the first criterion that assigns a node owns it in the view (its container), and every
582
+ * later one holds it softly (drawn as hulls). A dimension that is not listed is neither drawn nor read. Empty (the
583
+ * default, omitted) means `[parent]`: today's view, byte-identical. See `grouping::owners`.
584
+ */
585
+ groupingPriority?: Array<GroupingCriterion>,
586
+ /**
587
+ * Provisional (ADR 0022 §3): the shape of a membership hull. `rectangle` (the default, omitted) draws the padded
588
+ * bounding box of the group's boxes, which looks like a container and may overlap one; `polygon` draws the padded
589
+ * convex hull. A criterion of `groupingPriority` may override it (M1).
590
+ */
591
+ membershipHull?: HullShape,
465
592
  /**
466
593
  * Provisional, computed by the layout with `hubRefs`: the room the references' stubs and names take between two ranks
467
594
  * (added to the layer spacing), kept with the snapshot so that every later operation spaces alike. 0 (omitted): none.
@@ -837,12 +964,74 @@ nodes?: number | null,
837
964
  */
838
965
  edges?: number | null, };
839
966
 
967
+ /**
968
+ * Provisional: a drawn line (`details`): its visible ends, its shape, and the edges of the source graph it stands for in
969
+ * its own direction (`edges`) and in the other (`opposite`), at most `limit` ids each (the counts are complete).
970
+ */
971
+ export type LineDetails = { id: string, kind: string, source: string, target: string, length: number, bends: number,
972
+ /**
973
+ * Edges drawn along it (one unless it leads a bundle).
974
+ */
975
+ weight: number,
976
+ /**
977
+ * The line it is bundled into, or null.
978
+ */
979
+ bundleOf: string | null,
980
+ /**
981
+ * The lines bundled into it.
982
+ */
983
+ bundled: Array<string>, edges: Array<string>, edgeCount: number, opposite: Array<string>, oppositeCount: number, };
984
+
840
985
  /**
841
986
  * A geometry observation for one element: the realized outline and the revision of the measurement. The revision rises with
842
987
  * every new measurement of that element, so that an old one is recognised when it arrives late.
843
988
  */
844
989
  export type Measurement = { contour: Contour, geometryRevision: bigint, };
845
990
 
991
+ /**
992
+ * Provisional (ADR 0022): one dimension of memberships (`zone`, `team`, `layer`, …) with its groups in the order they
993
+ * are declared. That order is the lane order, the legend order and the iteration order of everything derived from it.
994
+ */
995
+ export type MembershipDimension = { id: string,
996
+ /**
997
+ * What the dimension is called in the drawing. The engine does not read it; it is carried to the viewer.
998
+ */
999
+ label?: string, groups?: Array<MembershipGroup>, };
1000
+
1001
+ /**
1002
+ * Provisional (ADR 0022): one group of a dimension. `members` are node ids; an id the graph does not have is ignored
1003
+ * and counted, not an error, because a host mapping may cover more than the imported view.
1004
+ */
1005
+ export type MembershipGroup = { id: string,
1006
+ /**
1007
+ * What the group is called in the drawing; its id where this is empty.
1008
+ */
1009
+ label?: string,
1010
+ /**
1011
+ * Nests this group inside another group of the same dimension, so membership here implies membership there: a group
1012
+ * covers its own members and those of every group below it, and a parent does not list them again. An overlay
1013
+ * therefore draws a sub-zone inside its zone.
1014
+ */
1015
+ parent?: string, members?: Array<string>, };
1016
+
1017
+ /**
1018
+ * Provisional (ADR 0022 §5b): a dimension to remove, or with `group` one group of it (and the groups nested in it).
1019
+ */
1020
+ export type MembershipRemoval = { dimension: string, group?: string, };
1021
+
1022
+ /**
1023
+ * Provisional (ADR 0022): the membership dimensions of a graph. A node has one container (`Node::parent_id`); a
1024
+ * membership says that it also belongs to a zone, a team or a layer, and several of those at once. Memberships are
1025
+ * authored domain data, like `Graph::buses`: the engine never derives them, and they never change the containment tree.
1026
+ * How a dimension is shown is a view option (`LayoutOptions::grouping_priority`), not data. Omitted when empty, so a
1027
+ * graph without memberships serializes exactly as before.
1028
+ */
1029
+ export type Memberships = {
1030
+ /**
1031
+ * The dimensions in the order they are declared, which is the order everything derived uses.
1032
+ */
1033
+ dimensions?: Array<MembershipDimension>, };
1034
+
846
1035
  export type Metrics = { version: number, nodes: number, edges: number, width: number, height: number, area: number,
847
1036
  /**
848
1037
  * Overlapping node pairs under the same parent.
@@ -921,6 +1110,60 @@ export type Node = { id: string, kind: string, label: string, parentId: string |
921
1110
  */
922
1111
  shape?: NodeShape, };
923
1112
 
1113
+ /**
1114
+ * Provisional: a node of the source graph in the current view (`details`).
1115
+ */
1116
+ export type NodeDetails = { id: string, kind: string, label: string,
1117
+ /**
1118
+ * The containers above it, outermost first.
1119
+ */
1120
+ parents: Array<string>,
1121
+ /**
1122
+ * The visible box that shows it: itself, the collapsed container it is in, or null when the view hides it (a filter,
1123
+ * outside the view).
1124
+ */
1125
+ shownAs: string | null,
1126
+ /**
1127
+ * That box's bounds in the scene's (absolute) coordinates, or null.
1128
+ */
1129
+ bounds: { x: number, y: number, width: number, height: number } | null, collapsed: boolean,
1130
+ /**
1131
+ * Its direct children and all nodes inside it, in the source graph.
1132
+ */
1133
+ children: number, descendants: number,
1134
+ /**
1135
+ * Edges of the source graph that end and start at the node itself (a self-loop counts in both).
1136
+ */
1137
+ incoming: number, outgoing: number,
1138
+ /**
1139
+ * Provisional (ADR 0023, R1): the node's properties from the session's content; omitted when it has none.
1140
+ */
1141
+ properties?: Record<string, unknown>,
1142
+ /**
1143
+ * Provisional (ADR 0022 §7): the node's groups per criterion of a non-default `groupingPriority`, in the order of
1144
+ * the ranks: the one that owns it (`owner`) and those that hold it softly. Kept apart from `parents`, which is the
1145
+ * containment of the source. Omitted when empty — always under the default priority — so a typed host built before
1146
+ * it keeps deserializing the answer.
1147
+ */
1148
+ groupings?: Array<NodeGrouping>, };
1149
+
1150
+ /**
1151
+ * Provisional (ADR 0022 §7): one group of a node under one criterion of the grouping priority (`NodeDetails::groupings`).
1152
+ */
1153
+ export type NodeGrouping = {
1154
+ /**
1155
+ * The criterion: `parent` or a dimension id.
1156
+ */
1157
+ by: string,
1158
+ /**
1159
+ * The group: a container id for `parent`, a group id for a dimension.
1160
+ */
1161
+ group: string,
1162
+ /**
1163
+ * Whether this group owns the node in the view (its container), rather than holding it softly.
1164
+ */
1165
+ owner: boolean, };
1166
+
924
1167
  /**
925
1168
  * The outline of a leaf node (docs/...: step 1 of the shape support). Containers use the same names later.
926
1169
  */
@@ -1343,6 +1586,17 @@ busLines?: Array<SceneBusLine>,
1343
1586
  * Provisional (`hubRefs`): edges of hubs drawn as stubs at their other end, named after the hub. Omitted when none.
1344
1587
  */
1345
1588
  hubRefs?: Array<SceneHubRef>,
1589
+ /**
1590
+ * Provisional (ADR 0022, the soft criteria of `groupingPriority`): a hull per membership group, to be drawn behind the
1591
+ * nodes. In the declared order of the dimensions and of their groups. Omitted when there is none, so every drawing
1592
+ * without the option is unchanged.
1593
+ */
1594
+ membershipHulls?: Array<SceneHull>,
1595
+ /**
1596
+ * Provisional (ADR 0022 §5): one entry per dimension the options name, with its counts and one summary line.
1597
+ * Omitted when there is none.
1598
+ */
1599
+ membershipReport?: Array<SceneMembershipReport>,
1346
1600
  /**
1347
1601
  * Extent of everything drawn, with a 30-unit margin. May start at negative coordinates.
1348
1602
  */
@@ -1374,6 +1628,77 @@ nodes: Array<string>, routes: Array<string>, reason: string, };
1374
1628
  */
1375
1629
  export type SceneHubRef = { edge: string, node: string, hub: string, outgoing: boolean, text: string, points: Array<Point>, label: Rect, };
1376
1630
 
1631
+ /**
1632
+ * Provisional (ADR 0022, first slice): the hull of one membership group, drawn behind the nodes. `points` is a closed
1633
+ * polygon (the last point joins the first) and is empty for no group: a group whose members the view does not show is
1634
+ * left out instead. The hull is **not an obstacle**: the router never saw it, and routes may cross it.
1635
+ */
1636
+ export type SceneHull = {
1637
+ /**
1638
+ * The dimension this group belongs to, and its label for a legend.
1639
+ */
1640
+ dimension: string, dimensionLabel: string, group: string,
1641
+ /**
1642
+ * What to write on the hull: the group's label, or its id where it has none.
1643
+ */
1644
+ label: string, points: Array<Point>,
1645
+ /**
1646
+ * The boxes the hull was built from: a member's own box, or the box that stands for it (a collapsed container).
1647
+ */
1648
+ boxes: Array<string>,
1649
+ /**
1650
+ * Leaf boxes inside the hull that are not members of the group. The honest cost of drawing a hull around nodes the
1651
+ * layout kept apart, and one of the two numbers a later default depends on (ADR 0022 §6).
1652
+ */
1653
+ intruders: Array<string>, };
1654
+
1655
+ /**
1656
+ * Provisional (ADR 0022 §5): what one membership dimension did in this drawing. Typed, because one line of text per
1657
+ * group would be thousands of lines on a real graph; `summary` is the single line a host can simply print.
1658
+ */
1659
+ export type SceneMembershipReport = { dimension: string,
1660
+ /**
1661
+ * The mode the options asked for (`overlay`, `hierarchy`, `lanes`).
1662
+ */
1663
+ mode: string,
1664
+ /**
1665
+ * Whether this drawing applied it. `hierarchy` and `lanes` are accepted and not yet applied (ADR 0022, M1 and M4).
1666
+ */
1667
+ applied: boolean,
1668
+ /**
1669
+ * Groups the dimension declares, and how many of them were drawn.
1670
+ */
1671
+ groups: number, drawn: number,
1672
+ /**
1673
+ * Leaf boxes inside a hull they do not belong to, summed over the dimension's groups.
1674
+ */
1675
+ intruders: number,
1676
+ /**
1677
+ * Pairs of this dimension's hulls that overlap. Hulls of *different* dimensions are expected to overlap — that is
1678
+ * what cutting across each other means — so only pairs within one dimension are counted.
1679
+ */
1680
+ overlappingPairs: number,
1681
+ /**
1682
+ * Member ids the source graph does not have. Information, not a conflict (ADR 0022 §1).
1683
+ */
1684
+ unknownMembers: number,
1685
+ /**
1686
+ * Members the view does not show and for which no box stands in (filtered out, or outside the view).
1687
+ */
1688
+ hiddenMembers: number,
1689
+ /**
1690
+ * Nodes this criterion owns: it is the first that assigns them (ADR 0022 §2, rule 1).
1691
+ */
1692
+ owned: number,
1693
+ /**
1694
+ * Of those, the nodes in several of its groups that are not one path: the value order chose (rule 2).
1695
+ */
1696
+ multipleOwners: number,
1697
+ /**
1698
+ * Nodes no listed criterion assigns (rule 3), placed at the root. Counted on the first criterion's entry only.
1699
+ */
1700
+ unassigned: number, summary: string, };
1701
+
1377
1702
  export type SceneNode = {
1378
1703
  /**
1379
1704
  * Absolute bounds in scene coordinates.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arqlet/contracts",
3
- "version": "0.7.0",
3
+ "version": "0.8.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",