@astrale-os/sdk 0.6.0-beta.65 → 0.6.0-beta.67

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.
@@ -137,6 +137,16 @@ export class Model {
137
137
  touches(classes, end) {
138
138
  return classes.some((c) => end.accepts.some((key) => this.satisfies(c).has(key)));
139
139
  }
140
+ /**
141
+ * Whether a Node of one of `classes` may be one `end` accepts: the end accepts the Class, one of
142
+ * its parents, or one of its subclasses. What a walk asks of the Classes it reaches before it
143
+ * follows another Edge from them.
144
+ */
145
+ meets(classes, end) {
146
+ if (this.touches(classes, end))
147
+ return true;
148
+ return this.far(end).some((accepted) => classes.some((c) => this.satisfies(accepted).has(c.key)));
149
+ }
140
150
  /** The Classes a traversal of `edges` in `direction` reaches. */
141
151
  reached(edges, direction) {
142
152
  const out = new Set();
@@ -17,7 +17,7 @@ export interface Pattern {
17
17
  /** The keys of the Classes its rows may be, after narrowing (S3): the layout of each row. */
18
18
  readonly classes: readonly string[];
19
19
  readonly select: Rendering;
20
- /** Rows the reader may not read stay, as `{ id, $class, $withheld }`. */
20
+ /** Rows read as values that the reader may not read stay, as `{ id, $class, $withheld }`. */
21
21
  readonly withheld: boolean;
22
22
  readonly branches: readonly BranchPlan[];
23
23
  }
@@ -36,6 +36,11 @@ export interface BranchPlan extends Pattern {
36
36
  readonly empty: boolean;
37
37
  /** Each row carries `$edge` (`.withEdge()`): the Edge's Class, and its values when selected. */
38
38
  readonly edge?: Rendering;
39
+ /**
40
+ * The relation follows one Edge or more (`.reachable()`): a row's Edge no longer leaves its
41
+ * parent, so `$edge` names both its ends.
42
+ */
43
+ readonly reachable?: true;
39
44
  }
40
45
  export interface NodeRootPlan extends Pattern {
41
46
  readonly kind: 'nodes';
@@ -38,6 +38,13 @@ export declare class Relation {
38
38
  ref(): Relation;
39
39
  includeWithheld(): Relation;
40
40
  distinct(): Relation;
41
+ /**
42
+ * The relation followed one Edge or more: the Nodes it reaches however far, each Edge followed
43
+ * once, or with `.distinct()` each Node once. `through` holds on every Node a walk passes
44
+ * through, between the Node it starts from and the Node it reaches; `where` still holds on each
45
+ * Edge followed and on each Node reached.
46
+ */
47
+ reachable(written?: unknown): Relation;
41
48
  /** Exactly one per parent: two rows, to see a second. */
42
49
  get(): RelationRead;
43
50
  find(): RelationRead;
@@ -16,15 +16,18 @@ const optional = (condition) => condition.always || condition.never ? undefined
16
16
  * A part of a document, from its conditions and its Branches: as sent, absent when a condition is
17
17
  * NEVER, and as written when the input folds one of them (absent when it is the part as sent).
18
18
  */
19
- function lowered(conditions, branches, write) {
20
- const part = (cs, withs) => cs.some((c) => c.never) ? undefined : write(cs, withs);
21
- const sent = part(conditions, branches.flatMap((b) => (b.branch === undefined ? [] : [b.branch])));
22
- if (!conditions.some((c) => c.folded) && branches.every((b) => b.written === undefined))
19
+ function lowered(conditions, branches, write,
20
+ /** Conditions the part writes that never empty it: the `through` of a walk. */
21
+ free = []) {
22
+ const part = (cs, withs, fs) => (cs.some((c) => c.never) ? undefined : write(cs, withs, fs));
23
+ const sent = part(conditions, branches.flatMap((b) => (b.branch === undefined ? [] : [b.branch])), free);
24
+ if (![...conditions, ...free].some((c) => c.folded) &&
25
+ branches.every((b) => b.written === undefined))
23
26
  return { sent };
24
27
  const written = part(conditions.map((c) => c.asWritten), branches.flatMap((b) => {
25
28
  const branch = b.written ?? b.branch;
26
29
  return branch === undefined ? [] : [branch];
27
- }));
30
+ }), free.map((c) => c.asWritten));
28
31
  return { sent, written };
29
32
  }
30
33
  /** A root read: its plan, and its document as `lowered` writes it from its condition. */
@@ -133,11 +136,39 @@ export function handleClass(value) {
133
136
  * is no set of roots; a set whose rows render (`with`, `ref`, `includeWithheld`) is refused.
134
137
  */
135
138
  export function rangeRead(value, ordered) {
136
- if (value instanceof NodeSet)
137
- return NodeSet.range(value, ordered);
138
- if (value instanceof EdgeSet)
139
- return EdgeSet.range(value, ordered);
140
- return undefined;
139
+ const read = value instanceof NodeSet
140
+ ? NodeSet.range(value, ordered)
141
+ : value instanceof EdgeSet
142
+ ? EdgeSet.range(value, ordered)
143
+ : undefined;
144
+ if (read !== undefined && (walks(read.plan.document) || walks(read.plan.written)))
145
+ throw new TypeError('A guard follows a relation one Edge at a time: the Kernel decides it inside the write, where it refuses `.reachable()`. Read the walk in a Query, and guard what it found.');
146
+ return read;
147
+ }
148
+ /**
149
+ * Whether a range holds a Traversal that follows one Edge or more: in its condition, at any depth.
150
+ * It reads the grammar's Traversals alone, never a value: a JSON literal may hold any key.
151
+ */
152
+ function walks(document) {
153
+ const walked = (value) => {
154
+ const where = value;
155
+ switch (where?.op) {
156
+ case 'and':
157
+ case 'or':
158
+ return where.operands.some(walked);
159
+ case 'not':
160
+ case 'source':
161
+ case 'target':
162
+ return walked(where.operand);
163
+ case 'exists':
164
+ return where.reachable !== undefined || walked(where.edge) || walked(where.node);
165
+ default:
166
+ return false;
167
+ }
168
+ };
169
+ const family = document;
170
+ const root = (family?.list ?? family?.exists ?? family?.count);
171
+ return walked(root?.where);
141
172
  }
142
173
  function renderedRange() {
143
174
  throw new TypeError("A guard reads its range's roots alone: `.with`, `.ref` and `.includeWithheld` render rows, which a guard never reads.");
@@ -372,6 +403,7 @@ export class Relation {
372
403
  edges,
373
404
  direction,
374
405
  far,
406
+ reached: far,
375
407
  role: farRole(model, from, edges, direction),
376
408
  context,
377
409
  node: Condition.ALWAYS,
@@ -382,6 +414,7 @@ export class Relation {
382
414
  withheld: false,
383
415
  selectEdge: false,
384
416
  distinct: false,
417
+ through: undefined,
385
418
  });
386
419
  }
387
420
  #next(patch) {
@@ -450,8 +483,54 @@ export class Relation {
450
483
  throw new TypeError(DISTINCT_EDGE);
451
484
  return this.#next({ distinct: true });
452
485
  }
486
+ /**
487
+ * The relation followed one Edge or more: the Nodes it reaches however far, each Edge followed
488
+ * once, or with `.distinct()` each Node once. `through` holds on every Node a walk passes
489
+ * through, between the Node it starts from and the Node it reaches; `where` still holds on each
490
+ * Edge followed and on each Node reached.
491
+ */
492
+ reachable(written) {
493
+ const s = this.#s;
494
+ if (s.through !== undefined)
495
+ throw new TypeError(`${s.name} is already reachable: write its \`through\` once.`);
496
+ const ends = s.edges.map((edge) => ({ edge, ...s.model.ends(edge) }));
497
+ if (s.role !== undefined)
498
+ throw new TypeError(`${s.name} follows an undirected Edge whose roles accept different Classes: the Node it reaches cannot start another Edge of it. Read it with { direction: 'incident' }.`);
499
+ if (s.direction !== 'incident' && new Set(ends.map((e) => e.undirected)).size > 1)
500
+ throw new TypeError(`${s.name} follows directed and undirected Edges: a walk of them has one direction only as { direction: 'incident' }.`);
501
+ // A reached Class starts another hop when an end the Edges leave from may accept its Nodes.
502
+ const leaves = (e) => s.direction === 'incident' || e.undirected
503
+ ? [e.source, e.target]
504
+ : [s.direction === 'outgoing' ? e.source : e.target];
505
+ if (!ends.some((e) => leaves(e).some((end) => s.model.meets(s.reached, end))))
506
+ throw new TypeError(`${s.name} reaches ${keysOf(s.reached).join(', ')}, none of which ${keysOf(s.edges).join(', ')} leaves from in this direction: it follows one Edge only, so it is not reachable.`);
507
+ if (written === undefined)
508
+ return this.#next({ through: Condition.ALWAYS });
509
+ const { through } = options(written, 'reachable');
510
+ if (through === undefined)
511
+ return this.#next({ through: Condition.ALWAYS });
512
+ const handleScope = scope(`the Nodes ${s.name} passes through`);
513
+ // Written on the Classes its rows are, as `where` is: the keys `through` may name.
514
+ const node = nodeHandle(s.model, s.far, { scope: handleScope, on: 'item' });
515
+ const listed = kept(callback(through, 'reachable({ through })')(node), 'through');
516
+ within(listed, [handleScope]);
517
+ return this.#next({ through: and(listed) });
518
+ }
519
+ /**
520
+ * The reach of its Traversal, as `through` is: none when the relation follows one Edge, or when
521
+ * no Node meets `through`, so that a walk never passes its first Edge.
522
+ */
523
+ #reach(through) {
524
+ if (through === undefined || through.never)
525
+ return undefined;
526
+ const s = this.#s;
527
+ const incident = s.direction === 'incident' || s.edges.every((edge) => s.model.ends(edge).undirected);
528
+ if (incident && !s.distinct)
529
+ throw new TypeError(`${s.name} is followed either way: a walk reaches an Edge from both its ends, so it has no single row. Add .distinct() to read the Nodes it reaches.`);
530
+ return defined({ through: optional(through) });
531
+ }
453
532
  /** Its Traversal: along an undirected Edge whose far role needs it, `incident` to that role. */
454
- #traversal(node, edge) {
533
+ #traversal(node, edge, through) {
455
534
  const { role } = this.#s;
456
535
  const conjuncts = [
457
536
  ...(role === undefined ? [] : [role]),
@@ -461,6 +540,7 @@ export class Relation {
461
540
  via: keysOf(this.#s.edges),
462
541
  direction: role === undefined ? this.#s.direction : 'incident',
463
542
  distinct: this.#s.distinct ? true : undefined,
543
+ reachable: this.#reach(through),
464
544
  edge: optional(edge),
465
545
  node: conjuncts.length === 0
466
546
  ? undefined
@@ -474,8 +554,8 @@ export class Relation {
474
554
  return new RelationRead(s.context.scope, (key, name) => {
475
555
  const counted = verb === 'count' || verb === 'exists';
476
556
  const branches = counted ? [] : lowerWiths(s.with);
477
- const { sent, written } = lowered([s.node, s.edge], branches, ([node, edge], withs) => {
478
- const traversal = this.#traversal(node, edge);
557
+ const { sent, written } = lowered([s.node, s.edge], branches, ([node, edge], withs, [through]) => {
558
+ const traversal = this.#traversal(node, edge, through);
479
559
  if (counted)
480
560
  return { name, ...traversal, mode: 'count', upTo: limit };
481
561
  const orderBy = s.orderBy.map((k) => keyJson(k, s.distinct));
@@ -489,7 +569,7 @@ export class Relation {
489
569
  with: nonEmpty(withs),
490
570
  limit,
491
571
  });
492
- });
572
+ }, s.through === undefined ? [] : [s.through]);
493
573
  const plan = {
494
574
  key,
495
575
  name,
@@ -498,6 +578,7 @@ export class Relation {
498
578
  ...(bound === undefined ? {} : { bound }),
499
579
  empty: sent === undefined,
500
580
  ...(s.selectEdge ? { edge: 'value' } : {}),
581
+ ...(s.through === undefined ? {} : { reachable: true }),
501
582
  classes: keysOf(s.far),
502
583
  select: s.select,
503
584
  withheld: s.withheld,
@@ -536,11 +617,12 @@ export class Relation {
536
617
  /** At least `atLeast` Edges of the relation meet the extra conditions. */
537
618
  #exists(extra, atLeast = 1) {
538
619
  const sides = [and([this.#s.node, extra.node]), and([this.#s.edge, extra.edge])];
539
- return folding(sides, ([node, edge]) => node.never || edge.never
620
+ const { through } = this.#s;
621
+ return folding(through === undefined ? sides : [...sides, through], ([node, edge, walked]) => node.never || edge.never
540
622
  ? Condition.NEVER
541
623
  : atom(this.#s.context, {
542
624
  op: 'exists',
543
- ...this.#traversal(node, edge),
625
+ ...this.#traversal(node, edge, walked),
544
626
  ...(atLeast > 1 ? { atLeast } : {}),
545
627
  }));
546
628
  }
@@ -4,6 +4,7 @@
4
4
  import type { HandleMembers } from './conditions.js';
5
5
  import type { Cls, EdgesOf, KeyOf, NodeClassKey, NodeRoot, OriginOf, PropNamesOf, Satisfies, Single } from './domain.js';
6
6
  import type { RelSet } from './handles.js';
7
+ import type { Direction } from './model.js';
7
8
  /**
8
9
  * An Edge's two ends. An undirected Edge's are its two roles in declared order, which name neither
9
10
  * stored end (`Model.ends`).
@@ -51,11 +52,21 @@ export type SourceKeys<S, E> = AcceptKeys<SourceOf<Cls<S, E>>> & NodeClassKey<S>
51
52
  export type TargetKeys<S, E> = AcceptKeys<TargetOf<Cls<S, E>>> & NodeClassKey<S>;
52
53
  export type SourceRole<S, E> = RoleOf<SourceOf<Cls<S, E>>>;
53
54
  export type TargetRole<S, E> = RoleOf<TargetOf<Cls<S, E>>>;
54
- interface Candidate<N extends string, E extends string, Own extends boolean, Far extends string> {
55
+ interface Candidate<N extends string, E extends string, Own extends boolean, Far extends string, D extends Direction> {
55
56
  readonly name: N;
56
57
  readonly edge: E;
57
58
  readonly own: Own;
58
59
  readonly far: Far;
60
+ readonly direction: D;
61
+ }
62
+ /**
63
+ * How a relation is followed: its direction, the Classes its Edges reach whatever `where` narrows
64
+ * its rows to, and whether it follows one Edge or more (`.reachable()`).
65
+ */
66
+ export interface Followed<D extends Direction = Direction, K extends string = string, R extends boolean = boolean> {
67
+ readonly direction: D;
68
+ readonly reached: K;
69
+ readonly reachable: R;
59
70
  }
60
71
  type IsOwn<S, E> = KeyOf<E> extends `${OriginOf<S>}:${string}` ? true : false;
61
72
  type ToOne = '0..1' | '1';
@@ -65,7 +76,7 @@ interface EndEntry<At extends string, C> {
65
76
  readonly candidate: C;
66
77
  }
67
78
  type EntriesAt<At, C> = At extends string ? EndEntry<At, C> : never;
68
- type ToOneEnds<S> = EdgesOf<S> extends infer E ? E extends unknown ? (CountOf<SourceOf<E>> extends ToOne ? Specific<TargetOf<E>> extends true ? EntriesAt<AcceptKeys<SourceOf<E>>, Candidate<RoleOf<TargetOf<E>>, KeyOf<E>, IsOwn<S, E>, AcceptKeys<TargetOf<E>>>> : never : never) | (CountOf<TargetOf<E>> extends ToOne ? Specific<SourceOf<E>> extends true ? EntriesAt<AcceptKeys<TargetOf<E>>, Candidate<RoleOf<SourceOf<E>>, KeyOf<E>, IsOwn<S, E>, AcceptKeys<SourceOf<E>>>> : never : never) : never : never;
79
+ type ToOneEnds<S> = EdgesOf<S> extends infer E ? E extends unknown ? (CountOf<SourceOf<E>> extends ToOne ? Specific<TargetOf<E>> extends true ? EntriesAt<AcceptKeys<SourceOf<E>>, Candidate<RoleOf<TargetOf<E>>, KeyOf<E>, IsOwn<S, E>, AcceptKeys<TargetOf<E>>, 'outgoing'>> : never : never) | (CountOf<TargetOf<E>> extends ToOne ? Specific<SourceOf<E>> extends true ? EntriesAt<AcceptKeys<TargetOf<E>>, Candidate<RoleOf<SourceOf<E>>, KeyOf<E>, IsOwn<S, E>, AcceptKeys<SourceOf<E>>, 'incoming'>> : never : never) : never : never;
69
80
  /** Every to-one end of the Domain, grouped by the Class key it accepts: computed once per Schema. */
70
81
  type EndsByClass<S> = {
71
82
  readonly [P in ToOneEnds<S> as P['at']]: P['candidate'];
@@ -90,7 +101,7 @@ type Shadowed<Cs> = Extract<Cs, {
90
101
  * ends claim names neither: its member is a message that says so.
91
102
  */
92
103
  export type RelationsOf<S, K> = Shadowed<CandidatesOf<S, Satisfies<S, K>>> extends infer Cs ? {
93
- readonly [C in Cs as Exclude<NameOf<C>, PropNamesOf<Cls<S, K>> | HandleMembers>]: Single<C> extends true ? C extends Candidate<string, infer E, boolean, infer Far> ? RelSet<S, Far & NodeClassKey<S>, E, {}, 'value', false> : never : `✗ "${NameOf<C>}" names several relations of this Class: use .via(d.<Edge>)`;
104
+ readonly [C in Cs as Exclude<NameOf<C>, PropNamesOf<Cls<S, K>> | HandleMembers>]: Single<C> extends true ? C extends Candidate<string, infer E, boolean, infer Far, infer D> ? RelSet<S, Far & NodeClassKey<S>, E, {}, 'value', false, Followed<D, Far & NodeClassKey<S>, false>> : never : `✗ "${NameOf<C>}" names several relations of this Class: use .via(d.<Edge>)`;
94
105
  } : never;
95
106
  export interface ViaOptions {
96
107
  readonly direction?: 'outgoing' | 'incoming' | 'incident';
@@ -101,6 +112,23 @@ type DirectionOf<S, K, E, O> = O extends {
101
112
  type FarKeys<S, E, Dir> = E extends unknown ? Dir extends 'outgoing' ? AcceptKeys<TargetOf<Cls<S, E>>> : Dir extends 'incoming' ? AcceptKeys<SourceOf<Cls<S, E>>> : AcceptKeys<TargetOf<Cls<S, E>>> | AcceptKeys<SourceOf<Cls<S, E>>> : never;
102
113
  /** The Class keys a `.via` reaches. */
103
114
  export type Far<S, K, E, O> = FarKeys<S, E, DirectionOf<S, K, E, O>> & NodeClassKey<S>;
115
+ /** How a `.via` is followed: one Edge, in its direction. */
116
+ export type ViaFollowed<S, K, E, O> = Followed<Extract<DirectionOf<S, K, E, O>, Direction>, Far<S, K, E, O>, false>;
117
+ type Undirected<C> = C extends {
118
+ readonly definition: {
119
+ readonly endpoints: readonly [unknown, unknown];
120
+ };
121
+ } ? true : false;
122
+ /** The ends an Edge followed in `D` leaves from: either, when undirected or followed `incident`. */
123
+ type LeftEnds<C, D> = Undirected<C> extends true ? SourceOf<C> | TargetOf<C> : D extends 'outgoing' ? SourceOf<C> : D extends 'incoming' ? TargetOf<C> : SourceOf<C> | TargetOf<C>;
124
+ /** Whether a Node of `K` may be one `End` accepts: the Class, one of its parents or subclasses. */
125
+ type Meets<S, K, End> = End extends unknown ? Touches<Satisfies<S, K>, End> extends true ? true : [Extract<Satisfies<S, AcceptKeys<End> & NodeClassKey<S>>, K>] extends [never] ? false : true : never;
126
+ /**
127
+ * Whether a relation can follow another Edge from a Node it reaches (D15): one of its Edges leaves
128
+ * from an end that may accept a Class it reaches. One member per Edge Class: a relation over
129
+ * several walks when `true` is among them.
130
+ */
131
+ export type CanWalk<S, E, F extends Followed> = E extends unknown ? true extends Meets<S, F['reached'], LeftEnds<Cls<S, E>, F['direction']>> ? true : false : never;
104
132
  /** A `.via` whose Edge has no end for this Class, or two, or reaches only foreign Classes. */
105
133
  export type ViaCheck<S, K, E, O> = E extends unknown ? DirectionOf<S, K, E, O> extends 'none' ? `✗ ${E & string} has no end that accepts this Class: read it from a Class one of its ends accepts` : DirectionOf<S, K, E, O> extends `not the ${infer End}` ? `✗ this Class is not the ${End} of ${E & string}: check the direction` : DirectionOf<S, K, E, O> extends 'ambiguous' ? `✗ both ends of ${E & string} accept this Class: pass { direction }` : [Far<S, K, E, O>] extends [never] ? `✗ ${E & string} reaches only Classes this Domain does not declare or depend on: depend on the Domain that declares them` : unknown : never;
106
134
  export {};
@@ -57,12 +57,33 @@ type Slugged = {
57
57
  export type EdgeValues<S, E> = E extends unknown ? {
58
58
  readonly $class: ClassOf<S, E>;
59
59
  } & Slugged & ValuesOf<S, E, never> : never;
60
+ /**
61
+ * Both ends of an Edge, which `$edge` names on a relation that follows one Edge or more
62
+ * (`.reachable()`): its Edge leaves a Node its walk passed through, not the row's parent.
63
+ */
64
+ export type EdgeEnds = {
65
+ readonly $source: NodeId;
66
+ readonly $target: NodeId;
67
+ };
68
+ /** An Edge the reader may not read: its slug, which traversal discloses, and the names withheld. */
69
+ type UnreadEdge<S, E> = Slugged & {
70
+ readonly $withheld: readonly PropNamesOf<Cls<S, E>>[];
71
+ };
72
+ /** `$edge` on a row `.includeWithheld()` keeps though the reader may not read its Edge. */
73
+ export type WithheldEdgeValues<S, E> = E extends unknown ? {
74
+ readonly $class: ClassOf<S, E>;
75
+ } & UnreadEdge<S, E> : never;
60
76
  type Roles<S, E> = SourceRole<S, E> | TargetRole<S, E>;
61
- /** An Edge row at the root: its slug, its values, and both ends' rows by role. */
62
- export type EdgeRootRow<S, E> = E extends unknown ? EdgeIdentity<ClassOf<S, E>> & Slugged & ValuesOf<S, E, Roles<S, E>> & {
63
- readonly [R in SourceRole<S, E>]: Row<S, SourceKeys<S, E>>;
77
+ /** An end read as values: one `.includeWithheld()` keeps may be one the reader may not read. */
78
+ type EndRow<S, K, H extends boolean> = Row<S, K> | (H extends true ? WithheldRow<S, K> : never);
79
+ /**
80
+ * An Edge row at the root: its slug, its values, and both ends' rows by role. `H` is
81
+ * `.includeWithheld()`, under which either end may be withheld.
82
+ */
83
+ export type EdgeRootRow<S, E, H extends boolean = false> = E extends unknown ? EdgeIdentity<ClassOf<S, E>> & Slugged & ValuesOf<S, E, Roles<S, E>> & {
84
+ readonly [R in SourceRole<S, E>]: EndRow<S, SourceKeys<S, E>, H>;
64
85
  } & {
65
- readonly [R in TargetRole<S, E>]: Row<S, TargetKeys<S, E>>;
86
+ readonly [R in TargetRole<S, E>]: EndRow<S, TargetKeys<S, E>, H>;
66
87
  } : never;
67
88
  /** An Edge reference row at the root (`.ref()`): both ends as references. */
68
89
  export type EdgeRootRef<S, E> = E extends unknown ? EdgeIdentity<ClassOf<S, E>> & {
@@ -70,10 +91,8 @@ export type EdgeRootRef<S, E> = E extends unknown ? EdgeIdentity<ClassOf<S, E>>
70
91
  } & {
71
92
  readonly [R in TargetRole<S, E>]: Ref<S, TargetKeys<S, E>>;
72
93
  } : never;
73
- /** An Edge the reader may not read (`.includeWithheld()`): its slug, which traversal discloses. */
74
- export type WithheldEdgeRow<S, E> = E extends unknown ? EdgeIdentity<ClassOf<S, E>> & Slugged & {
75
- readonly $withheld: readonly PropNamesOf<Cls<S, E>>[];
76
- } : never;
94
+ /** An Edge row at the root the reader may not read (`.includeWithheld()`). */
95
+ export type WithheldEdgeRow<S, E> = E extends unknown ? EdgeIdentity<ClassOf<S, E>> & UnreadEdge<S, E> : never;
77
96
  /** An Edge's identity, as a Mutation or a guard names it. */
78
97
  export interface EdgeKey<E extends string = string> {
79
98
  readonly source: NodeId;
@@ -231,11 +231,18 @@ type Where<D extends Domain> = D extends Domain ? {
231
231
  readonly op: 'source' | 'target';
232
232
  readonly operand: Where<D>;
233
233
  } : never;
234
- /** The Edges of `via` followed in `direction`, and the Node they reach. */
234
+ /**
235
+ * The Edges of `via` followed in `direction`, and the Node they reach. With `reachable` it follows
236
+ * one Edge or more: `through` holds on every Node a walk passes through, `edge` on every Edge
237
+ * followed and `node` on every Node reached. Followed `incident`, it is `distinct`.
238
+ */
235
239
  type Traversal<D extends Domain> = D extends Domain ? {
236
240
  readonly via: NonEmpty<EdgeKeys<D>>;
237
241
  readonly direction: TraversalDirection;
238
242
  readonly distinct?: boolean;
243
+ readonly reachable?: {
244
+ readonly through?: Where<D>;
245
+ };
239
246
  readonly as?: string;
240
247
  readonly edge?: Where<D>;
241
248
  readonly node?: Where<D>;
@@ -307,7 +314,7 @@ type QueryOver<D extends Domain, L extends Size> = D extends Domain ? {
307
314
  readonly count: Range<D>;
308
315
  readonly upTo: number;
309
316
  } : never;
310
- /** A Query of the Domain, as its canonical JSON: the root fold names its family. */
317
+ /** A Query of the Domain, as its canonical JSON: its family is `list`, `exists` or `count`. */
311
318
  export type Query<Source> = QueryOver<QueryDomainOf<Source>, UnsizedList>;
312
319
  /** A Query whose every list is sized by `limit`: the document a defined Query reads (W1). */
313
320
  export type SizedQuery<Source> = QueryOver<QueryDomainOf<Source>, SizedList>;
@@ -1,2 +1,2 @@
1
- /** Generated from the Kernel Schema of @astrale-os/kernel-core 1.0.0-beta.40, reduced to its Classes. Regenerate with pnpm sync:kernel-schema. */
1
+ /** Generated from the Kernel Schema of @astrale-os/kernel-core 1.0.0-beta.42, reduced to its Classes. Regenerate with pnpm sync:kernel-schema. */
2
2
  export declare const kernelCompiledSchema: string;