@dudousxd/nestjs-catalog-react 0.14.0 → 0.16.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.
@@ -0,0 +1,124 @@
1
+ /**
2
+ * Two texts, lined up, computed in this file and nowhere else.
3
+ *
4
+ * WHY THIS IS HAND-ROLLED
5
+ * -----------------------
6
+ * The two strings this console ever diffs are a transform's code and a saved
7
+ * query's SQL. Those are the most sensitive strings in the product: a transform
8
+ * is executable code with the catalog's own database reachable from it, and a
9
+ * saved query is somebody's SQL against military logistics data — the column
10
+ * names alone describe a fleet. A diff library is a dependency that gets to see
11
+ * both, on every render, and "it only renders locally" is a property of the
12
+ * version you audited rather than of the package. There is no version of this
13
+ * feature worth a supply-chain question mark on that content, so there is no
14
+ * dependency here at all: `diffLines` is forty lines of dynamic programming with
15
+ * no imports, and the whole of what it can do is visible on this screen.
16
+ *
17
+ * It is also the cheaper answer. This package already declines dependencies it
18
+ * could plausibly justify — `charts/css.tsx` draws bars with divs, `ui/button.tsx`
19
+ * hand-rolls what `class-variance-authority` would compile to, and `export/pdf.ts`
20
+ * is a seam rather than a renderer — for the same reason each time: every
21
+ * consumer pays for it whether or not they render this screen.
22
+ *
23
+ * WHAT IT DOES NOT DO
24
+ * -------------------
25
+ * No word- or character-level diff inside a changed line, and no move detection.
26
+ * A changed line is reported as a removal and an addition, which is what a
27
+ * unified diff has always done and what the renderer colours. Both are real
28
+ * improvements somebody could make; neither is the question this screen exists
29
+ * to answer, which is "which lines are different between the version that ran
30
+ * and the version that is current".
31
+ */
32
+ /**
33
+ * The largest DP table this will build, in cells.
34
+ *
35
+ * The comparison is O(n·m) in the CHANGED region only — the common prefix and
36
+ * suffix are trimmed first, so the ordinary case (somebody edited four lines of
37
+ * a three-hundred-line transform) is a handful of cells regardless of file size.
38
+ * This bound exists for the case that survives the trim: two bodies that share
39
+ * almost nothing, which is what a rewrite looks like.
40
+ *
41
+ * 1.5M cells is a `Uint32Array` of 6MB and roughly a 1,200×1,200 changed region.
42
+ * Past that the table costs more memory than the browser tab should spend on a
43
+ * comparison nobody could read anyway, so {@link diffLines} stops computing and
44
+ * SAYS it stopped — see `alignment`. A silent fallback would be the same failure
45
+ * `capLines` names one package over: a truncation nobody is told about.
46
+ */
47
+ export declare const DIFF_MAX_CELLS = 1500000;
48
+ /** What happened to one line between the two bodies. */
49
+ export type DiffOp = 'same' | 'added' | 'removed';
50
+ export interface DiffLine {
51
+ op: DiffOp;
52
+ /** 1-based line number in the earlier body. Null on an added line. */
53
+ before: number | null;
54
+ /** 1-based line number in the later body. Null on a removed line. */
55
+ after: number | null;
56
+ text: string;
57
+ }
58
+ export interface LineDiff {
59
+ lines: DiffLine[];
60
+ added: number;
61
+ removed: number;
62
+ /**
63
+ * The two bodies are byte-for-byte the same.
64
+ *
65
+ * A separate field rather than `added === 0 && removed === 0`, because the
66
+ * caller has to distinguish "these two versions are identical" from "there is
67
+ * no second version to compare against", and only one of those is a statement
68
+ * about the texts. See `RevisionDiff`, where conflating them is the exact
69
+ * thing the empty states are written to avoid.
70
+ */
71
+ identical: boolean;
72
+ /**
73
+ * How the lines were matched up.
74
+ *
75
+ * `exact` means every line was lined up against its counterpart. `coarse`
76
+ * means the changed region was past {@link DIFF_MAX_CELLS} and the whole of it
77
+ * is reported as removed-then-added — true, but blunter than it could be, and
78
+ * the screen says so rather than letting somebody read "everything changed" as
79
+ * a finding about their code.
80
+ */
81
+ alignment: 'exact' | 'coarse';
82
+ }
83
+ /**
84
+ * Line up two bodies.
85
+ *
86
+ * `before` is the earlier version, `after` the later one. The order matters to
87
+ * the reading and not to the algorithm: swapping them turns every addition into
88
+ * a removal, which is why the caller that pins "the version that ran" on the
89
+ * left is the one that gets a screen answering "what changed since".
90
+ */
91
+ export declare function diffLines(before: string, after: string): LineDiff;
92
+ /** Lines to keep either side of a change before folding the rest away. */
93
+ export declare const DIFF_CONTEXT_LINES = 3;
94
+ /**
95
+ * The smallest run worth putting a button on.
96
+ *
97
+ * Folding two lines behind a control that says "2 unchanged lines" costs a row
98
+ * to save two, and it costs a click. Below this the run is simply shown.
99
+ */
100
+ export declare const DIFF_MIN_FOLD = 4;
101
+ export type DiffSection = {
102
+ kind: 'shown';
103
+ lines: DiffLine[];
104
+ } | {
105
+ kind: 'folded';
106
+ lines: DiffLine[];
107
+ };
108
+ /**
109
+ * Collapse the long unchanged stretches, keeping context around every change.
110
+ *
111
+ * A transform can be hundreds of lines and the answer to "why did Tuesday's load
112
+ * differ from Monday's" is almost never more than a handful of them. Rendering
113
+ * all of it puts the four lines that matter somewhere in the middle of a wall
114
+ * and makes the reader scroll for them.
115
+ *
116
+ * Folded rather than dropped, and the sections carry their lines rather than a
117
+ * count, so the renderer can expand one in place. A diff that hides code with no
118
+ * way to see it is a diff you cannot trust, and this is code somebody is about
119
+ * to make a decision about.
120
+ *
121
+ * A run at the very start or end of the file gets no context on that side —
122
+ * there is no change up there to be in the context of.
123
+ */
124
+ export declare function foldUnchanged(lines: DiffLine[], context?: number, minFold?: number): DiffSection[];
@@ -0,0 +1,318 @@
1
+ /**
2
+ * Two texts, lined up, computed in this file and nowhere else.
3
+ *
4
+ * WHY THIS IS HAND-ROLLED
5
+ * -----------------------
6
+ * The two strings this console ever diffs are a transform's code and a saved
7
+ * query's SQL. Those are the most sensitive strings in the product: a transform
8
+ * is executable code with the catalog's own database reachable from it, and a
9
+ * saved query is somebody's SQL against military logistics data — the column
10
+ * names alone describe a fleet. A diff library is a dependency that gets to see
11
+ * both, on every render, and "it only renders locally" is a property of the
12
+ * version you audited rather than of the package. There is no version of this
13
+ * feature worth a supply-chain question mark on that content, so there is no
14
+ * dependency here at all: `diffLines` is forty lines of dynamic programming with
15
+ * no imports, and the whole of what it can do is visible on this screen.
16
+ *
17
+ * It is also the cheaper answer. This package already declines dependencies it
18
+ * could plausibly justify — `charts/css.tsx` draws bars with divs, `ui/button.tsx`
19
+ * hand-rolls what `class-variance-authority` would compile to, and `export/pdf.ts`
20
+ * is a seam rather than a renderer — for the same reason each time: every
21
+ * consumer pays for it whether or not they render this screen.
22
+ *
23
+ * WHAT IT DOES NOT DO
24
+ * -------------------
25
+ * No word- or character-level diff inside a changed line, and no move detection.
26
+ * A changed line is reported as a removal and an addition, which is what a
27
+ * unified diff has always done and what the renderer colours. Both are real
28
+ * improvements somebody could make; neither is the question this screen exists
29
+ * to answer, which is "which lines are different between the version that ran
30
+ * and the version that is current".
31
+ */
32
+ /**
33
+ * The largest DP table this will build, in cells.
34
+ *
35
+ * The comparison is O(n·m) in the CHANGED region only — the common prefix and
36
+ * suffix are trimmed first, so the ordinary case (somebody edited four lines of
37
+ * a three-hundred-line transform) is a handful of cells regardless of file size.
38
+ * This bound exists for the case that survives the trim: two bodies that share
39
+ * almost nothing, which is what a rewrite looks like.
40
+ *
41
+ * 1.5M cells is a `Uint32Array` of 6MB and roughly a 1,200×1,200 changed region.
42
+ * Past that the table costs more memory than the browser tab should spend on a
43
+ * comparison nobody could read anyway, so {@link diffLines} stops computing and
44
+ * SAYS it stopped — see `alignment`. A silent fallback would be the same failure
45
+ * `capLines` names one package over: a truncation nobody is told about.
46
+ */
47
+ export const DIFF_MAX_CELLS = 1_500_000;
48
+ /**
49
+ * Split on `\n` alone, and keep whatever that leaves.
50
+ *
51
+ * A lone `\r` therefore stays inside the line text, so a body that changed from
52
+ * CRLF to LF reports every line as changed. That is noisy and it is also true:
53
+ * the stored bodies differ on every line, a connector pinned to the old version
54
+ * would run different bytes, and a diff that normalised the endings away would
55
+ * be answering a question nobody asked ("would these be the same if…") in place
56
+ * of the one they did.
57
+ *
58
+ * An empty body is zero lines rather than one empty line, so writing the first
59
+ * version of a transform reads as N additions rather than N additions and one
60
+ * mysterious deletion. A body ending in a newline genuinely does have a trailing
61
+ * empty line and keeps it.
62
+ */
63
+ function splitLines(text) {
64
+ return text.length === 0 ? [] : text.split('\n');
65
+ }
66
+ /**
67
+ * Line up two bodies.
68
+ *
69
+ * `before` is the earlier version, `after` the later one. The order matters to
70
+ * the reading and not to the algorithm: swapping them turns every addition into
71
+ * a removal, which is why the caller that pins "the version that ran" on the
72
+ * left is the one that gets a screen answering "what changed since".
73
+ */
74
+ export function diffLines(before, after) {
75
+ const beforeLines = splitLines(before);
76
+ const afterLines = splitLines(after);
77
+ if (before === after) {
78
+ return {
79
+ lines: beforeLines.map((text, index) => ({
80
+ op: 'same',
81
+ before: index + 1,
82
+ after: index + 1,
83
+ text,
84
+ })),
85
+ added: 0,
86
+ removed: 0,
87
+ identical: true,
88
+ alignment: 'exact',
89
+ };
90
+ }
91
+ // The trim, which is what makes this cheap on the case that actually happens.
92
+ // A four-line edit inside a three-hundred-line transform leaves a DP table of
93
+ // sixteen cells; without it, ninety thousand.
94
+ let head = 0;
95
+ while (head < beforeLines.length &&
96
+ head < afterLines.length &&
97
+ beforeLines[head] === afterLines[head]) {
98
+ head += 1;
99
+ }
100
+ let tail = 0;
101
+ while (tail < beforeLines.length - head &&
102
+ tail < afterLines.length - head &&
103
+ beforeLines[beforeLines.length - 1 - tail] === afterLines[afterLines.length - 1 - tail]) {
104
+ tail += 1;
105
+ }
106
+ const beforeMiddle = beforeLines.slice(head, beforeLines.length - tail);
107
+ const afterMiddle = afterLines.slice(head, afterLines.length - tail);
108
+ const middle = beforeMiddle.length * afterMiddle.length > DIFF_MAX_CELLS
109
+ ? coarse(beforeMiddle, afterMiddle, head)
110
+ : align(beforeMiddle, afterMiddle, head);
111
+ const lines = [
112
+ ...beforeLines.slice(0, head).map((text, index) => sameLine(text, index + 1, index + 1)),
113
+ ...middle.lines,
114
+ ...beforeLines
115
+ .slice(beforeLines.length - tail)
116
+ .map((text, index) => sameLine(text, beforeLines.length - tail + index + 1, afterLines.length - tail + index + 1)),
117
+ ];
118
+ return {
119
+ lines,
120
+ added: middle.added,
121
+ removed: middle.removed,
122
+ identical: false,
123
+ alignment: middle.alignment,
124
+ };
125
+ }
126
+ function sameLine(text, before, after) {
127
+ return { op: 'same', before, after, text };
128
+ }
129
+ /**
130
+ * The longest common subsequence of two line arrays, walked into a diff.
131
+ *
132
+ * The table is filled from the end so the walk can go forwards, which is what
133
+ * keeps the output in file order without a reversal at the end. `Uint32Array`
134
+ * rather than nested arrays because the table is the only thing here that has a
135
+ * size worth thinking about, and a flat typed array is one allocation.
136
+ *
137
+ * When neither direction is better the walk prefers the REMOVAL, which is what
138
+ * puts every deleted line of a hunk above every added one — the unified-diff
139
+ * order, and the order the renderer's red-then-green block depends on.
140
+ */
141
+ function align(beforeMiddle, afterMiddle, offset) {
142
+ const m = beforeMiddle.length;
143
+ const n = afterMiddle.length;
144
+ const width = n + 1;
145
+ const table = lcsTable(beforeMiddle, afterMiddle);
146
+ const lines = [];
147
+ let added = 0;
148
+ let removed = 0;
149
+ let i = 0;
150
+ let j = 0;
151
+ while (i < m && j < n) {
152
+ if (beforeMiddle[i] === afterMiddle[j]) {
153
+ lines.push(sameLine(beforeMiddle[i] ?? '', offset + i + 1, offset + j + 1));
154
+ i += 1;
155
+ j += 1;
156
+ }
157
+ else if ((table[(i + 1) * width + j] ?? 0) >= (table[i * width + j + 1] ?? 0)) {
158
+ lines.push(removedLine(beforeMiddle[i] ?? '', offset + i + 1));
159
+ removed += 1;
160
+ i += 1;
161
+ }
162
+ else {
163
+ lines.push(addedLine(afterMiddle[j] ?? '', offset + j + 1));
164
+ added += 1;
165
+ j += 1;
166
+ }
167
+ }
168
+ // Whatever is left when one side runs out. Removals first, again, so a hunk at
169
+ // the very end of the file reads the same way as one in the middle.
170
+ const tail = drain(beforeMiddle.slice(i), afterMiddle.slice(j), offset + i, offset + j);
171
+ lines.push(...tail.lines);
172
+ return {
173
+ lines,
174
+ added: added + tail.added,
175
+ removed: removed + tail.removed,
176
+ alignment: 'exact',
177
+ };
178
+ }
179
+ /**
180
+ * The remainder of one side, once the walk has exhausted the other.
181
+ *
182
+ * At most one of these two arrays is non-empty — the walk only stops when an
183
+ * index reaches its end — so this is not a second comparison. It is the same
184
+ * shape as {@link coarse}, and calling that would have been tempting; it is
185
+ * separate because `coarse` means "we declined to line these up" and this means
186
+ * "there was nothing left to line them up against", and a screen that reads
187
+ * `alignment` must not be told the first when the second happened.
188
+ */
189
+ function drain(beforeRest, afterRest, beforeOffset, afterOffset) {
190
+ return {
191
+ lines: [
192
+ ...beforeRest.map((text, index) => removedLine(text, beforeOffset + index + 1)),
193
+ ...afterRest.map((text, index) => addedLine(text, afterOffset + index + 1)),
194
+ ],
195
+ added: afterRest.length,
196
+ removed: beforeRest.length,
197
+ };
198
+ }
199
+ /**
200
+ * `table[i * width + j]` is the length of the longest common subsequence of
201
+ * `a.slice(i)` and `b.slice(j)`.
202
+ *
203
+ * Filled from the END, which is what lets {@link align} walk forwards and emit
204
+ * lines already in file order rather than reversing at the finish.
205
+ */
206
+ function lcsTable(a, b) {
207
+ const width = b.length + 1;
208
+ const table = new Uint32Array((a.length + 1) * width);
209
+ for (let i = a.length - 1; i >= 0; i -= 1) {
210
+ for (let j = b.length - 1; j >= 0; j -= 1) {
211
+ table[i * width + j] =
212
+ a[i] === b[j]
213
+ ? (table[(i + 1) * width + j + 1] ?? 0) + 1
214
+ : Math.max(table[(i + 1) * width + j] ?? 0, table[i * width + j + 1] ?? 0);
215
+ }
216
+ }
217
+ return table;
218
+ }
219
+ function removedLine(text, before) {
220
+ return { op: 'removed', before, after: null, text };
221
+ }
222
+ function addedLine(text, after) {
223
+ return { op: 'added', before: null, after, text };
224
+ }
225
+ /** The whole changed region as one removal and one addition. See {@link DIFF_MAX_CELLS}. */
226
+ function coarse(beforeMiddle, afterMiddle, offset) {
227
+ return {
228
+ lines: [
229
+ ...beforeMiddle.map((text, index) => ({
230
+ op: 'removed',
231
+ before: offset + index + 1,
232
+ after: null,
233
+ text,
234
+ })),
235
+ ...afterMiddle.map((text, index) => ({
236
+ op: 'added',
237
+ before: null,
238
+ after: offset + index + 1,
239
+ text,
240
+ })),
241
+ ],
242
+ added: afterMiddle.length,
243
+ removed: beforeMiddle.length,
244
+ alignment: 'coarse',
245
+ };
246
+ }
247
+ /** Lines to keep either side of a change before folding the rest away. */
248
+ export const DIFF_CONTEXT_LINES = 3;
249
+ /**
250
+ * The smallest run worth putting a button on.
251
+ *
252
+ * Folding two lines behind a control that says "2 unchanged lines" costs a row
253
+ * to save two, and it costs a click. Below this the run is simply shown.
254
+ */
255
+ export const DIFF_MIN_FOLD = 4;
256
+ /**
257
+ * Collapse the long unchanged stretches, keeping context around every change.
258
+ *
259
+ * A transform can be hundreds of lines and the answer to "why did Tuesday's load
260
+ * differ from Monday's" is almost never more than a handful of them. Rendering
261
+ * all of it puts the four lines that matter somewhere in the middle of a wall
262
+ * and makes the reader scroll for them.
263
+ *
264
+ * Folded rather than dropped, and the sections carry their lines rather than a
265
+ * count, so the renderer can expand one in place. A diff that hides code with no
266
+ * way to see it is a diff you cannot trust, and this is code somebody is about
267
+ * to make a decision about.
268
+ *
269
+ * A run at the very start or end of the file gets no context on that side —
270
+ * there is no change up there to be in the context of.
271
+ */
272
+ export function foldUnchanged(lines, context = DIFF_CONTEXT_LINES, minFold = DIFF_MIN_FOLD) {
273
+ const sections = [];
274
+ let shown = [];
275
+ const flush = () => {
276
+ if (shown.length > 0) {
277
+ sections.push({ kind: 'shown', lines: shown });
278
+ shown = [];
279
+ }
280
+ };
281
+ let index = 0;
282
+ while (index < lines.length) {
283
+ const line = lines[index];
284
+ if (!line)
285
+ break;
286
+ if (line.op !== 'same') {
287
+ shown.push(line);
288
+ index += 1;
289
+ continue;
290
+ }
291
+ const end = runEnd(lines, index);
292
+ const run = lines.slice(index, end);
293
+ // No context on a side there is no change on: a run touching the start of
294
+ // the file has nothing above it to be the context of, and neither does one
295
+ // touching the end.
296
+ const leading = index === 0 ? 0 : context;
297
+ const trailing = end === lines.length ? 0 : context;
298
+ if (run.length > leading + trailing + minFold) {
299
+ shown.push(...run.slice(0, leading));
300
+ flush();
301
+ sections.push({ kind: 'folded', lines: run.slice(leading, run.length - trailing) });
302
+ shown.push(...run.slice(run.length - trailing));
303
+ }
304
+ else {
305
+ shown.push(...run);
306
+ }
307
+ index = end;
308
+ }
309
+ flush();
310
+ return sections;
311
+ }
312
+ /** Where the run of unchanged lines starting at `start` stops. */
313
+ function runEnd(lines, start) {
314
+ let end = start;
315
+ while (end < lines.length && lines[end]?.op === 'same')
316
+ end += 1;
317
+ return end;
318
+ }
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { CatalogManager, type CatalogManagerProps } from './CatalogManager';
2
2
  export { CoverageLedger } from './CoverageLedger';
