yarramate 1.28.0 → 1.30.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.
@@ -37,6 +37,20 @@ export interface VisualQuestionEntry {
37
37
  */
38
38
  readonly trigger?: readonly CatalogueCondition[];
39
39
  }
40
+ /**
41
+ * The next load-bearing open question (#534, ADR 0154): the row `design`
42
+ * would serve first, by design's own rule (the first open question in wave
43
+ * order, then catalogue order within the wave; a subject-scoped question
44
+ * names the first open subject it is open for). Computed host-side beside
45
+ * the overlay so both hosts and the browser agree on which row it is, and
46
+ * nobody re-derives the rule from the lists.
47
+ */
48
+ export interface VisualNextQuestion extends VisualQuestionEntry {
49
+ readonly wave: string;
50
+ /** The subject it is open for; absent for a workspace-scoped question. */
51
+ readonly subjectId?: string;
52
+ readonly subjectName?: string;
53
+ }
40
54
  /**
41
55
  * The interrogation report, folded for drawing (#292).
42
56
  *
@@ -48,6 +62,13 @@ export interface VisualQuestionEntry {
48
62
  export interface VisualInterrogationOverlay {
49
63
  /** `id@version` of the catalogue that asked. */
50
64
  readonly catalogue: string;
65
+ /**
66
+ * Every catalogue in the composed set, `id@version` each, in resolution
67
+ * order (#530, ADR 0129) - present only when composition happened, the way
68
+ * the report carries it. The footer names them all; `catalogue` alone is
69
+ * the base and stays for readers that predate this.
70
+ */
71
+ readonly catalogues?: readonly string[];
51
72
  /** Engine condition-semantics version (ADR 0106), carried so a consumer
52
73
  * can tell "the model moved" from "the engine moved". */
53
74
  readonly semantics: string;
@@ -56,6 +77,12 @@ export interface VisualInterrogationOverlay {
56
77
  readonly workspace: readonly VisualQuestionEntry[];
57
78
  /** Open questions per qualified subject id — `CanvasNode.id`'s space. */
58
79
  readonly subjects: Readonly<Record<string, readonly VisualQuestionEntry[]>>;
80
+ /**
81
+ * The one to ask next (#534). Absent when nothing is open, or when the
82
+ * host that built this overlay predates the field: a reader treats absence
83
+ * as "no next question", never as a fault.
84
+ */
85
+ readonly next?: VisualNextQuestion;
59
86
  }
60
87
  /** The resolved graph a session renders, as the browser receives it. */
61
88
  export interface VisualRenderedModel {
@@ -132,6 +132,10 @@ dismissed = []) => {
132
132
  .map(({ questionId, subject }) => `${questionId}\u0000${subject}`));
133
133
  const workspace = [];
134
134
  const subjects = {};
135
+ // The first row kept is the next question (#534): the loop already walks
136
+ // waves in order and questions in catalogue order, which is `design`'s
137
+ // rule, so "first kept" is the rule and not a second one.
138
+ let next;
135
139
  for (const wave of report.waves) {
136
140
  for (const question of wave.questions) {
137
141
  if (!question.open)
@@ -149,30 +153,41 @@ dismissed = []) => {
149
153
  trigger: question.trigger,
150
154
  };
151
155
  if (question.subjects === undefined) {
152
- workspace.push({
156
+ const row = {
153
157
  ...base,
154
158
  scope: "workspace",
155
159
  question: question.question,
156
- });
160
+ };
161
+ workspace.push(row);
162
+ next ??= { ...row, wave: wave.id };
157
163
  continue;
158
164
  }
159
165
  for (const subject of question.subjects) {
160
166
  if (dismissedForSubject.has(`${question.id}\u0000${subject.id}`)) {
161
167
  continue;
162
168
  }
163
- (subjects[subject.id] ??= []).push({
169
+ const row = {
164
170
  ...base,
165
171
  scope: "subject",
166
172
  question: subject.question,
167
- });
173
+ };
174
+ (subjects[subject.id] ??= []).push(row);
175
+ next ??= {
176
+ ...row,
177
+ wave: wave.id,
178
+ subjectId: subject.id,
179
+ ...(subject.name === undefined ? {} : { subjectName: subject.name }),
180
+ };
168
181
  }
169
182
  }
170
183
  }
171
184
  return {
172
185
  catalogue: report.catalogue,
186
+ ...(report.catalogues === undefined ? {} : { catalogues: report.catalogues }),
173
187
  semantics: report.semantics,
174
188
  workspace,
175
189
  subjects,
190
+ ...(next === undefined ? {} : { next }),
176
191
  };
177
192
  };
178
193
  /**