@dudousxd/nestjs-catalog-react 0.13.0 → 0.15.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.
- package/dist/ConnectionPanel.js +21 -2
- package/dist/PipelineConsole.js +88 -18
- package/dist/SavedQueryPanel.js +14 -2
- package/dist/TransformEditor.js +8 -1
- package/dist/WorkflowCanvas.js +670 -35
- package/dist/context.d.ts +57 -1
- package/dist/context.js +12 -0
- package/dist/diff/RevisionDiff.d.ts +63 -0
- package/dist/diff/RevisionDiff.js +279 -0
- package/dist/diff/line-diff.d.ts +124 -0
- package/dist/diff/line-diff.js +318 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +14 -0
- package/dist/routes.d.ts +15 -0
- package/dist/routes.js +17 -0
- package/package.json +2 -2
|
@@ -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
|
@@ -17,11 +17,13 @@ export { CATALOG_EVENT_META, type CatalogTraceSource, eventMeta, TraceExplorer,
|
|
|
17
17
|
export { ConnectionPanel, type ConnectionPanelProps, connectionOptionsFor, describeConnection, } from './ConnectionPanel';
|
|
18
18
|
export { type ColumnChoice, type ConnectorSchemaDiscovery, type DiscoveredColumn, type DiscoveredTypeDraft, initialChoices, PipelineConsole, type PipelineConsoleProps, proposalFrom, type SchemaDiscoveryBridge, type SchemaDrift, } from './PipelineConsole';
|
|
19
19
|
export { TransformEditor, type TransformEditorProps } from './TransformEditor';
|
|
20
|
+
export { DiffBody, RevisionHistory, type RevisionHistoryProps, RevisionHistoryButton, RevisionHistorySheet, type RevisionHistorySheetProps, type RevisionSubject, type RevisionSubjectKind, } from './diff/RevisionDiff';
|
|
21
|
+
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
22
|
export { AccessConsole, type AccessConsoleProps } from './AccessConsole';
|
|
21
23
|
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
24
|
export { WORKFLOW_NAME } from './workflow/name';
|
|
23
25
|
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';
|
|
26
|
+
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 PersonInput, type PersonUpsertResult, type PipelineCapabilities, type TransformInput, useCatalogClient, } from './context';
|
|
25
27
|
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
28
|
export { ConfirmDialog } from './ui/dialog';
|
|
27
29
|
export { FieldGroup, TextAreaField, TextField } from './ui/field';
|
package/dist/index.js
CHANGED
|
@@ -41,6 +41,20 @@ export { ConnectionPanel, connectionOptionsFor, describeConnection, } from './Co
|
|
|
41
41
|
// worth nothing there if the only way to run them is to render it.
|
|
42
42
|
export { initialChoices, PipelineConsole, proposalFrom, } from './PipelineConsole';
|
|
43
43
|
export { TransformEditor } from './TransformEditor';
|
|
44
|
+
// Why one load came out different from the last one.
|
|
45
|
+
//
|
|
46
|
+
// The screens above already carry their own way in — the transform editor, the
|
|
47
|
+
// saved-query list, and the `code v3` on a connector run — so a host mounting
|
|
48
|
+
// this console needs none of this. It is exported for the host that wants the
|
|
49
|
+
// comparison somewhere else: beside its own deploy log, in an approval flow, or
|
|
50
|
+
// on a page this package does not ship.
|
|
51
|
+
//
|
|
52
|
+
// `diffLines` and `foldUnchanged` are pure and come with it deliberately. They
|
|
53
|
+
// are the whole of the algorithm, they take no dependency and reach no network,
|
|
54
|
+
// and a host that wants to render a comparison its own way should not have to
|
|
55
|
+
// choose between this package's markup and writing an LCS.
|
|
56
|
+
export { DiffBody, RevisionHistory, RevisionHistoryButton, RevisionHistorySheet, } from './diff/RevisionDiff';
|
|
57
|
+
export { DIFF_CONTEXT_LINES, DIFF_MAX_CELLS, DIFF_MIN_FOLD, diffLines, foldUnchanged, } from './diff/line-diff';
|
|
44
58
|
export { AccessConsole } from './AccessConsole';
|
|
45
59
|
// The authored graph: sources wired through transforms into sinks.
|
|
46
60
|
//
|
package/dist/routes.d.ts
CHANGED
|
@@ -92,6 +92,21 @@ export interface PipelineRoutes {
|
|
|
92
92
|
runs(): string;
|
|
93
93
|
transforms(): string;
|
|
94
94
|
transform(id: string): string;
|
|
95
|
+
/**
|
|
96
|
+
* Every version of a transform's code that was ever saved, newest first.
|
|
97
|
+
*
|
|
98
|
+
* A sub-resource of the transform rather than a `?version=` on it, because the
|
|
99
|
+
* question this answers is "what were all of them" — a screen comparing the
|
|
100
|
+
* version that ran against the version that is current has to see the list
|
|
101
|
+
* before it knows which two ids to name, and one request that answers that is
|
|
102
|
+
* cheaper than a list request plus two fetches.
|
|
103
|
+
*
|
|
104
|
+
* `CatalogTransform.version` is a counter over a row that is overwritten in
|
|
105
|
+
* place, so before this route existed the number on a run — `code v3` in the
|
|
106
|
+
* runs list — named code that no longer existed anywhere. The version stayed
|
|
107
|
+
* traceable and the code did not.
|
|
108
|
+
*/
|
|
109
|
+
transformRevisions(id: string): string;
|
|
95
110
|
tryTransform(): string;
|
|
96
111
|
/**
|
|
97
112
|
* Authored graphs of transforms. GET lists, POST creates or updates.
|
package/dist/routes.js
CHANGED
|
@@ -53,6 +53,22 @@ export const embedRoutes = {
|
|
|
53
53
|
chart: (id) => `/catalog/embed/charts/${encodeURIComponent(id)}`,
|
|
54
54
|
dashboard: (id) => `/catalog/embed/dashboards/${encodeURIComponent(id)}`,
|
|
55
55
|
};
|
|
56
|
+
/*
|
|
57
|
+
* A saved query's history is deliberately NOT here.
|
|
58
|
+
*
|
|
59
|
+
* `GET /catalog/saved-queries/:id/revisions` is served by the catalog library's
|
|
60
|
+
* own controller, so by this file's header it belongs beside `catalogRoutes` —
|
|
61
|
+
* and that is where it is: `catalogRoutes.savedQueryRevisions`. The note is here
|
|
62
|
+
* because a reader looking for the pair of it will find `transformRevisions` on
|
|
63
|
+
* `PipelineRoutes` below and reasonably wonder where the other half went. The
|
|
64
|
+
* split is the whole argument of this file: transforms are served by the host
|
|
65
|
+
* and move with the base path it chose; saved queries are served by the library
|
|
66
|
+
* and cannot move at all.
|
|
67
|
+
*
|
|
68
|
+
* A plain comment rather than a docblock on purpose — there is no declaration
|
|
69
|
+
* here for it to belong to, and a `/**` would attach itself to the constant
|
|
70
|
+
* below and describe the wrong thing in every editor tooltip.
|
|
71
|
+
*/
|
|
56
72
|
/** Where the pipeline endpoints sit unless the host says otherwise. */
|
|
57
73
|
export const DEFAULT_PIPELINE_BASE_PATH = '/pipeline';
|
|
58
74
|
/**
|
|
@@ -94,6 +110,7 @@ export function pipelineRoutes(basePath = DEFAULT_PIPELINE_BASE_PATH) {
|
|
|
94
110
|
runs: () => `${base}/runs`,
|
|
95
111
|
transforms: () => `${base}/transforms`,
|
|
96
112
|
transform: (id) => `${base}/transforms/${encodeURIComponent(id)}`,
|
|
113
|
+
transformRevisions: (id) => `${base}/transforms/${encodeURIComponent(id)}/revisions`,
|
|
97
114
|
tryTransform: () => `${base}/transforms/try`,
|
|
98
115
|
workflows: () => `${base}/workflows`,
|
|
99
116
|
workflow: (id) => `${base}/workflows/${encodeURIComponent(id)}`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dudousxd/nestjs-catalog-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "Ready-made React screens for @dudousxd/nestjs-catalog — a model manager and a generic object explorer you can drop into your own app shell.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Davide Carvalho",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"@tiptap/pm": "3.29.2",
|
|
107
107
|
"tiptap-markdown": "0.9.0",
|
|
108
108
|
"@tiptap/core": "3.29.2",
|
|
109
|
-
"@dudousxd/nestjs-catalog": "0.
|
|
109
|
+
"@dudousxd/nestjs-catalog": "0.12.0"
|
|
110
110
|
},
|
|
111
111
|
"dependencies": {
|
|
112
112
|
"clsx": "2.1.1",
|