@dudousxd/nestjs-catalog-react 0.29.0 → 0.31.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/WorkflowCanvas.js +121 -2
- package/dist/connection-form.d.ts +11 -7
- package/dist/connection-form.js +11 -7
- package/dist/source-fields.d.ts +4 -1
- package/dist/source-fields.js +30 -8
- package/dist/workflow/create.js +23 -0
- package/dist/workflow/graph.js +27 -0
- package/dist/workflow/model.d.ts +2 -2
- package/dist/workflow/model.js +10 -3
- package/dist/workflow/nodes.js +15 -1
- package/dist/workflow/templates.js +22 -1
- package/package.json +2 -2
package/dist/WorkflowCanvas.js
CHANGED
|
@@ -7,7 +7,7 @@ import { Background, BackgroundVariant, ConnectionLineType, Controls, MiniMap, P
|
|
|
7
7
|
// See src/styles.d.ts for why `tsc` tolerates this import.
|
|
8
8
|
import '@xyflow/react/dist/style.css';
|
|
9
9
|
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
10
|
-
import { ArrowRight, ChevronDown, CircleAlert, CircleDashed, Code2, Database, ExternalLink, Filter, GitBranch, Info, LayoutGrid, Loader2, Maximize2, Minimize2, PanelRight, Plug, Plus, Repeat, Save, TextCursorInput, Trash2, TriangleAlert, Unplug, X, } from 'lucide-react';
|
|
10
|
+
import { ArrowRight, ChevronDown, CircleAlert, CircleDashed, Code2, Database, ExternalLink, Filter, GitBranch, Info, LayoutGrid, Loader2, Maximize2, Minimize2, PanelRight, Plug, Plus, Repeat, Save, Sigma, TextCursorInput, Trash2, TriangleAlert, Unplug, X, } from 'lucide-react';
|
|
11
11
|
import { AnimatePresence, motion, useReducedMotion } from 'motion/react';
|
|
12
12
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
13
13
|
import { connectionOptionsFor } from './ConnectionPanel';
|
|
@@ -32,7 +32,7 @@ import { defaultLabel, describeFilterPredicate, flowingEdgeIds, layout, layoutIf
|
|
|
32
32
|
import { HistoryControls, keepKnown, namesOf, nodeEditAction, reverted, snapshotOf, undone, useUndoShortcut, useUnsavedGuard, withEdit, } from './workflow/history';
|
|
33
33
|
import { PublishControls, RunControls, SchedulePanel, ShrinkRefusalNote, WorkflowStatusBadge, } from './workflow/lifecycle';
|
|
34
34
|
import { CanvasContextMenu, NodeActionsToolbar } from './workflow/menu';
|
|
35
|
-
import { WORKFLOW_BRANCH_LABELS, WORKFLOW_CALL_MODES, WORKFLOW_FILTER_MAX_DEPTH, WORKFLOW_FILTER_MAX_VALUES, WORKFLOW_FILTER_OPERATORS, WORKFLOW_NODE_KINDS, WORKFLOW_RENAME_MAX_COLUMNS, callableWorkflowBlock, describeDurability, isWorkflowBranchLabel, isWorkflowFilterOperator, isWorkflowFilterPredicateKind, isWorkflowNodeKind, isWorkflowPredicateKind, isWorkflowRenameUnnamed, newLocalId, nodeName, producedTypes, renameColumnRefusals, unreachableFilterPredicateKind, unreachableNodeKind, unreachablePredicateKind, workflowCallMode, workflowKnownColumns, workflowNarrowedTypes, workflowRenameUnnamed, } from './workflow/model';
|
|
35
|
+
import { WORKFLOW_AGGREGATE_FUNCTIONS, WORKFLOW_AGGREGATE_MAX_AGGREGATES, WORKFLOW_AGGREGATE_MAX_GROUP_BY, WORKFLOW_BRANCH_LABELS, WORKFLOW_CALL_MODES, WORKFLOW_FILTER_MAX_DEPTH, WORKFLOW_FILTER_MAX_VALUES, WORKFLOW_FILTER_OPERATORS, WORKFLOW_NODE_KINDS, WORKFLOW_RENAME_MAX_COLUMNS, aggregateRefusals, callableWorkflowBlock, describeDurability, isWorkflowAggregateFunction, isWorkflowBranchLabel, isWorkflowFilterOperator, isWorkflowFilterPredicateKind, isWorkflowNodeKind, isWorkflowPredicateKind, isWorkflowRenameUnnamed, newLocalId, nodeName, producedTypes, renameColumnRefusals, unreachableFilterPredicateKind, unreachableNodeKind, unreachablePredicateKind, workflowAggregateMaxGroups, workflowAggregateNeedsColumn, workflowAggregateOutputColumns, workflowCallMode, workflowKnownColumns, workflowNarrowedTypes, workflowRenameUnnamed, } from './workflow/model';
|
|
36
36
|
import { WORKFLOW_NAME } from './workflow/name';
|
|
37
37
|
import { WorkflowNodeProvider, workflowNodeTypes } from './workflow/nodes';
|
|
38
38
|
import { freeSpot, placeNextTo } from './workflow/place';
|
|
@@ -465,6 +465,11 @@ const ADD_NODE = {
|
|
|
465
465
|
label: 'Rename',
|
|
466
466
|
hint: 'Renames columns, and nothing else. No code, no child process — a pure rename rewrites the staged column list and leaves every row exactly where it is. It can also drop the columns you do not name, which does cost a pass over the rows.',
|
|
467
467
|
},
|
|
468
|
+
aggregate: {
|
|
469
|
+
icon: Sigma,
|
|
470
|
+
label: 'Aggregate',
|
|
471
|
+
hint: 'Groups the rows and summarises each group — count, sum, average, min, max, or the values joined together. No code, and it holds only the groups rather than the rows, so a 44,720-row grouping into 16,119 groups never has more than one batch of records in memory. It refuses loudly if the grouping turns out to hold nearly everything.',
|
|
472
|
+
},
|
|
468
473
|
};
|
|
469
474
|
/**
|
|
470
475
|
* The value the workflow picker uses for "start a fresh one".
|
|
@@ -883,6 +888,12 @@ function miniMapColor(data) {
|
|
|
883
888
|
// it reads as another piece of user code hides the one thing worth seeing.
|
|
884
889
|
if (kind === 'rename')
|
|
885
890
|
return '#14b8a6';
|
|
891
|
+
// Amber-500. The one node where the number of rows changes shape rather than
|
|
892
|
+
// merely shrinking, and the one worth spotting from the overview: a grouping
|
|
893
|
+
// that holds nearly every row it read is the failure this node exists to
|
|
894
|
+
// avoid, and the box on the map is where somebody notices there is one.
|
|
895
|
+
if (kind === 'aggregate')
|
|
896
|
+
return '#f59e0b';
|
|
886
897
|
return '#8b5cf6';
|
|
887
898
|
}
|
|
888
899
|
/**
|
|
@@ -3453,6 +3464,111 @@ function RenameInspector({ node, graph, canEdit, onChange, }) {
|
|
|
3453
3464
|
{ value: 'drop', label: 'Drop them', hint: 'rebuilds every row' },
|
|
3454
3465
|
] }), _jsx("p", { className: cn('text-[11px] leading-relaxed', MUTED), children: dropping ? (_jsxs(_Fragment, { children: ["This node ", _jsx("strong", { children: "also removes" }), " every column it does not name, so what reaches the sink is exactly the ", Object.keys(map).length, " new name", Object.keys(map).length === 1 ? '' : 's', " above. That is a projection as well as a rename, and it costs a pass over the rows \u2014 a staged batch keeps its values in positional arrays, and taking a column out moves every one of them."] })) : (_jsxs(_Fragment, { children: ["Nothing else changes. A staged batch names its columns once and keeps the values in positional arrays, so renaming one rewrites a handful of strings and", ' ', _jsx("strong", { children: "moves no data at all" }), " \u2014 which is why this is a node rather than four lines of JavaScript in a transform."] })) }), refusals.length > 0 && (_jsx("p", { className: "text-[11px] leading-relaxed text-amber-600 dark:text-amber-400", children: refusals.join(' ') })), duplicated.length > 0 && (_jsxs("p", { className: "text-[11px] leading-relaxed text-amber-600 dark:text-amber-400", children: [duplicated.map((from) => `“${from}”`).join(', '), " appears more than once on the left. A column can only be renamed to one thing, so only the last row naming it is stored."] })), known ? (_jsxs("p", { className: cn('text-[11px] leading-relaxed', MUTED), children: ["A rename above this node drops the columns it does not name, so the graph knows exactly what arrives here:", ' ', _jsx("span", { className: "font-mono", children: [...known].join(', ') || 'nothing at all' }), ". A row on the left naming anything else is refused when this graph is saved, rather than found out when the column comes back empty."] })) : (_jsx("p", { className: cn('text-[11px] leading-relaxed', MUTED), children: "The graph cannot say which columns reach this node \u2014 a source discovers its shape against the live system, and a transform is code. So the old names are taken on trust, and the run says out loud if one of them was in no row." }))] }));
|
|
3455
3466
|
}
|
|
3467
|
+
/**
|
|
3468
|
+
* The aggregate node's form: what defines a group, and what to compute per group.
|
|
3469
|
+
*
|
|
3470
|
+
* ## Why the two lists are local state and the node is not
|
|
3471
|
+
*
|
|
3472
|
+
* The same argument {@link RenameInspector} makes, arrived at from the other
|
|
3473
|
+
* direction. A rename's model is a `Record` and has to be edited as a list; an
|
|
3474
|
+
* aggregate's model is already a list, and the reason it is one is here in the
|
|
3475
|
+
* form: two aggregates reading the same column — `min(closedDate)` and
|
|
3476
|
+
* `max(closedDate)` — are the normal case rather than the mistake, so the
|
|
3477
|
+
* output name is the key and a half-typed one is still a row somebody is in the
|
|
3478
|
+
* middle of writing.
|
|
3479
|
+
*
|
|
3480
|
+
* Rows are held here, in order, and the node is derived from them. What can
|
|
3481
|
+
* diverge is two rows sharing an output name, and that is said out loud below
|
|
3482
|
+
* rather than silently resolved, because resolving it means deciding which of
|
|
3483
|
+
* somebody's numbers survives.
|
|
3484
|
+
*
|
|
3485
|
+
* ## What this panel can say that no other inspector can
|
|
3486
|
+
*
|
|
3487
|
+
* **Exactly** which columns leave the node. Every other kind's answer is an
|
|
3488
|
+
* upper bound at best and `undefined` at worst; an aggregate's output set is
|
|
3489
|
+
* closed by its own config — the group keys plus the named aggregates, on every
|
|
3490
|
+
* record, always. So the panel prints the list rather than hedging it, and the
|
|
3491
|
+
* hedge is reserved for the columns coming *in*, where `workflowKnownColumns`
|
|
3492
|
+
* genuinely may not know.
|
|
3493
|
+
*
|
|
3494
|
+
* ## And the one number it puts in front of somebody before they run it
|
|
3495
|
+
*
|
|
3496
|
+
* The group ceiling. A hash aggregate is cheap only while the groups are far
|
|
3497
|
+
* fewer than the rows, and the moment somebody groups on a near-unique column
|
|
3498
|
+
* the node holds the whole load. That is a decision made in this form, so the
|
|
3499
|
+
* bound belongs in this form and not only in the run that refuses.
|
|
3500
|
+
*/
|
|
3501
|
+
function AggregateInspector({ node, graph, canEdit, onChange, }) {
|
|
3502
|
+
const [groupBy, setGroupBy] = useState(() => node.groupBy.length > 0 ? [...node.groupBy] : ['']);
|
|
3503
|
+
const [rows, setRows] = useState(() => node.aggregates.length > 0 ? [...node.aggregates] : [{ as: '', fn: 'count' }]);
|
|
3504
|
+
const commitGroupBy = (next) => {
|
|
3505
|
+
setGroupBy(next);
|
|
3506
|
+
onChange({ ...node, groupBy: next });
|
|
3507
|
+
};
|
|
3508
|
+
const commitRows = (next) => {
|
|
3509
|
+
setRows(next);
|
|
3510
|
+
onChange({ ...node, aggregates: next });
|
|
3511
|
+
};
|
|
3512
|
+
const setFunction = (index, value) => {
|
|
3513
|
+
if (!isWorkflowAggregateFunction(value))
|
|
3514
|
+
return;
|
|
3515
|
+
commitRows(rows.map((each, at) => (at === index ? refunction(each, value) : each)));
|
|
3516
|
+
};
|
|
3517
|
+
const known = workflowKnownColumns(graph, node.id);
|
|
3518
|
+
const refusals = aggregateRefusals(node);
|
|
3519
|
+
const produces = workflowAggregateOutputColumns(node);
|
|
3520
|
+
const duplicated = rows
|
|
3521
|
+
.map((row) => row.as)
|
|
3522
|
+
.filter((as, at, all) => as.length > 0 && all.indexOf(as) !== at);
|
|
3523
|
+
return (_jsxs("div", { className: "space-y-3", children: [_jsxs(FieldGroup, { title: "Group by", hint: _jsxs(_Fragment, { children: ["What makes two records the same group. These come out under the names they went in under, so each has to be a name a column can have \u2014 letters, digits and underscore, starting with a letter or an underscore. If the source spells its headers", ' ', _jsx("code", { children: "Work Order Id" }), ", put a Rename node above this one."] }), children: [groupBy.map((column, index) => (_jsxs("div", { className: "flex items-end gap-2", children: [_jsx("div", { className: "min-w-0 flex-1", children: _jsx(TextField, { label: index === 0 ? 'Column' : '', value: column, placeholder: "workOrderId", disabled: !canEdit, onChange: (next) => commitGroupBy(groupBy.map((each, at) => (at === index ? next : each))) }) }), canEdit && groupBy.length > 1 && (_jsx(Button, { variant: "ghost", size: "sm", className: "shrink-0", onClick: () => commitGroupBy(groupBy.filter((_, at) => at !== index)), children: "Remove" }))] }, index))), canEdit && (_jsx(Button, { variant: "outline", size: "sm", onClick: () => commitGroupBy([...groupBy, '']), disabled: groupBy.length >= WORKFLOW_AGGREGATE_MAX_GROUP_BY, children: "Add column" }))] }), _jsxs(FieldGroup, { title: "Compute", hint: _jsxs(_Fragment, { children: ["One column out per row. ", _jsx("code", { children: "count" }), " with no column counts the records in the group; with a column it counts the ones that are not null. Anything more than these is a Transform \u2014 there is no conditional here on purpose."] }), children: [rows.map((row, index) => (_jsxs("div", { className: "space-y-2 rounded-md border border-zinc-200 p-2 dark:border-zinc-800", children: [_jsxs("div", { className: "flex items-end gap-2", children: [_jsx("div", { className: "min-w-0 flex-1", children: _jsx(SelectField, { label: index === 0 ? 'Function' : '', ariaLabel: "Aggregate function", value: row.fn, onValueChange: (value) => setFunction(index, value), disabled: !canEdit, options: WORKFLOW_AGGREGATE_FUNCTIONS.map((fn) => ({
|
|
3524
|
+
value: fn,
|
|
3525
|
+
label: fn,
|
|
3526
|
+
hint: AGGREGATE_HINTS[fn],
|
|
3527
|
+
})) }) }), _jsx("div", { className: "min-w-0 flex-1", children: _jsx(TextField, { label: index === 0 ? 'Of column' : '', value: row.column ?? '', placeholder: workflowAggregateNeedsColumn(row.fn) ? 'actualLaborCost' : 'every record', disabled: !canEdit, onChange: (column) => commitRows(rows.map((each, at) => at === index
|
|
3528
|
+
? column.length === 0
|
|
3529
|
+
? { ...each, column: undefined }
|
|
3530
|
+
: { ...each, column }
|
|
3531
|
+
: each)) }) }), _jsx("div", { className: "min-w-0 flex-1", children: _jsx(TextField, { label: index === 0 ? 'Called' : '', value: row.as, placeholder: "totalLaborCost", disabled: !canEdit, onChange: (as) => commitRows(rows.map((each, at) => (at === index ? { ...each, as } : each))) }) }), canEdit && rows.length > 1 && (_jsx(Button, { variant: "ghost", size: "sm", className: "shrink-0", onClick: () => commitRows(rows.filter((_, at) => at !== index)), children: "Remove" }))] }), row.fn === 'join' && (_jsxs("div", { className: "flex items-end gap-2", children: [_jsx("div", { className: "min-w-0 flex-1", children: _jsx(TextField, { label: "Separator", value: row.separator ?? '', placeholder: ", ", disabled: !canEdit, onChange: (separator) => commitRows(rows.map((each, at) => at === index
|
|
3532
|
+
? separator.length === 0
|
|
3533
|
+
? { ...each, separator: undefined }
|
|
3534
|
+
: { ...each, separator }
|
|
3535
|
+
: each)) }) }), _jsx("div", { className: "min-w-0 flex-1", children: _jsx(TextField, { label: "Refuse past", value: row.maxLength === undefined ? '' : String(row.maxLength), placeholder: "65535 characters", inputMode: "numeric", disabled: !canEdit, hint: "Refused, not truncated.", onChange: (text) => {
|
|
3536
|
+
const parsed = Number(text.trim());
|
|
3537
|
+
const maxLength = text.trim().length === 0 || !Number.isInteger(parsed) ? undefined : parsed;
|
|
3538
|
+
commitRows(rows.map((each, at) => (at === index ? { ...each, maxLength } : each)));
|
|
3539
|
+
} }) })] }))] }, index))), canEdit && (_jsx(Button, { variant: "outline", size: "sm", onClick: () => commitRows([...rows, { as: '', fn: 'count' }]), disabled: rows.length >= WORKFLOW_AGGREGATE_MAX_AGGREGATES, children: "Add aggregate" }))] }), _jsxs("p", { className: cn('text-[11px] leading-relaxed', MUTED), children: ["This node holds ", _jsx("strong", { children: "one row per group" }), " and reads the records one staged batch at a time, so its memory is the number of groups and not the number of records. If the grouping turns out to be nearly one-to-one it holds the whole load, so the run", ' ', _jsx("strong", { children: "refuses" }), " past ", workflowAggregateMaxGroups(node).toLocaleString(), " groups rather than quietly filling the machine."] }), refusals.length > 0 && (_jsx("p", { className: "text-[11px] leading-relaxed text-amber-600 dark:text-amber-400", children: refusals.join(' ') })), duplicated.length > 0 && (_jsxs("p", { className: "text-[11px] leading-relaxed text-amber-600 dark:text-amber-400", children: [duplicated.map((as) => `“${as}”`).join(', '), " is used by more than one row. Two columns cannot share one name, and picking a winner would be a rule about which of your numbers survives."] })), produces.length > 0 && (_jsxs("p", { className: cn('text-[11px] leading-relaxed', MUTED), children: ["What leaves this node is exactly ", _jsx("span", { className: "font-mono", children: produces.join(', ') }), ", on every record \u2014 including where the answer is null. Every other column of every record stops here. That set is ", _jsx("strong", { children: "exact" }), " rather than a best guess, which is what lets a filter or a sink below this node be checked when the graph is saved."] })), known ? (_jsxs("p", { className: cn('text-[11px] leading-relaxed', MUTED), children: ["The graph knows exactly what arrives here:", ' ', _jsx("span", { className: "font-mono", children: [...known].join(', ') || 'nothing at all' }), ". A column named above that is not in that list is refused when this graph is saved, rather than found out when sixteen thousand rows come back as one."] })) : (_jsx("p", { className: cn('text-[11px] leading-relaxed', MUTED), children: "The graph cannot say which columns reach this node \u2014 a source discovers its shape against the live system, and a transform is code. So the column names above are taken on trust, and the run says out loud if one of them was in no record at all." }))] }));
|
|
3540
|
+
}
|
|
3541
|
+
/**
|
|
3542
|
+
* One aggregate, with its function changed and the fields that no longer apply
|
|
3543
|
+
* dropped.
|
|
3544
|
+
*
|
|
3545
|
+
* Dropped rather than left behind, because a stored separator on a `sum` is a
|
|
3546
|
+
* node the server refuses — and a form that can reach a refused state by
|
|
3547
|
+
* changing a dropdown is a form that fails after Save with nothing visibly
|
|
3548
|
+
* wrong on the screen.
|
|
3549
|
+
*/
|
|
3550
|
+
function refunction(aggregate, fn) {
|
|
3551
|
+
const kept = { as: aggregate.as, fn };
|
|
3552
|
+
if (workflowAggregateNeedsColumn(fn) && aggregate.column !== undefined) {
|
|
3553
|
+
kept.column = aggregate.column;
|
|
3554
|
+
}
|
|
3555
|
+
if (fn !== 'join')
|
|
3556
|
+
return kept;
|
|
3557
|
+
if (aggregate.separator !== undefined)
|
|
3558
|
+
kept.separator = aggregate.separator;
|
|
3559
|
+
if (aggregate.maxLength !== undefined)
|
|
3560
|
+
kept.maxLength = aggregate.maxLength;
|
|
3561
|
+
return kept;
|
|
3562
|
+
}
|
|
3563
|
+
/** One line per function, for the picker. What it does, and what it costs. */
|
|
3564
|
+
const AGGREGATE_HINTS = {
|
|
3565
|
+
count: 'records in the group, or non-null values of a column',
|
|
3566
|
+
sum: 'the total, with the low-order bits kept',
|
|
3567
|
+
avg: 'the mean of the non-null values',
|
|
3568
|
+
min: 'the least value — text compares by code point, not by database collation',
|
|
3569
|
+
max: 'the greatest value — same comparison',
|
|
3570
|
+
join: 'the values run together, refusing past a length rather than truncating',
|
|
3571
|
+
};
|
|
3456
3572
|
function FilterInspector({ node, graph, canEdit, onChange, }) {
|
|
3457
3573
|
// Core's answer, not this file's. A canvas that worked out its own set would
|
|
3458
3574
|
// offer acknowledgements the server then refuses, which is a person ticking a
|
|
@@ -3791,6 +3907,9 @@ function KindInspector({ node, graph, transforms, connections, storage, typeOpti
|
|
|
3791
3907
|
// node. See `workflowKnownColumns`.
|
|
3792
3908
|
return (_jsx(RenameInspector, { node: node, graph: graph, canEdit: canEdit, onChange: onChange }, node.id));
|
|
3793
3909
|
}
|
|
3910
|
+
if (node.kind === 'aggregate') {
|
|
3911
|
+
return _jsx(AggregateInspector, { node: node, graph: graph, canEdit: canEdit, onChange: onChange });
|
|
3912
|
+
}
|
|
3794
3913
|
if (node.kind === 'sink') {
|
|
3795
3914
|
return (_jsx(SinkInspector, { node: node, typeOptions: typeOptions, canEdit: canEdit, modelHref: modelHref, onChange: onChange }));
|
|
3796
3915
|
}
|
|
@@ -29,13 +29,13 @@ import type { ReactNode } from 'react';
|
|
|
29
29
|
* is for — a form that renders nothing looks like a form somebody has not
|
|
30
30
|
* finished typing into.
|
|
31
31
|
*
|
|
32
|
-
* `file` and `
|
|
33
|
-
* pasted records belong to the load, not to a shared address
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* server's side.
|
|
32
|
+
* `file`, `inline` and `catalog` are refusals, and deliberately: a file's path
|
|
33
|
+
* and a set of pasted records belong to the load, not to a shared address, and a
|
|
34
|
+
* catalog source has no address at all. A connection there would be a name with
|
|
35
|
+
* nothing behind it, and — since a connection's whole worth is the button that
|
|
36
|
+
* finds out whether it answers — a "Test connection" that always passes is worse
|
|
37
|
+
* than no button, because it teaches people that a green tick means nothing.
|
|
38
|
+
* `ConnectionChecker.probe` says the same thing from the server's side.
|
|
39
39
|
*/
|
|
40
40
|
declare const KINDS: {
|
|
41
41
|
http: {
|
|
@@ -80,6 +80,10 @@ declare const KINDS: {
|
|
|
80
80
|
connectable: false;
|
|
81
81
|
because: string;
|
|
82
82
|
};
|
|
83
|
+
catalog: {
|
|
84
|
+
connectable: false;
|
|
85
|
+
because: string;
|
|
86
|
+
};
|
|
83
87
|
};
|
|
84
88
|
/** A kind a connection can actually address, narrowed from the record above. */
|
|
85
89
|
export type ConnectableKind = {
|
package/dist/connection-form.js
CHANGED
|
@@ -33,13 +33,13 @@ import { Switch } from './ui/switch';
|
|
|
33
33
|
* is for — a form that renders nothing looks like a form somebody has not
|
|
34
34
|
* finished typing into.
|
|
35
35
|
*
|
|
36
|
-
* `file` and `
|
|
37
|
-
* pasted records belong to the load, not to a shared address
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* server's side.
|
|
36
|
+
* `file`, `inline` and `catalog` are refusals, and deliberately: a file's path
|
|
37
|
+
* and a set of pasted records belong to the load, not to a shared address, and a
|
|
38
|
+
* catalog source has no address at all. A connection there would be a name with
|
|
39
|
+
* nothing behind it, and — since a connection's whole worth is the button that
|
|
40
|
+
* finds out whether it answers — a "Test connection" that always passes is worse
|
|
41
|
+
* than no button, because it teaches people that a green tick means nothing.
|
|
42
|
+
* `ConnectionChecker.probe` says the same thing from the server's side.
|
|
43
43
|
*/
|
|
44
44
|
const KINDS = {
|
|
45
45
|
http: {
|
|
@@ -79,6 +79,10 @@ const KINDS = {
|
|
|
79
79
|
connectable: false,
|
|
80
80
|
because: 'Inline records are pasted into the source itself. There is no address to share.',
|
|
81
81
|
},
|
|
82
|
+
catalog: {
|
|
83
|
+
connectable: false,
|
|
84
|
+
because: 'A catalog source reads this catalog, through the store the application already holds. There is no address and no credential — which is the point of the kind: pointing the catalog at its own database through a connection meant an operator minting a URL and a secret that did not need to exist.',
|
|
85
|
+
},
|
|
82
86
|
};
|
|
83
87
|
export const CONNECTION_KINDS = KINDS;
|
|
84
88
|
/**
|
package/dist/source-fields.d.ts
CHANGED
|
@@ -19,8 +19,9 @@ export declare function readsIncrementally(kind: ConnectorKind): boolean;
|
|
|
19
19
|
* rather than two that happen to agree today.
|
|
20
20
|
*/
|
|
21
21
|
export declare function usesConnection(kind: ConnectorKind): kind is ConnectableKind;
|
|
22
|
+
/** The kinds, in the order the library declares them, never a copy of the list. */
|
|
22
23
|
export declare const KIND_OPTIONS: {
|
|
23
|
-
value:
|
|
24
|
+
value: "inline" | "http" | "sql" | "file" | "s3" | "catalog";
|
|
24
25
|
label: string;
|
|
25
26
|
}[];
|
|
26
27
|
/**
|
|
@@ -72,6 +73,8 @@ export interface SourceDraft {
|
|
|
72
73
|
forcePathStyle: boolean;
|
|
73
74
|
maxObjectsPerRun: string;
|
|
74
75
|
watermarkColumn: string;
|
|
76
|
+
/** The object type a `catalog` source reads. Its whole configuration. */
|
|
77
|
+
objectType: string;
|
|
75
78
|
}
|
|
76
79
|
export declare function sourceDraftFrom(config: Record<string, unknown> | undefined): SourceDraft;
|
|
77
80
|
/**
|
package/dist/source-fields.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { CONNECTOR_KINDS, SOURCE_FORMATS } from '@dudousxd/nestjs-catalog/client';
|
|
2
|
+
import { CATALOG_SOURCE_TYPE_KEY, CONNECTOR_KINDS, SOURCE_FORMATS, } from '@dudousxd/nestjs-catalog/client';
|
|
3
3
|
import { cn } from './cn';
|
|
4
4
|
import { CONNECTION_KINDS } from './connection-form';
|
|
5
5
|
import { FieldGroup, TextAreaField, TextField } from './ui/field';
|
|
@@ -47,13 +47,29 @@ export function readsIncrementally(kind) {
|
|
|
47
47
|
export function usesConnection(kind) {
|
|
48
48
|
return CONNECTION_KINDS[kind].connectable;
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
/**
|
|
51
|
+
* How each kind reads in the picker.
|
|
52
|
+
*
|
|
53
|
+
* `satisfies Record<ConnectorKind, string>` for the reason {@link FORMAT_LABELS}
|
|
54
|
+
* below has it, and this one had to be repaired to get it: the picker was a
|
|
55
|
+
* hand-written array of five objects, so a sixth kind added to the library
|
|
56
|
+
* arrived in the vocabulary, in the validator, in the fetcher map — and never in
|
|
57
|
+
* the dropdown. A kind nobody can choose is a kind that has shipped invisible,
|
|
58
|
+
* which has happened in this repository before.
|
|
59
|
+
*/
|
|
60
|
+
const KIND_LABELS = {
|
|
61
|
+
http: 'HTTP — a JSON endpoint',
|
|
62
|
+
sql: 'SQL — a database query',
|
|
63
|
+
file: 'File — CSV, NDJSON, JSON, Excel or Parquet',
|
|
64
|
+
s3: 'S3 — a bucket prefix',
|
|
65
|
+
inline: 'Inline — records pasted below',
|
|
66
|
+
catalog: "Catalog — an object type in this catalog's own data",
|
|
67
|
+
};
|
|
68
|
+
/** The kinds, in the order the library declares them, never a copy of the list. */
|
|
69
|
+
export const KIND_OPTIONS = CONNECTOR_KINDS.map((kind) => ({
|
|
70
|
+
value: kind,
|
|
71
|
+
label: KIND_LABELS[kind],
|
|
72
|
+
}));
|
|
57
73
|
/**
|
|
58
74
|
* How each format is labelled, and the reason this is a map rather than a list.
|
|
59
75
|
*
|
|
@@ -117,6 +133,7 @@ export function sourceDraftFrom(config) {
|
|
|
117
133
|
forcePathStyle: source.forcePathStyle === true,
|
|
118
134
|
maxObjectsPerRun: typeof source.maxObjectsPerRun === 'number' ? String(source.maxObjectsPerRun) : '',
|
|
119
135
|
watermarkColumn: text('watermarkColumn'),
|
|
136
|
+
objectType: text(CATALOG_SOURCE_TYPE_KEY),
|
|
120
137
|
};
|
|
121
138
|
}
|
|
122
139
|
export function parseRecords(text) {
|
|
@@ -221,6 +238,8 @@ export function sourceConfigFrom(kind, draft, { viaConnection, incremental }) {
|
|
|
221
238
|
return fileConfig(draft);
|
|
222
239
|
if (kind === 's3')
|
|
223
240
|
return s3Config(draft, viaConnection);
|
|
241
|
+
if (kind === 'catalog')
|
|
242
|
+
return { [CATALOG_SOURCE_TYPE_KEY]: draft.objectType.trim() };
|
|
224
243
|
return inlineConfig(draft);
|
|
225
244
|
}
|
|
226
245
|
/*
|
|
@@ -255,6 +274,9 @@ export function sourceConfigFrom(kind, draft, { viaConnection, incremental }) {
|
|
|
255
274
|
const NO_DISK = '__no_disk__';
|
|
256
275
|
export function SourceFields({ kind, draft, onChange, viaConnection, disabled, storage, }) {
|
|
257
276
|
const set = (patch) => onChange({ ...draft, ...patch });
|
|
277
|
+
if (kind === 'catalog') {
|
|
278
|
+
return (_jsx(TextField, { label: "Object type", value: draft.objectType, onChange: (objectType) => set({ objectType }), placeholder: "e.g. SubwoReplica", disabled: disabled, hint: "The type, not a table. This reads the snapshot the catalog is currently serving, resolved when the run starts \u2014 the physical table keeps every load that has ever run, so naming it directly reads them all." }));
|
|
279
|
+
}
|
|
258
280
|
if (kind === 'http') {
|
|
259
281
|
return (_jsxs("div", { className: "grid gap-3 sm:grid-cols-2", children: [!viaConnection && (_jsx(TextField, { label: "URL", value: draft.url, onChange: (url) => set({ url }), placeholder: "https://\u2026", disabled: disabled })), _jsx(TextField, { label: "Path to the array", value: draft.path, onChange: (path) => set({ path }), placeholder: "e.g. data", disabled: disabled })] }));
|
|
260
282
|
}
|
package/dist/workflow/create.js
CHANGED
|
@@ -91,6 +91,29 @@ export function newNodeOfKind(kind, id, position, name) {
|
|
|
91
91
|
// snapshot.
|
|
92
92
|
return { id, name, kind: 'rename', columns: { '': '' }, position };
|
|
93
93
|
}
|
|
94
|
+
if (kind === 'aggregate') {
|
|
95
|
+
// One blank group-by column and one blank aggregate, so the validator
|
|
96
|
+
// refuses it by name from the moment it is dropped. The same stance
|
|
97
|
+
// `filter` and `rename` take, and here the empty states are the two most
|
|
98
|
+
// dangerous in the file: an aggregate with no group-by columns commits
|
|
99
|
+
// exactly one row whether the source held everything or nothing, and one
|
|
100
|
+
// with no aggregates commits the distinct group keys with every other
|
|
101
|
+
// column of every row gone. Neither errors. So the node starts visibly
|
|
102
|
+
// incomplete rather than invisibly destructive.
|
|
103
|
+
//
|
|
104
|
+
// `count` as the starting function because it is the only one that needs no
|
|
105
|
+
// column to mean something, so the half-filled node the person is looking
|
|
106
|
+
// at is refused for the fields they have not reached yet rather than for a
|
|
107
|
+
// choice the form made on their behalf.
|
|
108
|
+
return {
|
|
109
|
+
id,
|
|
110
|
+
name,
|
|
111
|
+
kind: 'aggregate',
|
|
112
|
+
groupBy: [''],
|
|
113
|
+
aggregates: [{ as: '', fn: 'count' }],
|
|
114
|
+
position,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
94
117
|
if (kind === 'sink') {
|
|
95
118
|
return { id, name, kind: 'sink', targetType: '', position };
|
|
96
119
|
}
|
package/dist/workflow/graph.js
CHANGED
|
@@ -54,6 +54,8 @@ function subtitleFor(node, describe) {
|
|
|
54
54
|
return filterSubtitle(node);
|
|
55
55
|
if (node.kind === 'rename')
|
|
56
56
|
return renameSubtitle(node);
|
|
57
|
+
if (node.kind === 'aggregate')
|
|
58
|
+
return aggregateSubtitle(node);
|
|
57
59
|
if (node.kind === 'transform') {
|
|
58
60
|
return describe.transformName(node.transformId) ?? 'no transform chosen';
|
|
59
61
|
}
|
|
@@ -116,6 +118,29 @@ function renameSubtitle(node) {
|
|
|
116
118
|
: `renames ${entries.length} columns`;
|
|
117
119
|
return dropped ? `${what}, drops the rest` : what;
|
|
118
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* An aggregate's face: what defines a group, and how many numbers come out.
|
|
123
|
+
*
|
|
124
|
+
* The group-by columns are spelled out rather than counted, because they are the
|
|
125
|
+
* whole meaning of the node — `by workOrderId, assetId` says what one output row
|
|
126
|
+
* *is*, and "groups on 2 columns" says nothing anybody can check. The aggregate
|
|
127
|
+
* count is a count, because forty-nine function names do not fit on a box and
|
|
128
|
+
* the inspector is one click away.
|
|
129
|
+
*
|
|
130
|
+
* This is also the only node face that has to make a person suspicious of a
|
|
131
|
+
* grouping before they run it, which is why the columns come first: an aggregate
|
|
132
|
+
* grouped on something near-unique holds the whole load, and the name of the
|
|
133
|
+
* column is the only thing on the canvas that can give that away.
|
|
134
|
+
*/
|
|
135
|
+
function aggregateSubtitle(node) {
|
|
136
|
+
const groupBy = (node.groupBy ?? []).filter((column) => column.length > 0);
|
|
137
|
+
const aggregates = (node.aggregates ?? []).filter((each) => each.as.length > 0);
|
|
138
|
+
if (groupBy.length === 0)
|
|
139
|
+
return 'no columns to group on';
|
|
140
|
+
if (aggregates.length === 0)
|
|
141
|
+
return `by ${groupBy.join(', ')}, computing nothing`;
|
|
142
|
+
return `by ${groupBy.join(', ')} \u2192 ${aggregates.length} ${aggregates.length === 1 ? 'value' : 'values'}`;
|
|
143
|
+
}
|
|
119
144
|
/** How many comparisons a predicate is made of, groups not counted. */
|
|
120
145
|
function countFilterLeaves(predicate) {
|
|
121
146
|
if (predicate.kind === 'all' || predicate.kind === 'any') {
|
|
@@ -361,6 +386,8 @@ export function defaultLabel(kind) {
|
|
|
361
386
|
return 'Filter';
|
|
362
387
|
if (kind === 'rename')
|
|
363
388
|
return 'Rename';
|
|
389
|
+
if (kind === 'aggregate')
|
|
390
|
+
return 'Aggregate';
|
|
364
391
|
if (kind === 'transform')
|
|
365
392
|
return 'Transform';
|
|
366
393
|
return unreachableNodeKind(kind, 'defaultLabel');
|
package/dist/workflow/model.d.ts
CHANGED
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
* executes it, it belongs to core; if only this screen has an opinion about it,
|
|
19
19
|
* it belongs here.
|
|
20
20
|
*/
|
|
21
|
-
export type { CallableWorkflowBlock, CallableWorkflowDisagreement, CallableWorkflowRef, CatalogWorkflow, CatalogWorkflowRelease, WorkflowBranchLabel, WorkflowEdge, WorkflowCallMode, WorkflowCallNode, WorkflowEnvPredicate, WorkflowFilterAll, WorkflowFilterAny, WorkflowFilterComparison, WorkflowFilterGroup, WorkflowFilterNode, WorkflowFilterOneOf, WorkflowFilterOperator, WorkflowFilterPredicate, WorkflowFilterPredicateKind, WorkflowFilterPresence, WorkflowFilterValue, WorkflowGraph, WorkflowIfNode, WorkflowIfPredicate, WorkflowNode, WorkflowNodeKind, WorkflowPredicateKind, WorkflowRenameNode, WorkflowRenameUnnamed, WorkflowRowCountPredicate, WorkflowSinkNode, WorkflowSkipReason, WorkflowSourceNode, WorkflowTransformNode, } from '@dudousxd/nestjs-catalog/client';
|
|
22
|
-
export { callableWorkflowBlock, isWorkflowBranchLabel, isWorkflowFilterOperator, isWorkflowFilterPredicate, isWorkflowFilterPredicateKind, isWorkflowFilterValue, isWorkflowNodeKind, isWorkflowPredicateKind, isWorkflowRenameUnnamed, renameColumnRefusals, workflowKnownColumns, workflowRenameUnnamed, WORKFLOW_CALL_MODES, unreachableCallMode, workflowCallMode, unreachableFilterOperator, unreachableFilterPredicateKind, unreachableNodeKind, unreachablePredicateKind, unreachableRenameUnnamed, workflowNarrowedTypes, WORKFLOW_BRANCH_LABELS, WORKFLOW_FILTER_COLUMN_PATTERN, WORKFLOW_FILTER_MAX_DEPTH, WORKFLOW_FILTER_MAX_VALUES, WORKFLOW_FILTER_OPERATORS, WORKFLOW_FILTER_PREDICATE_KINDS, WORKFLOW_PREDICATE_KINDS, WORKFLOW_RENAME_MAX_COLUMNS, WORKFLOW_RENAME_UNNAMED, WORKFLOW_NODE_ID_PATTERN, WORKFLOW_NODE_KINDS, } from '@dudousxd/nestjs-catalog/client';
|
|
21
|
+
export type { CallableWorkflowBlock, CallableWorkflowDisagreement, CallableWorkflowRef, CatalogWorkflow, CatalogWorkflowRelease, WorkflowBranchLabel, WorkflowEdge, WorkflowCallMode, WorkflowCallNode, WorkflowEnvPredicate, WorkflowFilterAll, WorkflowFilterAny, WorkflowFilterComparison, WorkflowFilterGroup, WorkflowFilterNode, WorkflowFilterOneOf, WorkflowFilterOperator, WorkflowFilterPredicate, WorkflowFilterPredicateKind, WorkflowFilterPresence, WorkflowFilterValue, WorkflowGraph, WorkflowIfNode, WorkflowIfPredicate, WorkflowAggregate, WorkflowAggregateFunction, WorkflowAggregateNode, WorkflowNode, WorkflowNodeKind, WorkflowPredicateKind, WorkflowRenameNode, WorkflowRenameUnnamed, WorkflowRowCountPredicate, WorkflowSinkNode, WorkflowSkipReason, WorkflowSourceNode, WorkflowTransformNode, } from '@dudousxd/nestjs-catalog/client';
|
|
22
|
+
export { callableWorkflowBlock, isWorkflowBranchLabel, isWorkflowFilterOperator, isWorkflowFilterPredicate, isWorkflowFilterPredicateKind, isWorkflowFilterValue, isWorkflowNodeKind, isWorkflowPredicateKind, isWorkflowAggregateFunction, isWorkflowRenameUnnamed, aggregateRefusals, workflowAggregateColumns, workflowAggregateJoinMaxLength, workflowAggregateMaxGroups, workflowAggregateNeedsColumn, workflowAggregateOutputColumns, workflowAggregateSeparator, renameColumnRefusals, workflowKnownColumns, workflowRenameUnnamed, WORKFLOW_CALL_MODES, unreachableCallMode, workflowCallMode, unreachableFilterOperator, unreachableFilterPredicateKind, unreachableNodeKind, unreachablePredicateKind, unreachableAggregateFunction, unreachableRenameUnnamed, workflowNarrowedTypes, WORKFLOW_BRANCH_LABELS, WORKFLOW_FILTER_COLUMN_PATTERN, WORKFLOW_FILTER_MAX_DEPTH, WORKFLOW_FILTER_MAX_VALUES, WORKFLOW_FILTER_OPERATORS, WORKFLOW_FILTER_PREDICATE_KINDS, WORKFLOW_PREDICATE_KINDS, WORKFLOW_AGGREGATE_DEFAULT_SEPARATOR, WORKFLOW_AGGREGATE_FUNCTIONS, WORKFLOW_AGGREGATE_GROUPS_CEILING, WORKFLOW_AGGREGATE_JOIN_LENGTH_CEILING, WORKFLOW_AGGREGATE_JOIN_MAX_LENGTH, WORKFLOW_AGGREGATE_MAX_AGGREGATES, WORKFLOW_AGGREGATE_MAX_GROUP_BY, WORKFLOW_AGGREGATE_MAX_GROUPS, WORKFLOW_AGGREGATE_MAX_SEPARATOR, WORKFLOW_RENAME_MAX_COLUMNS, WORKFLOW_RENAME_UNNAMED, WORKFLOW_NODE_ID_PATTERN, WORKFLOW_NODE_KINDS, } from '@dudousxd/nestjs-catalog/client';
|
|
23
23
|
import { type WorkflowBranchLabel, type WorkflowNode, type WorkflowSkipReason } from '@dudousxd/nestjs-catalog/client';
|
|
24
24
|
/**
|
|
25
25
|
* What a caller may set.
|
package/dist/workflow/model.js
CHANGED
|
@@ -23,7 +23,14 @@ export {
|
|
|
23
23
|
// not a copy: the picker greys an entry out and the server reasons about the
|
|
24
24
|
// same list, and two copies of that rule is a picker that eventually offers
|
|
25
25
|
// something the rest of the system will not accept.
|
|
26
|
-
callableWorkflowBlock, isWorkflowBranchLabel, isWorkflowFilterOperator, isWorkflowFilterPredicate, isWorkflowFilterPredicateKind, isWorkflowFilterValue, isWorkflowNodeKind, isWorkflowPredicateKind, isWorkflowRenameUnnamed,
|
|
26
|
+
callableWorkflowBlock, isWorkflowBranchLabel, isWorkflowFilterOperator, isWorkflowFilterPredicate, isWorkflowFilterPredicateKind, isWorkflowFilterValue, isWorkflowNodeKind, isWorkflowPredicateKind, isWorkflowAggregateFunction, isWorkflowRenameUnnamed,
|
|
27
|
+
// The aggregate rules, core's for the reason every rule here is core's: an
|
|
28
|
+
// inspector that offered a function the fold cannot compute would save a
|
|
29
|
+
// graph that fails inside a durable step, and one with its own copy of the
|
|
30
|
+
// group ceiling would show a person a bound the runner does not enforce.
|
|
31
|
+
// `workflowAggregateOutputColumns` is the payoff of the config being data —
|
|
32
|
+
// the columns leaving the node, exactly, which no other kind can say.
|
|
33
|
+
aggregateRefusals, workflowAggregateColumns, workflowAggregateJoinMaxLength, workflowAggregateMaxGroups, workflowAggregateNeedsColumn, workflowAggregateOutputColumns, workflowAggregateSeparator,
|
|
27
34
|
// The rename rules, core's for the reason every rule here is core's: a form
|
|
28
35
|
// that checked a target name against its own copy of the identifier pattern
|
|
29
36
|
// would accept a name the server refuses, after Save — and `workflowKnownColumns`
|
|
@@ -36,12 +43,12 @@ renameColumnRefusals, workflowKnownColumns, workflowRenameUnnamed,
|
|
|
36
43
|
// graph somebody saves and a child run that fails, and a screen carrying its
|
|
37
44
|
// own `?? 'envelope'` would eventually disagree with `workflowGraphHash` and
|
|
38
45
|
// show unsaved changes on a graph nobody edited.
|
|
39
|
-
WORKFLOW_CALL_MODES, unreachableCallMode, workflowCallMode, unreachableFilterOperator, unreachableFilterPredicateKind, unreachableNodeKind, unreachablePredicateKind, unreachableRenameUnnamed,
|
|
46
|
+
WORKFLOW_CALL_MODES, unreachableCallMode, workflowCallMode, unreachableFilterOperator, unreachableFilterPredicateKind, unreachableNodeKind, unreachablePredicateKind, unreachableAggregateFunction, unreachableRenameUnnamed,
|
|
40
47
|
// Core's, not a copy, for the reason every other rule here is core's: the
|
|
41
48
|
// inspector has to offer exactly the acknowledgements `validateWorkflow`
|
|
42
49
|
// requires, and a screen that worked out its own list would offer a set the
|
|
43
50
|
// server then refuses — with the person having ticked a box to be told no.
|
|
44
|
-
workflowNarrowedTypes, WORKFLOW_BRANCH_LABELS, WORKFLOW_FILTER_COLUMN_PATTERN, WORKFLOW_FILTER_MAX_DEPTH, WORKFLOW_FILTER_MAX_VALUES, WORKFLOW_FILTER_OPERATORS, WORKFLOW_FILTER_PREDICATE_KINDS, WORKFLOW_PREDICATE_KINDS, WORKFLOW_RENAME_MAX_COLUMNS, WORKFLOW_RENAME_UNNAMED, WORKFLOW_NODE_ID_PATTERN, WORKFLOW_NODE_KINDS, } from '@dudousxd/nestjs-catalog/client';
|
|
51
|
+
workflowNarrowedTypes, WORKFLOW_BRANCH_LABELS, WORKFLOW_FILTER_COLUMN_PATTERN, WORKFLOW_FILTER_MAX_DEPTH, WORKFLOW_FILTER_MAX_VALUES, WORKFLOW_FILTER_OPERATORS, WORKFLOW_FILTER_PREDICATE_KINDS, WORKFLOW_PREDICATE_KINDS, WORKFLOW_AGGREGATE_DEFAULT_SEPARATOR, WORKFLOW_AGGREGATE_FUNCTIONS, WORKFLOW_AGGREGATE_GROUPS_CEILING, WORKFLOW_AGGREGATE_JOIN_LENGTH_CEILING, WORKFLOW_AGGREGATE_JOIN_MAX_LENGTH, WORKFLOW_AGGREGATE_MAX_AGGREGATES, WORKFLOW_AGGREGATE_MAX_GROUP_BY, WORKFLOW_AGGREGATE_MAX_GROUPS, WORKFLOW_AGGREGATE_MAX_SEPARATOR, WORKFLOW_RENAME_MAX_COLUMNS, WORKFLOW_RENAME_UNNAMED, WORKFLOW_NODE_ID_PATTERN, WORKFLOW_NODE_KINDS, } from '@dudousxd/nestjs-catalog/client';
|
|
45
52
|
import { WORKFLOW_NODE_ID_PATTERN, } from '@dudousxd/nestjs-catalog/client';
|
|
46
53
|
export function describeDurability(durability) {
|
|
47
54
|
if (!durability) {
|
package/dist/workflow/nodes.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Handle, Position } from '@xyflow/react';
|
|
3
|
-
import { CircleAlert, CircleCheck, CircleSlash, Code2, Database, ExternalLink, Filter, GitBranch, Loader2, Plug, Repeat, TextCursorInput, TriangleAlert, } from 'lucide-react';
|
|
3
|
+
import { CircleAlert, CircleCheck, CircleSlash, Code2, Database, ExternalLink, Filter, GitBranch, Loader2, Plug, Repeat, Sigma, TextCursorInput, TriangleAlert, } from 'lucide-react';
|
|
4
4
|
import { motion, useReducedMotion } from 'motion/react';
|
|
5
5
|
import { createContext, useContext, } from 'react';
|
|
6
6
|
import { cn } from '../cn';
|
|
@@ -110,6 +110,20 @@ const KIND_STYLE = {
|
|
|
110
110
|
icon: TextCursorInput,
|
|
111
111
|
noun: 'rename',
|
|
112
112
|
},
|
|
113
|
+
// Amber, and a mark that funnels. An aggregate is the one node in the graph
|
|
114
|
+
// where the row count *changes shape* rather than merely shrinking — a filter
|
|
115
|
+
// drops rows and leaves the survivors untouched, an aggregate replaces every
|
|
116
|
+
// row it read with a summary of several. It also has to stand out from the
|
|
117
|
+
// teal beside it, because a rename is provably cheap and an aggregate is
|
|
118
|
+
// cheap only while the grouping is sane, and a canvas where those two read
|
|
119
|
+
// alike hides the one node worth looking twice at.
|
|
120
|
+
aggregate: {
|
|
121
|
+
accent: 'bg-gradient-to-b from-amber-400 to-amber-600',
|
|
122
|
+
chip: 'text-amber-700 dark:text-amber-300',
|
|
123
|
+
wash: 'bg-amber-50/70 dark:bg-amber-950/30',
|
|
124
|
+
icon: Sigma,
|
|
125
|
+
noun: 'aggregate',
|
|
126
|
+
},
|
|
113
127
|
};
|
|
114
128
|
/**
|
|
115
129
|
* Handles are styled larger than React Flow's default 6px dot.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CONNECTOR_KINDS, isSafeIdentifier, physicalColumn, } from '@dudousxd/nestjs-catalog/client';
|
|
1
|
+
import { CATALOG_SOURCE_TYPE_KEY, CONNECTOR_KINDS, isSafeIdentifier, physicalColumn, } from '@dudousxd/nestjs-catalog/client';
|
|
2
2
|
export const SOURCE_KINDS = {
|
|
3
3
|
http: {
|
|
4
4
|
label: 'an HTTP endpoint',
|
|
@@ -48,6 +48,17 @@ export const SOURCE_KINDS = {
|
|
|
48
48
|
// disagree with a property name and nothing for the refusal to check.
|
|
49
49
|
keysRecordsBySourceName: false,
|
|
50
50
|
},
|
|
51
|
+
catalog: {
|
|
52
|
+
label: "this catalog's own data",
|
|
53
|
+
required: [CATALOG_SOURCE_TYPE_KEY],
|
|
54
|
+
optional: [],
|
|
55
|
+
// False, and it is the strongest `false` in this record. The rows come out
|
|
56
|
+
// of the store keyed by the *property names of the type they were read
|
|
57
|
+
// from* — that is what `read` and `streamSnapshot` both hand back — so there
|
|
58
|
+
// is no source spelling to disagree with anything. It is the one kind whose
|
|
59
|
+
// records are already in the catalog's own vocabulary.
|
|
60
|
+
keysRecordsBySourceName: false,
|
|
61
|
+
},
|
|
51
62
|
};
|
|
52
63
|
/**
|
|
53
64
|
* The kinds a file drop can arrive as, derived rather than listed.
|
|
@@ -102,6 +113,16 @@ const NODE_FACTORIES = {
|
|
|
102
113
|
// that do not exist in whatever the reader wired up — and the symptom of that
|
|
103
114
|
// is not an error, it is a target column absent from every row.
|
|
104
115
|
rename: (id, name, init) => ({ id, name, kind: 'rename', ...init }),
|
|
116
|
+
// `aggregate` arrived fifth, and the map stopped the build a fifth time.
|
|
117
|
+
//
|
|
118
|
+
// Unused by every template below, and the reason is the strongest of the
|
|
119
|
+
// five. A template's job is to make a decision once on a reader's behalf, and
|
|
120
|
+
// an aggregate is nothing *but* decisions about one dataset: which columns
|
|
121
|
+
// define a group, and which function is right for each of the rest. `max` and
|
|
122
|
+
// `min` over the same column answer different questions, and picking wrong
|
|
123
|
+
// does not error — it commits a plausible number. A prefilled aggregate would
|
|
124
|
+
// be a summary of somebody else's data, shipped with an air of authority.
|
|
125
|
+
aggregate: (id, name, init) => ({ id, name, kind: 'aggregate', ...init }),
|
|
105
126
|
};
|
|
106
127
|
/* -------------------------------------------------------------------------- */
|
|
107
128
|
/* Starter transform code */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dudousxd/nestjs-catalog-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.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",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"tailwind-merge": "3.4.1",
|
|
111
111
|
"tiptap-markdown": "0.9.0",
|
|
112
112
|
"typescript": "5.9.3",
|
|
113
|
-
"@dudousxd/nestjs-catalog": "0.
|
|
113
|
+
"@dudousxd/nestjs-catalog": "0.27.0"
|
|
114
114
|
},
|
|
115
115
|
"dependencies": {
|
|
116
116
|
"clsx": "2.1.1",
|