3
3
  export { EditableField } from './EditableField';
4
+ export { DELETE_STRATEGIES, LoadExpectationSection, type LoadExpectationSectionProps, } from './LoadExpectationSection';
4
5
  export { cn } from './cn';
5
6
  export { ObjectExplorer, type ObjectExplorerProps } from './ObjectExplorer';
6
7
  export { DashboardBoard } from './DashboardBoard';
@@ -17,11 +18,13 @@ export { CATALOG_EVENT_META, type CatalogTraceSource, eventMeta, TraceExplorer,
17
18
  export { ConnectionPanel, type ConnectionPanelProps, connectionOptionsFor, describeConnection, } from './ConnectionPanel';
18
19
  export { type ColumnChoice, type ConnectorSchemaDiscovery, type DiscoveredColumn, type DiscoveredTypeDraft, initialChoices, PipelineConsole, type PipelineConsoleProps, proposalFrom, type SchemaDiscoveryBridge, type SchemaDrift, } from './PipelineConsole';
19
20
  export { TransformEditor, type TransformEditorProps } from './TransformEditor';
21
+ export { DiffBody, RevisionHistory, type RevisionHistoryProps, RevisionHistoryButton, RevisionHistorySheet, type RevisionHistorySheetProps, type RevisionSubject, type RevisionSubjectKind, } from './diff/RevisionDiff';
22
+ export { DIFF_CONTEXT_LINES, DIFF_MAX_CELLS, DIFF_MIN_FOLD, type DiffLine, type DiffOp, type DiffSection, diffLines, foldUnchanged, type LineDiff, } from './diff/line-diff';
20
23
  export { AccessConsole, type AccessConsoleProps } from './AccessConsole';
21
24
  export { type CatalogWorkflow, describeDurability, type DurabilityCopy, isWorkflowNodeKind, newLocalId, nodeName, producedTypes, WORKFLOW_NODE_ID_PATTERN, WORKFLOW_NODE_KINDS, type WorkflowDurability, type WorkflowEdge, type WorkflowGraph, type WorkflowInput, type WorkflowNode, type WorkflowNodeKind, type WorkflowRun, type WorkflowRunNode, type WorkflowSinkNode, type WorkflowSourceNode, type WorkflowTransformNode, } from './workflow/model';
22
25
  export { WORKFLOW_NAME } from './workflow/name';
23
26
  export { canConnect, type ConnectionVerdict, edgeId, hasBlockingProblem, problemsByNode, type ValidateOptions, validateWorkflow, type WorkflowDraft, type WorkflowProblem, type WorkflowProblemCode, type WorkflowProblemLevel, wouldCycle, } from './workflow/validate';
24
- export { type CatalogClient, type CatalogIdentity, type CatalogPeoplePage, type CatalogPersonRole, type CatalogPersonSummary, type CatalogPrincipalSummary, CatalogProvider, type CatalogProviderProps, type CatalogTransport, type ConnectionInput, type ConnectorInput, catalogQueryKeys, type PersonInput, type PersonUpsertResult, type PipelineCapabilities, type TransformInput, useCatalogClient, } from './context';
27
+ export { type CatalogClient, type CatalogIdentity, type CatalogRevision, type CatalogPeoplePage, type CatalogPersonRole, type CatalogPersonSummary, type CatalogPrincipalSummary, CatalogProvider, type CatalogProviderProps, type CatalogTransport, type ConnectionInput, type ConnectorInput, catalogQueryKeys, type DeleteReconciliation, type LoadExpectation, type LoadExpectationInput, type ResolvedLoadExpectation, type RowCountBound, type StoredLoadExpectation, type PersonInput, type PersonUpsertResult, type PipelineCapabilities, type TransformInput, useCatalogClient, } from './context';
25
28
  export { type AccessRoutes, accessRoutes, DEFAULT_ACCESS_BASE_PATH, DEFAULT_PIPELINE_BASE_PATH, DEFAULT_PUBLISH_BASE_PATH, embedRoutes, type PeopleQuery, type PipelineRoutes, pipelineRoutes, } from './routes';
26
29
  export { ConfirmDialog } from './ui/dialog';
27
30
  export { FieldGroup, TextAreaField, TextField } from './ui/field';
package/dist/index.js CHANGED
@@ -1,6 +1,10 @@
1
1
  export { CatalogManager } from './CatalogManager';
2
2
  export { CoverageLedger } from './CoverageLedger';
3
3
  export { EditableField } from './EditableField';
4
+ // Mounted on the Model screen already. Exported because a host that builds its
5
+ // own type panel out of this package's parts should not have to rebuild the one
6
+ // section that can say an incremental load of a type is currently refused.
7
+ export { DELETE_STRATEGIES, LoadExpectationSection, } from './LoadExpectationSection';
4
8
  export { cn } from './cn';
5
9
  export { ObjectExplorer } from './ObjectExplorer';
6
10
  export { DashboardBoard } from './DashboardBoard';
@@ -41,6 +45,20 @@ export { ConnectionPanel, connectionOptionsFor, describeConnection, } from './Co
41
45
  // worth nothing there if the only way to run them is to render it.
42
46
  export { initialChoices, PipelineConsole, proposalFrom, } from './PipelineConsole';
43
47
  export { TransformEditor } from './TransformEditor';
48
+ // Why one load came out different from the last one.
49
+ //
50
+ // The screens above already carry their own way in — the transform editor, the
51
+ // saved-query list, and the `code v3` on a connector run — so a host mounting
52
+ // this console needs none of this. It is exported for the host that wants the
53
+ // comparison somewhere else: beside its own deploy log, in an approval flow, or
54
+ // on a page this package does not ship.
55
+ //
56
+ // `diffLines` and `foldUnchanged` are pure and come with it deliberately. They
57
+ // are the whole of the algorithm, they take no dependency and reach no network,
58
+ // and a host that wants to render a comparison its own way should not have to
59
+ // choose between this package's markup and writing an LCS.
60
+ export { DiffBody, RevisionHistory, RevisionHistoryButton, RevisionHistorySheet, } from './diff/RevisionDiff';
61
+ export { DIFF_CONTEXT_LINES, DIFF_MAX_CELLS, DIFF_MIN_FOLD, diffLines, foldUnchanged, } from './diff/line-diff';
44
62
  export { AccessConsole } from './AccessConsole';
45
63
  // The authored graph: sources wired through transforms into sinks.
46
64
  //
package/dist/routes.d.ts CHANGED
@@ -2,22 +2,35 @@
2
2
  * The paths behind the pipeline and access screens — and, for now, the embed
3
3
  * components, which are the documented exception at the top of the file.
4
4
  *
5
- * These deliberately do **not** live in `@dudousxd/nestjs-catalog/client` beside
6
- * `catalogRoutes`, and the difference is worth being precise about, because it
7
- * is the difference between a route builder that is a promise and one that is a
8
- * guess.
5
+ * Most of these deliberately do **not** live in
6
+ * `@dudousxd/nestjs-catalog/client` beside `catalogRoutes`, and the difference
7
+ * is worth being precise about, because it is the difference between a route
8
+ * builder that is a promise and one that is a default.
9
9
  *
10
- * `catalogRoutes` describes paths the catalog library's own controller serves.
11
- * Install the library, register the module, and `/catalog/objects/...` exists —
12
- * the builder is the library documenting itself, and it cannot be wrong.
10
+ * `catalogRoutes` is a frozen object of builders that take no base path: the
11
+ * paths the catalog library's own controller serves, at the segment it serves
12
+ * them under. Install the library, register the module, and
13
+ * `/catalog/objects/...` exists — the builder is the library documenting itself.
13
14
  *
14
- * Connectors, transforms and access are the other shape. The library defines
15
- * their *model* — `CatalogPipelineStore`, `CatalogConnection`, `CatalogPrincipal`
16
- * — but ships no controller for any of them, because how a deployment exposes
17
- * the code that reshapes its data, and who may create an account, are decisions
18
- * that belong to the deployment. Putting `pipelineRoutes` next to `catalogRoutes`
19
- * would tell a reader that installing the library makes `/pipeline/connectors`
20
- * answer, and it does not: they would get a 404 with nothing to point at.
15
+ * Connectors, transforms and access are the other shape, and what makes them so
16
+ * is not that nothing serves them. It is that WHERE they are served is the
17
+ * host's decision, which a frozen builder cannot express:
18
+ *
19
+ * - Connectors, transforms, workflows and runs are served by
20
+ * `createPipelineController`, which ships in
21
+ * `@dudousxd/nestjs-catalog-pipeline` — a *separate* package, mounted under
22
+ * whatever `path` its `forRoot` was given, and mounted nowhere at all if it
23
+ * was given none. Installing `@dudousxd/nestjs-catalog` does not make
24
+ * `/pipeline/connectors` answer, so putting `pipelineRoutes` beside
25
+ * `catalogRoutes` would tell a reader it does, and they would get a 404 with
26
+ * nothing to point at.
27
+ * - Access is the one that used to be described here as having no controller
28
+ * either, and it does have one: `createAccessController` is in the catalog
29
+ * library and `CatalogModule.forRoot` mounts it unless the host passes
30
+ * `controller: false`. What it does not have is a fixed path — it mounts
31
+ * under `accessPath`, a sibling of the catalog's own mount point — so it is
32
+ * still a default rather than a promise, for the second reason rather than
33
+ * the first.
21
34
  *
22
35
  * So the builders live here, in the package that ships the screens that need
23
36
  * them, and are stated as a *default* the host can move. The defaults are
@@ -25,6 +38,19 @@
25
38
  * `/api/pipeline` — because the transport is what knows the API prefix, and a
26
39
  * screen that hardcoded one app's mount point would be unusable in the next app.
27
40
  *
41
+ * The two load-expectation paths are the case that says what the rule above
42
+ * really is. They are served by that same pipeline controller in that same
43
+ * separate package, yet their builder — `pipelineExpectationRoutes` — is in
44
+ * `@dudousxd/nestjs-catalog/client`, and `pipelineRoutes` below borrows it
45
+ * instead of writing the strings again. That is not an exception, because the
46
+ * test was never which package a builder lives in: it is whether the builder
47
+ * takes a base path. `pipelineExpectationRoutes` does, so it promises nothing
48
+ * about where the routes are mounted no matter where it sits. It sits there
49
+ * because the wire types it goes with — `LoadExpectationInput`,
50
+ * `ResolvedLoadExpectation` — are declared in that entry point and the pipeline
51
+ * controller reads them from there too, and a path split from the shapes it
52
+ * returns is how the two halves of one contract come to be moved separately.
53
+ *
28
54
  * What this package therefore asks of a host is an HTTP surface with these
29
55
  * shapes, wherever it wants to mount it. That contract is the response types on
30
56
  * `CatalogClient` plus these paths, and a host that would rather satisfy it from
@@ -92,6 +118,21 @@ export interface PipelineRoutes {
92
118
  runs(): string;
93
119
  transforms(): string;
94
120
  transform(id: string): string;
121
+ /**
122
+ * Every version of a transform's code that was ever saved, newest first.
123
+ *
124
+ * A sub-resource of the transform rather than a `?version=` on it, because the
125
+ * question this answers is "what were all of them" — a screen comparing the
126
+ * version that ran against the version that is current has to see the list
127
+ * before it knows which two ids to name, and one request that answers that is
128
+ * cheaper than a list request plus two fetches.
129
+ *
130
+ * `CatalogTransform.version` is a counter over a row that is overwritten in
131
+ * place, so before this route existed the number on a run — `code v3` in the
132
+ * runs list — named code that no longer existed anywhere. The version stayed
133
+ * traceable and the code did not.
134
+ */
135
+ transformRevisions(id: string): string;
95
136
  tryTransform(): string;
96
137
  /**
97
138
  * Authored graphs of transforms. GET lists, POST creates or updates.
@@ -106,6 +147,25 @@ export interface PipelineRoutes {
106
147
  workflows(): string;
107
148
  workflow(id: string): string;
108
149
  runWorkflow(id: string): string;
150
+ /**
151
+ * Every per-type load expectation an operator has stored.
152
+ *
153
+ * Keyed by object type and nothing else. A connector, a workflow sink and an
154
+ * application POSTing to the publish API all end at the same publish methods
155
+ * and all have the same delete problem, so a per-connector route would have
156
+ * given one dataset two answers to one question.
157
+ */
158
+ loadExpectations(): string;
159
+ /**
160
+ * One type's expectation. GET resolves it and says where each field came
161
+ * from; PUT stores one; DELETE drops the stored row and leaves the host's.
162
+ *
163
+ * The GET answers a merge rather than the stored row, because the stored row
164
+ * alone cannot tell a screen whether it is the one in force — a host that
165
+ * declared the same type in code wins, and a screen that showed the stored
166
+ * value would offer an edit that is refused.
167
+ */
168
+ loadExpectation(typeName: string): string;
109
169
  }
110
170
  export declare function pipelineRoutes(basePath?: string): PipelineRoutes;
111
171
  export interface AccessRoutes {