@dudousxd/nestjs-catalog-react 0.17.0 → 0.19.0-preview.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/README.md +39 -13
- package/dist/CatalogManager.d.ts +23 -1
- package/dist/CatalogManager.js +76 -13
- package/dist/ConnectionPanel.d.ts +11 -7
- package/dist/ConnectionPanel.js +78 -149
- package/dist/LoadedBySection.d.ts +39 -0
- package/dist/LoadedBySection.js +143 -0
- package/dist/PipelineConsole.d.ts +23 -126
- package/dist/PipelineConsole.js +39 -551
- package/dist/WorkflowCanvas.d.ts +16 -0
- package/dist/WorkflowCanvas.js +1064 -64
- package/dist/connection-form.d.ts +241 -0
- package/dist/connection-form.js +235 -0
- package/dist/context.d.ts +236 -38
- package/dist/context.js +46 -11
- package/dist/index.d.ts +10 -3
- package/dist/index.js +63 -14
- package/dist/routes.d.ts +84 -13
- package/dist/routes.js +7 -4
- package/dist/schema-discovery.d.ts +232 -0
- package/dist/schema-discovery.js +225 -0
- package/dist/source-connection.d.ts +82 -0
- package/dist/source-connection.js +176 -0
- package/dist/source-fields.d.ts +16 -14
- package/dist/source-fields.js +28 -18
- package/dist/ui/code-editor.d.ts +44 -2
- package/dist/ui/code-editor.js +10 -2
- package/dist/ui/combobox.d.ts +97 -0
- package/dist/ui/combobox.js +80 -0
- package/dist/ui/dialog.d.ts +13 -1
- package/dist/ui/dialog.js +13 -2
- package/dist/workflow/edges.d.ts +110 -0
- package/dist/workflow/edges.js +112 -0
- package/dist/workflow/graph.d.ts +39 -1
- package/dist/workflow/graph.js +212 -52
- package/dist/workflow/index.d.ts +8 -0
- package/dist/workflow/index.js +12 -0
- package/dist/workflow/lifecycle.d.ts +135 -0
- package/dist/workflow/lifecycle.js +216 -0
- package/dist/workflow/model.d.ts +17 -3
- package/dist/workflow/model.js +7 -2
- package/dist/workflow/nodes.d.ts +4 -1
- package/dist/workflow/nodes.js +198 -10
- package/dist/workflow/runs.d.ts +38 -0
- package/dist/workflow/runs.js +101 -0
- package/dist/workflow/shape.d.ts +169 -0
- package/dist/workflow/shape.js +249 -0
- package/dist/workflow/templates.d.ts +623 -0
- package/dist/workflow/templates.js +1102 -0
- package/dist/workflow/validate.d.ts +20 -1
- package/dist/workflow/validate.js +52 -3
- package/dist/workflow/wiring.d.ts +84 -0
- package/dist/workflow/wiring.js +254 -0
- package/package.json +9 -9
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* What happens to a graph after it is drawn: publish it, schedule it, run it.
|
|
4
|
+
*
|
|
5
|
+
* WHY THESE ARE ONE MODULE AND NOT PART OF THE CANVAS
|
|
6
|
+
* ---------------------------------------------------
|
|
7
|
+
* They arrived together, from a screen that no longer exists. Publishing,
|
|
8
|
+
* scheduling and running-with-an-acknowledgement all used to be connector
|
|
9
|
+
* concerns reached from `#connectors`; the connector stopped being something
|
|
10
|
+
* anybody authors, so all three landed on the graph. Putting them in the canvas
|
|
11
|
+
* file would have added four dialogs and three mutations to a component that is
|
|
12
|
+
* already the largest thing in this package, and none of them touch React Flow —
|
|
13
|
+
* which is also what lets this module be imported without a canvas at all.
|
|
14
|
+
*
|
|
15
|
+
* THE ONE THING TO BE CAREFUL WITH
|
|
16
|
+
* --------------------------------
|
|
17
|
+
* `expectShrink`. It is the only way an operator can re-drive a load the
|
|
18
|
+
* row-count bound refused, and it exists on exactly one route now. The
|
|
19
|
+
* alternative, when it is not reachable, is not "the load stays refused" — it is
|
|
20
|
+
* somebody raising `rowCount.maxShrink` in the type's policy, which stands the
|
|
21
|
+
* guard down for every future load of that type instead of for the one snapshot
|
|
22
|
+
* in front of them. So it is a visible control, it says what it does where it is
|
|
23
|
+
* used, and it will not send a blank reason.
|
|
24
|
+
*/
|
|
25
|
+
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
26
|
+
import { CircleCheck, Clock, Loader2, Play, TriangleAlert, Undo2, Upload } from 'lucide-react';
|
|
27
|
+
import { useState } from 'react';
|
|
28
|
+
import { cn } from '../cn';
|
|
29
|
+
import { catalogQueryKeys, useCatalogClient, } from '../context';
|
|
30
|
+
import { Button } from '../ui/button';
|
|
31
|
+
import { ConfirmDialog } from '../ui/dialog';
|
|
32
|
+
import { TextAreaField, TextField } from '../ui/field';
|
|
33
|
+
import { Switch } from '../ui/switch';
|
|
34
|
+
import { Tooltip } from '../ui/tooltip';
|
|
35
|
+
import { WORKFLOW_NAME } from './name';
|
|
36
|
+
const MUTED = 'text-zinc-400 dark:text-zinc-500';
|
|
37
|
+
const RULE = 'border-zinc-200 dark:border-zinc-800';
|
|
38
|
+
const PANEL = 'bg-white dark:bg-zinc-900';
|
|
39
|
+
/**
|
|
40
|
+
* Whether a failure is the row-count bound refusing a load, rather than
|
|
41
|
+
* anything else that can go wrong in a run.
|
|
42
|
+
*
|
|
43
|
+
* Matched on the label the refusal names, which is the one token in that
|
|
44
|
+
* sentence that is not prose: the message ends by telling the reader to set
|
|
45
|
+
* `_expectShrink` in the load's labels or raise `rowCount.maxShrink`, and this
|
|
46
|
+
* screen is the place that can do the first of those in one click.
|
|
47
|
+
*
|
|
48
|
+
* A miss costs nothing — the acknowledgement control is on screen regardless,
|
|
49
|
+
* and this only decides whether the refusal itself grows a way straight into it.
|
|
50
|
+
* That is deliberately the weaker of the two paths: a console that could offer
|
|
51
|
+
* the escape hatch *only* after a refusal would be a console where an operator
|
|
52
|
+
* who already knows a truncation is coming has to trigger a failed load first.
|
|
53
|
+
*/
|
|
54
|
+
export function refusedForShrink(message) {
|
|
55
|
+
return typeof message === 'string' && message.includes('_expectShrink');
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Draft or ready, and — where it applies — who decided.
|
|
59
|
+
*
|
|
60
|
+
* Rendered even for `draft`, which is the status a screen is tempted to leave
|
|
61
|
+
* unsaid because it is the default. It is not decoration: a draft cannot be
|
|
62
|
+
* scheduled and does not run on its own, so "why did my pipeline not fire last
|
|
63
|
+
* night" has its answer here.
|
|
64
|
+
*/
|
|
65
|
+
export function WorkflowStatusBadge({ workflow }) {
|
|
66
|
+
const ready = workflow.status === 'ready';
|
|
67
|
+
return (_jsxs("span", { className: "flex flex-wrap items-center gap-1.5", children: [_jsx(Tooltip, { content: ready
|
|
68
|
+
? `Declared finished, and validated when it was. It runs as a connector of its own, and only a ready ${WORKFLOW_NAME.singular} can be scheduled.`
|
|
69
|
+
: 'Being drawn. It saves without being validated — that is what a draft is for — and it neither runs on a schedule nor mints anything. Publishing is where the checks are answered for real.', children: _jsx("span", { className: cn('cursor-help rounded-sm px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-[0.12em]', ready
|
|
70
|
+
? 'bg-emerald-100 text-emerald-800 dark:bg-emerald-950 dark:text-emerald-300'
|
|
71
|
+
: 'bg-zinc-100 text-zinc-600 dark:bg-zinc-800 dark:text-zinc-300'), children: workflow.status }) }), !workflow.enabled && (_jsx(Tooltip, { content: "Turned off. It keeps its configuration, its schedule and its incremental watermark, and refuses to fire.", children: _jsx("span", { className: cn('cursor-help rounded-sm bg-zinc-100 px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-[0.12em]', 'text-zinc-600 dark:bg-zinc-800 dark:text-zinc-300'), children: "disabled" }) }))] }));
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Publish, or take it back to draft.
|
|
75
|
+
*
|
|
76
|
+
* Publishing is not offered while the canvas has unsaved edits, and that is the
|
|
77
|
+
* one place on this screen where blocking is right: publishing validates the
|
|
78
|
+
* STORED graph, so pressing it with edits on screen would report on a shape
|
|
79
|
+
* nobody is looking at — and, worse, would succeed on it.
|
|
80
|
+
*
|
|
81
|
+
* The local checks do not gate it. They cannot see which types exist or who may
|
|
82
|
+
* write to them, and a rule that is subtly wrong here would become a graph
|
|
83
|
+
* nobody can publish with no error to read. The server refuses, in its own
|
|
84
|
+
* words, and those words are what gets rendered.
|
|
85
|
+
*/
|
|
86
|
+
export function PublishControls({ workflow, dirty, canEdit, onPublished, }) {
|
|
87
|
+
const client = useCatalogClient();
|
|
88
|
+
const queryClient = useQueryClient();
|
|
89
|
+
const [confirmingUnpublish, setConfirmingUnpublish] = useState(false);
|
|
90
|
+
const invalidate = () => {
|
|
91
|
+
queryClient.invalidateQueries({ queryKey: catalogQueryKeys.workflows });
|
|
92
|
+
// The connector is minted, disabled or removed by these two, and it is
|
|
93
|
+
// where the run history is keyed — a stale read shows a pipeline that is
|
|
94
|
+
// ready beside "nothing runs this yet".
|
|
95
|
+
queryClient.invalidateQueries({ queryKey: catalogQueryKeys.connectors });
|
|
96
|
+
};
|
|
97
|
+
const publish = useMutation({
|
|
98
|
+
mutationFn: () => client.publishWorkflow(workflow.id),
|
|
99
|
+
onSuccess: (saved) => {
|
|
100
|
+
onPublished(saved);
|
|
101
|
+
invalidate();
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
const unpublish = useMutation({
|
|
105
|
+
mutationFn: () => client.unpublishWorkflow(workflow.id),
|
|
106
|
+
onSuccess: (saved) => {
|
|
107
|
+
setConfirmingUnpublish(false);
|
|
108
|
+
onPublished(saved);
|
|
109
|
+
invalidate();
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
return (_jsxs(_Fragment, { children: [workflow.status === 'ready' ? (_jsx(Tooltip, { content: "Back to draft. The connector it runs as is disabled and keeps its id, its run history and its watermark, so publishing again resumes this workflow rather than starting a second one beside it.", children: _jsxs(Button, { variant: "outline", size: "sm", onClick: () => setConfirmingUnpublish(true), disabled: !canEdit || unpublish.isPending, children: [unpublish.isPending ? (_jsx(Loader2, { size: 12, className: "animate-spin" })) : (_jsx(Undo2, { size: 12 })), "Unpublish"] }) })) : (_jsx(Tooltip, { content: dirty
|
|
113
|
+
? 'Save first — publishing validates the stored graph, not what is on screen.'
|
|
114
|
+
: `Declare it finished. The server validates it and, if it passes, mints the connector this ${WORKFLOW_NAME.singular} runs as — which is what makes it schedulable and what a run history is keyed on.`, children: _jsxs(Button, { size: "sm", onClick: () => publish.mutate(), disabled: !canEdit || dirty || publish.isPending, children: [publish.isPending ? (_jsx(Loader2, { size: 12, className: "animate-spin" })) : (_jsx(Upload, { size: 12 })), "Publish"] }) })), _jsx(Refusal, { lead: "Publishing was refused:", error: publish.error }), !confirmingUnpublish && _jsx(Refusal, { lead: "Could not unpublish it:", error: unpublish.error }), _jsx(ConfirmDialog, { open: confirmingUnpublish, onOpenChange: setConfirmingUnpublish, destructive: false, title: `Take "${workflow.name}" back to draft?`, description: "It stops running: the connector behind it is disabled, and a schedule on it will not fire. Nothing is lost \u2014 the id, the run history and the incremental watermark stay, so publishing again picks the same workflow back up rather than starting a second one from the beginning.", confirmLabel: unpublish.isPending ? 'Unpublishing…' : 'Unpublish', pending: unpublish.isPending, onConfirm: () => unpublish.mutate(), error: reasonFrom(unpublish.error) })] }));
|
|
115
|
+
}
|
|
116
|
+
/** What went wrong, in the server's words, or nothing at all. */
|
|
117
|
+
function Refusal({ lead, error }) {
|
|
118
|
+
const reason = reasonFrom(error);
|
|
119
|
+
if (!reason)
|
|
120
|
+
return null;
|
|
121
|
+
return (_jsxs("p", { className: "basis-full text-[11px] text-red-600", children: [lead, " ", reason] }));
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* The sentence out of a rejection, or `undefined` when nothing was rejected.
|
|
125
|
+
*
|
|
126
|
+
* One place, because the alternative is the nested ternary this file had three
|
|
127
|
+
* copies of — and the branch that is easy to get wrong is the middle one: a
|
|
128
|
+
* rejection that is not an `Error` still has to say something, or a refusal
|
|
129
|
+
* renders as blank space where a reason belongs.
|
|
130
|
+
*/
|
|
131
|
+
function reasonFrom(error) {
|
|
132
|
+
if (!error)
|
|
133
|
+
return undefined;
|
|
134
|
+
return error instanceof Error ? error.message : 'no reason given.';
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Run it now, and the one thing a run may be told about itself.
|
|
138
|
+
*
|
|
139
|
+
* Two controls rather than one, and deliberately not a checkbox tucked beside
|
|
140
|
+
* the button: an acknowledgement that a load is expected to lose most of its
|
|
141
|
+
* rows is not a preference, it is a statement somebody signs. The second control
|
|
142
|
+
* opens a dialog that says exactly what it is about to do and refuses to submit
|
|
143
|
+
* without a reason — the reason is written into the snapshot's labels and is the
|
|
144
|
+
* only answer anybody will have in six months to "why was this load allowed to
|
|
145
|
+
* collapse?".
|
|
146
|
+
*
|
|
147
|
+
* It is on screen always, not only after a refusal. An operator who already
|
|
148
|
+
* knows a base is being cut should not have to trigger a failed load first in
|
|
149
|
+
* order to be offered the way through it.
|
|
150
|
+
*/
|
|
151
|
+
export function RunControls({ workflowId, dirty, canEdit, running, durabilityDetail, acknowledging, onAcknowledgingChange, onRun, }) {
|
|
152
|
+
const [reason, setReason] = useState('');
|
|
153
|
+
const blocked = !canEdit || !workflowId || dirty || running;
|
|
154
|
+
return (_jsxs(_Fragment, { children: [_jsx(Tooltip, { content: dirty
|
|
155
|
+
? 'Save first — a run executes the stored graph, not what is on screen.'
|
|
156
|
+
: durabilityDetail, children: _jsxs(Button, { variant: "outline", size: "sm", onClick: () => onRun(), disabled: blocked, children: [running ? _jsx(Loader2, { size: 12, className: "animate-spin" }) : _jsx(Play, { size: 12 }), "Run"] }) }), _jsx(Tooltip, { content: "Run, saying up front that this load is expected to lose rows. Use it when a source really was truncated or cut back \u2014 it stands the row-count bound down for this one snapshot instead of for every future load of the type.", children: _jsx(Button, { variant: "outline", size: "icon", "aria-label": "Run, acknowledging that this load is expected to lose rows", onClick: () => {
|
|
157
|
+
setReason('');
|
|
158
|
+
onAcknowledgingChange(true);
|
|
159
|
+
}, disabled: blocked, children: _jsx(TriangleAlert, { size: 12 }) }) }), _jsx(ConfirmDialog, { open: acknowledging, onOpenChange: onAcknowledgingChange, destructive: false, title: "Run, expecting this load to shrink?", description: _jsxs("span", { className: "block space-y-2.5", children: [_jsxs("span", { className: "block", children: ["A load that loses more rows than the type allows is refused and the previous snapshot keeps serving \u2014 because a broken ", _jsx("code", { children: "WHERE" }), ", a source-side filter change and a partial outage all look exactly like this, and the data would be fresh and wrong."] }), _jsxs("span", { className: "block", children: ["This acknowledgement stands that bound down ", _jsx("strong", { children: "for this run only" }), ". The alternative \u2014 raising the type's ", _jsx("code", { children: "rowCount.maxShrink" }), " \u2014 turns the guard off for every load of it from now on, including the ones nobody is watching."] }), _jsx(TextAreaField, { label: "Why is this load expected to lose rows?", value: reason, onChange: setReason, rows: 3, placeholder: "e.g. Hurlburt was cut from the feed on the 3rd; this is the first load without it.", hint: "Stored in the snapshot's labels, so the load itself carries the answer. A blank reason is refused \u2014 an acknowledgement nobody can explain later is worth nothing." })] }), confirmLabel: running ? 'Running…' : 'Run with this reason', pending: running, confirmDisabled: reason.trim().length === 0, onConfirm: () => {
|
|
160
|
+
onAcknowledgingChange(false);
|
|
161
|
+
onRun({ expectShrink: reason.trim() });
|
|
162
|
+
} })] }));
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* When this graph runs on its own.
|
|
166
|
+
*
|
|
167
|
+
* Its own write, `PUT workflows/:id/schedule`, rather than fields folded into
|
|
168
|
+
* the save the canvas performs on every drag — a cron that rides along with an
|
|
169
|
+
* autosave is one a stale tab can silently revert.
|
|
170
|
+
*
|
|
171
|
+
* The `warning` is the reason this panel does not just show a text box. There
|
|
172
|
+
* are several ways to store a cron that will never fire — the graph is a draft,
|
|
173
|
+
* the graph is disabled, the expression does not parse — and the incident behind
|
|
174
|
+
* this route is a scheduler that logged it was watching schedules every 30
|
|
175
|
+
* seconds while parsing nothing. The server names which one, and this prints it.
|
|
176
|
+
*/
|
|
177
|
+
export function SchedulePanel({ workflow, canEdit, onScheduled, }) {
|
|
178
|
+
const client = useCatalogClient();
|
|
179
|
+
const queryClient = useQueryClient();
|
|
180
|
+
const [schedule, setSchedule] = useState(workflow.schedule ?? '');
|
|
181
|
+
const [enabled, setEnabled] = useState(workflow.enabled);
|
|
182
|
+
const save = useMutation({
|
|
183
|
+
mutationFn: () => client.scheduleWorkflow(workflow.id, { schedule, enabled }),
|
|
184
|
+
onSuccess: (saved) => {
|
|
185
|
+
onScheduled(saved);
|
|
186
|
+
queryClient.invalidateQueries({ queryKey: catalogQueryKeys.workflows });
|
|
187
|
+
queryClient.invalidateQueries({ queryKey: catalogQueryKeys.connectors });
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
const changed = schedule !== (workflow.schedule ?? '') || enabled !== workflow.enabled;
|
|
191
|
+
return (_jsxs("section", { className: cn('rounded-lg border p-3', RULE, PANEL), children: [_jsxs("h2", { className: cn('flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: [_jsx(Clock, { size: 10, "aria-hidden": true }), "Schedule"] }), _jsxs("div", { className: "mt-2 space-y-2", children: [_jsx(TextField, { label: "Cron", value: schedule, onChange: setSchedule, placeholder: "0 3 * * *", disabled: !canEdit, hint: "Empty means this only runs when somebody presses Run." }), _jsx(Switch, { checked: enabled, onCheckedChange: setEnabled, label: "Enabled", hint: "Off keeps the cron, the configuration and the watermark, and refuses to fire.", disabled: !canEdit }), canEdit && (_jsxs(Button, { variant: "outline", size: "sm", onClick: () => save.mutate(), disabled: !changed || save.isPending, children: [save.isPending ? _jsx(Loader2, { size: 12, className: "animate-spin" }) : null, changed ? 'Save schedule' : 'Schedule saved'] }))] }), workflow.status !== 'ready' && (_jsx("p", { className: "mt-2 text-[11px] leading-relaxed text-amber-700 dark:text-amber-400", children: "This is a draft, so nothing here will fire whatever the cron says. Publish it first \u2014 scheduling a graph nobody has declared finished is a load nobody approved." })), save.data?.warning ? (_jsxs("p", { className: "mt-2 flex items-start gap-1.5 text-[11px] leading-relaxed text-amber-700 dark:text-amber-400", children: [_jsx(TriangleAlert, { size: 11, className: "mt-0.5 shrink-0", "aria-hidden": true }), save.data.warning] })) : null, save.isSuccess && !save.data?.warning && !changed && (_jsxs("p", { className: "mt-2 flex items-center gap-1.5 text-[11px] text-emerald-600", children: [_jsx(CircleCheck, { size: 11, "aria-hidden": true }), "Stored. The scheduler reads this graph, not the connector behind it."] })), save.error && (_jsx("p", { className: "mt-2 text-[11px] text-red-600", children: save.error instanceof Error ? save.error.message : 'Could not store the schedule.' }))] }));
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* A run that was refused by the row-count bound, with the way through it.
|
|
195
|
+
*
|
|
196
|
+
* The refusal itself is the server's sentence and is printed whole. What this
|
|
197
|
+
* adds is the one action that answers it, at the moment somebody is reading the
|
|
198
|
+
* reason — because the alternative they will otherwise reach for is the type's
|
|
199
|
+
* policy, which is the wrong lever and the hard one to put back.
|
|
200
|
+
*/
|
|
201
|
+
export function ShrinkRefusalNote({ run, error, onAcknowledge, }) {
|
|
202
|
+
const message = error instanceof Error ? error.message : (run?.error ?? runNodeError(run) ?? undefined);
|
|
203
|
+
if (!refusedForShrink(message))
|
|
204
|
+
return null;
|
|
205
|
+
return (_jsxs("div", { className: "mt-2 rounded-md border border-amber-300 bg-amber-50 px-3 py-2 dark:border-amber-900 dark:bg-amber-950/30", children: [_jsx("p", { className: "text-[11px] leading-relaxed text-amber-800 dark:text-amber-200", children: message }), _jsx("p", { className: "mt-1.5 text-[11px] leading-relaxed text-amber-700 dark:text-amber-300", children: "If the load is right, re-drive it with a reason. That acknowledges this snapshot and nothing else \u2014 raising the type's bound would stand the guard down for every load of it from now on." }), _jsxs(Button, { variant: "outline", size: "sm", className: "mt-2", onClick: onAcknowledge, children: [_jsx(TriangleAlert, { size: 12 }), "Re-run, acknowledging the shrink"] })] }));
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* The first node error in a run, when the run itself carries none.
|
|
209
|
+
*
|
|
210
|
+
* A sink that refuses is one failed node in an otherwise ordinary run, and
|
|
211
|
+
* depending on whether the graph ran durably the refusal can land on the node
|
|
212
|
+
* rather than on the run. Reading both is cheaper than caring which.
|
|
213
|
+
*/
|
|
214
|
+
function runNodeError(run) {
|
|
215
|
+
return run?.nodes.find((node) => typeof node.error === 'string' && node.error.length > 0)?.error;
|
|
216
|
+
}
|
package/dist/workflow/model.d.ts
CHANGED
|
@@ -18,9 +18,9 @@
|
|
|
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 { CatalogWorkflow, WorkflowEdge, WorkflowGraph, WorkflowNode, WorkflowNodeKind, WorkflowSinkNode, WorkflowSourceNode, WorkflowTransformNode, } from '@dudousxd/nestjs-catalog/client';
|
|
22
|
-
export { isWorkflowNodeKind, WORKFLOW_NODE_ID_PATTERN, WORKFLOW_NODE_KINDS, } from '@dudousxd/nestjs-catalog/client';
|
|
23
|
-
import { type WorkflowNode } from '@dudousxd/nestjs-catalog/client';
|
|
21
|
+
export type { CallableWorkflowBlock, CallableWorkflowDisagreement, CallableWorkflowRef, CatalogWorkflow, WorkflowBranchLabel, WorkflowEdge, WorkflowCallNode, WorkflowEnvPredicate, WorkflowGraph, WorkflowIfNode, WorkflowIfPredicate, WorkflowNode, WorkflowNodeKind, WorkflowPredicateKind, WorkflowRowCountPredicate, WorkflowSinkNode, WorkflowSkipReason, WorkflowSourceNode, WorkflowTransformNode, } from '@dudousxd/nestjs-catalog/client';
|
|
22
|
+
export { callableWorkflowBlock, isWorkflowBranchLabel, isWorkflowNodeKind, isWorkflowPredicateKind, unreachableNodeKind, unreachablePredicateKind, WORKFLOW_BRANCH_LABELS, WORKFLOW_PREDICATE_KINDS, WORKFLOW_NODE_ID_PATTERN, WORKFLOW_NODE_KINDS, } from '@dudousxd/nestjs-catalog/client';
|
|
23
|
+
import { type WorkflowBranchLabel, type WorkflowNode, type WorkflowSkipReason } from '@dudousxd/nestjs-catalog/client';
|
|
24
24
|
/**
|
|
25
25
|
* What a caller may set.
|
|
26
26
|
*
|
|
@@ -117,6 +117,20 @@ export interface WorkflowRunNode {
|
|
|
117
117
|
* nowhere else to read it from.
|
|
118
118
|
*/
|
|
119
119
|
replayed?: boolean;
|
|
120
|
+
/** Which branch an `if` node took on this run. See {@link WorkflowIfNode}. */
|
|
121
|
+
branch?: WorkflowBranchLabel;
|
|
122
|
+
/**
|
|
123
|
+
* Why a `skipped` node did not run, when a branch is the reason rather than a
|
|
124
|
+
* failure above it.
|
|
125
|
+
*
|
|
126
|
+
* The distinction a run panel exists to draw for a **sink**: skipped by a
|
|
127
|
+
* branch means it committed nothing *and was right not to*, so the snapshot
|
|
128
|
+
* that was live before the run is still live. Skipped with no reason means the
|
|
129
|
+
* run fell over before reaching it. Rendering the two identically would answer
|
|
130
|
+
* "why is there no fresh data in X" with the same shrug for a healthy run and
|
|
131
|
+
* a broken one.
|
|
132
|
+
*/
|
|
133
|
+
skippedBecause?: WorkflowSkipReason;
|
|
120
134
|
rows?: number;
|
|
121
135
|
error?: string;
|
|
122
136
|
startedAt?: string;
|
package/dist/workflow/model.js
CHANGED
|
@@ -18,8 +18,13 @@
|
|
|
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 {
|
|
22
|
-
|
|
21
|
+
export {
|
|
22
|
+
// Whether an announced workflow may be committed onto a call node. Core's,
|
|
23
|
+
// not a copy: the picker greys an entry out and the server reasons about the
|
|
24
|
+
// same list, and two copies of that rule is a picker that eventually offers
|
|
25
|
+
// something the rest of the system will not accept.
|
|
26
|
+
callableWorkflowBlock, isWorkflowBranchLabel, isWorkflowNodeKind, isWorkflowPredicateKind, unreachableNodeKind, unreachablePredicateKind, WORKFLOW_BRANCH_LABELS, WORKFLOW_PREDICATE_KINDS, WORKFLOW_NODE_ID_PATTERN, WORKFLOW_NODE_KINDS, } from '@dudousxd/nestjs-catalog/client';
|
|
27
|
+
import { WORKFLOW_NODE_ID_PATTERN, } from '@dudousxd/nestjs-catalog/client';
|
|
23
28
|
export function describeDurability(durability) {
|
|
24
29
|
if (!durability) {
|
|
25
30
|
return {
|
package/dist/workflow/nodes.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type NodeProps } from '@xyflow/react';
|
|
2
2
|
import { type ReactNode } from 'react';
|
|
3
|
-
import type
|
|
3
|
+
import { type WorkflowFlowNode } from './graph';
|
|
4
|
+
import type { WorkflowWiring } from './wiring';
|
|
4
5
|
/**
|
|
5
6
|
* What a node can reach without being handed a callback in its `data`.
|
|
6
7
|
*
|
|
@@ -20,6 +21,8 @@ interface WorkflowNodeHandlers {
|
|
|
20
21
|
onEditCode(nodeId: string): void;
|
|
21
22
|
/** Whether editing is offered at all. */
|
|
22
23
|
canEdit: boolean;
|
|
24
|
+
/** Click-to-click wiring: what a click on a handle does, and what is in flight. */
|
|
25
|
+
wiring: WorkflowWiring;
|
|
23
26
|
}
|
|
24
27
|
export declare function WorkflowNodeProvider({ handlers, children, }: {
|
|
25
28
|
handlers: WorkflowNodeHandlers;
|
package/dist/workflow/nodes.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
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, Code2, Database, Loader2, Plug, Repeat, TriangleAlert, } from 'lucide-react';
|
|
4
|
-
import {
|
|
3
|
+
import { CircleAlert, CircleCheck, CircleSlash, Code2, Database, ExternalLink, GitBranch, Loader2, Plug, Repeat, TriangleAlert, } from 'lucide-react';
|
|
4
|
+
import { motion, useReducedMotion } from 'motion/react';
|
|
5
|
+
import { createContext, useContext, } from 'react';
|
|
5
6
|
import { cn } from '../cn';
|
|
6
7
|
import { Tooltip } from '../ui/tooltip';
|
|
8
|
+
import { NODE_WIDTH } from './graph';
|
|
7
9
|
const RULE = 'border-zinc-200 dark:border-zinc-800';
|
|
8
10
|
const PANEL = 'bg-white dark:bg-zinc-900';
|
|
9
11
|
const MUTED = 'text-zinc-400 dark:text-zinc-500';
|
|
@@ -18,25 +20,69 @@ function useWorkflowNodeHandlers() {
|
|
|
18
20
|
}
|
|
19
21
|
return handlers;
|
|
20
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* The per-kind palette, in three coordinated pieces rather than one accent.
|
|
25
|
+
*
|
|
26
|
+
* `accent` is the rail down the left edge, `chip` colours the icon and the kind
|
|
27
|
+
* word, and `wash` tints the strip they sit in. Three tokens per kind rather
|
|
28
|
+
* than one, because a single accent bar on an otherwise identical white box
|
|
29
|
+
* meant the four kinds were told apart by four pixels of colour — which at the
|
|
30
|
+
* zoom people actually work at is no difference at all.
|
|
31
|
+
*
|
|
32
|
+
* Every entry names a `dark:` variant, and that is not decoration: this canvas
|
|
33
|
+
* is embedded in a host whose theme it follows (see `CANVAS_THEME`), and a
|
|
34
|
+
* colour with no dark counterpart is the failure mode that has bitten the
|
|
35
|
+
* dropdowns in this package before — legible on the theme it was written on,
|
|
36
|
+
* unreadable on the other.
|
|
37
|
+
*
|
|
38
|
+
* The rail is a gradient rather than a flat fill. It is 4px wide and runs the
|
|
39
|
+
* full height of the box, which is exactly the shape where a flat fill reads as
|
|
40
|
+
* a printing error and a gradient reads as an edge — and it is the only piece of
|
|
41
|
+
* a node that carries its kind at a glance from across the canvas.
|
|
42
|
+
*/
|
|
21
43
|
const KIND_STYLE = {
|
|
22
44
|
source: {
|
|
23
|
-
accent: 'bg-sky-
|
|
45
|
+
accent: 'bg-gradient-to-b from-sky-400 to-sky-600',
|
|
24
46
|
chip: 'text-sky-700 dark:text-sky-300',
|
|
47
|
+
wash: 'bg-sky-50/70 dark:bg-sky-950/30',
|
|
25
48
|
icon: Plug,
|
|
26
49
|
noun: 'source',
|
|
27
50
|
},
|
|
28
51
|
transform: {
|
|
29
|
-
accent: 'bg-
|
|
30
|
-
chip: 'text-
|
|
52
|
+
accent: 'bg-gradient-to-b from-violet-400 to-violet-600',
|
|
53
|
+
chip: 'text-violet-700 dark:text-violet-300',
|
|
54
|
+
wash: 'bg-violet-50/70 dark:bg-violet-950/30',
|
|
31
55
|
icon: Repeat,
|
|
32
56
|
noun: 'transform',
|
|
33
57
|
},
|
|
34
58
|
sink: {
|
|
35
|
-
accent: 'bg-emerald-
|
|
59
|
+
accent: 'bg-gradient-to-b from-emerald-400 to-emerald-600',
|
|
36
60
|
chip: 'text-emerald-700 dark:text-emerald-300',
|
|
61
|
+
wash: 'bg-emerald-50/70 dark:bg-emerald-950/30',
|
|
37
62
|
icon: Database,
|
|
38
63
|
noun: 'sink',
|
|
39
64
|
},
|
|
65
|
+
// Amber and its own icon, because a call is the one node whose work does not
|
|
66
|
+
// happen here: the box on the canvas is a handle on a workflow somebody else
|
|
67
|
+
// owns, and it should not read as another transform.
|
|
68
|
+
call: {
|
|
69
|
+
accent: 'bg-gradient-to-b from-amber-400 to-amber-600',
|
|
70
|
+
chip: 'text-amber-700 dark:text-amber-300',
|
|
71
|
+
wash: 'bg-amber-50/70 dark:bg-amber-950/30',
|
|
72
|
+
icon: ExternalLink,
|
|
73
|
+
noun: 'call',
|
|
74
|
+
},
|
|
75
|
+
// Violet and a fork, because an if is the only node whose effect is on the
|
|
76
|
+
// *graph* rather than on the rows: everything else here does something to
|
|
77
|
+
// data, and this one decides which boxes exist for this run. It should not
|
|
78
|
+
// read as another step in the line.
|
|
79
|
+
if: {
|
|
80
|
+
accent: 'bg-gradient-to-b from-fuchsia-400 to-fuchsia-600',
|
|
81
|
+
chip: 'text-fuchsia-700 dark:text-fuchsia-300',
|
|
82
|
+
wash: 'bg-fuchsia-50/70 dark:bg-fuchsia-950/30',
|
|
83
|
+
icon: GitBranch,
|
|
84
|
+
noun: 'if',
|
|
85
|
+
},
|
|
40
86
|
};
|
|
41
87
|
/**
|
|
42
88
|
* Handles are styled larger than React Flow's default 6px dot.
|
|
@@ -46,11 +92,76 @@ const KIND_STYLE = {
|
|
|
46
92
|
* drag on one. `connectionRadius` on the canvas widens the drop zone; this
|
|
47
93
|
* widens what you can see to aim at.
|
|
48
94
|
*/
|
|
49
|
-
const HANDLE = cn('!h-3 !w-3 !rounded-full !border-2', '!border-zinc-300 !bg-white dark:!border-zinc-600 dark:!bg-zinc-800',
|
|
95
|
+
const HANDLE = cn('!h-3 !w-3 !rounded-full !border-2 !transition-all !duration-150', '!border-zinc-300 !bg-white dark:!border-zinc-600 dark:!bg-zinc-800',
|
|
96
|
+
// A pointer, not a crosshair: a click is now enough. See `wiring.tsx`.
|
|
97
|
+
'!cursor-pointer',
|
|
98
|
+
// Grows under the pointer, so the thing you are about to click
|
|
99
|
+
// acknowledges you before you commit to it.
|
|
100
|
+
'hover:!scale-125 hover:!border-violet-400', 'focus-visible:!outline-none focus-visible:!ring-2 focus-visible:!ring-sky-500/50',
|
|
50
101
|
// React Flow adds these while a connection is being dragged. Colouring them
|
|
51
102
|
// is what makes an illegal target — one that would close a loop, or a source
|
|
52
103
|
// that takes no input — visibly refuse *before* the mouse is released.
|
|
53
104
|
'[.react-flow__handle-connecting&]:!border-red-500', '[.react-flow__handle-valid&]:!border-emerald-500 [.react-flow__handle-valid&]:!bg-emerald-500');
|
|
105
|
+
const HANDLE_WIRING = {
|
|
106
|
+
idle: '',
|
|
107
|
+
origin: '!border-violet-500 !bg-violet-500 !ring-4 !ring-violet-500/25',
|
|
108
|
+
open: cn('!border-emerald-500 !bg-emerald-500 !ring-4 !ring-emerald-500/25', 'motion-safe:!animate-pulse'),
|
|
109
|
+
shut: '!opacity-20',
|
|
110
|
+
};
|
|
111
|
+
function handleWiringState(wiring, nodeId, type) {
|
|
112
|
+
const { pending } = wiring;
|
|
113
|
+
if (!pending)
|
|
114
|
+
return 'idle';
|
|
115
|
+
if (pending.nodeId === nodeId && pending.type === type)
|
|
116
|
+
return 'origin';
|
|
117
|
+
return wiring.accepts(nodeId, type) ? 'open' : 'shut';
|
|
118
|
+
}
|
|
119
|
+
/** The box's version of {@link handleWiringState}. Drawn on the whole node. */
|
|
120
|
+
function nodeWiringState(wiring, nodeId) {
|
|
121
|
+
if (!wiring.pending)
|
|
122
|
+
return 'idle';
|
|
123
|
+
if (wiring.pending.nodeId === nodeId)
|
|
124
|
+
return 'origin';
|
|
125
|
+
if (wiring.accepts(nodeId, 'target') || wiring.accepts(nodeId, 'source'))
|
|
126
|
+
return 'open';
|
|
127
|
+
return 'shut';
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* The props that turn a handle into something a click, or a key, can operate.
|
|
131
|
+
*
|
|
132
|
+
* Spread onto `<Handle>` rather than written inline twice, because the two
|
|
133
|
+
* handles differ only in which side of the node they are. React Flow spreads its
|
|
134
|
+
* own rest props last, so an `onClick` given here is the one that runs — and the
|
|
135
|
+
* canvas turns `connectOnClick` off besides, so there is exactly one click path
|
|
136
|
+
* and it is this one. `onMouseDown` is untouched: that is where the drag lives,
|
|
137
|
+
* and the drag still works.
|
|
138
|
+
*
|
|
139
|
+
* `role`/`tabIndex`/`onKeyDown` because a handle is now a control, and a control
|
|
140
|
+
* that only a pointer can reach is not one. React Flow renders a `<div>`, so the
|
|
141
|
+
* button semantics have to be stated rather than inherited.
|
|
142
|
+
*/
|
|
143
|
+
function wireOn(nodeId, type, wiring) {
|
|
144
|
+
const start = () => wiring.onHandleClick(nodeId, type);
|
|
145
|
+
return {
|
|
146
|
+
role: 'button',
|
|
147
|
+
tabIndex: 0,
|
|
148
|
+
onClick: (event) => {
|
|
149
|
+
// Kept off the node underneath, which would otherwise read the same click
|
|
150
|
+
// as "open this node's inspector" and cover the canvas with a sheet.
|
|
151
|
+
event.stopPropagation();
|
|
152
|
+
start();
|
|
153
|
+
},
|
|
154
|
+
onKeyDown: (event) => {
|
|
155
|
+
if (event.key !== 'Enter' && event.key !== ' ')
|
|
156
|
+
return;
|
|
157
|
+
// Space on a focused element scrolls the page by default, and Enter would
|
|
158
|
+
// reach the node's own key handling.
|
|
159
|
+
event.preventDefault();
|
|
160
|
+
event.stopPropagation();
|
|
161
|
+
start();
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
}
|
|
54
165
|
function RunBadge({ run }) {
|
|
55
166
|
if (run.status === 'running') {
|
|
56
167
|
return (_jsx(Tooltip, { content: "Running now.", children: _jsx("span", { className: "flex items-center", children: _jsx(Loader2, { size: 11, className: "animate-spin text-sky-500" }) }) }));
|
|
@@ -63,17 +174,94 @@ function RunBadge({ run }) {
|
|
|
63
174
|
? // The single most useful fact on a resumed run, and there is
|
|
64
175
|
// nowhere else on the screen to read it from.
|
|
65
176
|
'Replayed from a checkpoint — this step did not run again.'
|
|
66
|
-
:
|
|
177
|
+
: `${describeBranchTaken(run) ?? 'Ran'}${typeof run.rows === 'number' ? `, ${run.rows} rows` : ''}.`, children: _jsx("span", { className: "flex items-center", children: _jsx(CircleCheck, { size: 11, className: run.replayed ? 'text-zinc-400' : 'text-emerald-500' }) }) }));
|
|
178
|
+
}
|
|
179
|
+
// Drawn rather than left blank, which is what this was.
|
|
180
|
+
//
|
|
181
|
+
// A skipped node used to render nothing at all, which was defensible while
|
|
182
|
+
// `skipped` meant only "the run stopped before here" — the failed node beside
|
|
183
|
+
// it carried the story. It is not defensible now that a node can be skipped by
|
|
184
|
+
// a branch on a run that went perfectly: a sink that quietly shows no badge is
|
|
185
|
+
// exactly the "nothing loaded and nothing said so" this feature has to avoid.
|
|
186
|
+
if (run.status === 'skipped') {
|
|
187
|
+
return (_jsx(Tooltip, { content: describeSkip(run), children: _jsx("span", { className: "flex items-center", children: _jsx(CircleSlash, { size: 11, className: "text-zinc-400" }) }) }));
|
|
67
188
|
}
|
|
68
189
|
return null;
|
|
69
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* How a node arrives.
|
|
193
|
+
*
|
|
194
|
+
* On mount only, so it plays when a graph is opened and when somebody adds a box
|
|
195
|
+
* — and not while one is dragged, because dragging does not remount. Scale from
|
|
196
|
+
* just under one rather than from zero: the node grows into place instead of
|
|
197
|
+
* being inflated, which at eight nodes on a canvas is the difference between a
|
|
198
|
+
* screen settling and a screen erupting.
|
|
199
|
+
*
|
|
200
|
+
* Under `prefers-reduced-motion` the node is simply there. Nothing is conveyed
|
|
201
|
+
* by the arrival that its presence does not already convey, which is the test
|
|
202
|
+
* for whether skipping an animation costs anybody information.
|
|
203
|
+
*/
|
|
204
|
+
const ARRIVE = { type: 'spring', stiffness: 420, damping: 34, mass: 0.7 };
|
|
205
|
+
/** What an `if` node's badge says it decided. Absent on every other kind. */
|
|
206
|
+
function describeBranchTaken(run) {
|
|
207
|
+
if (!run?.branch)
|
|
208
|
+
return undefined;
|
|
209
|
+
return `Took the "${run.branch}" branch`;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* The two meanings of `skipped`, told apart.
|
|
213
|
+
*
|
|
214
|
+
* The branch wording deliberately says what did **not** happen to the data,
|
|
215
|
+
* because for a sink that is the whole question: a node that never ran committed
|
|
216
|
+
* nothing, so whatever was published before this run is still published. A
|
|
217
|
+
* reader who is not told that assumes the load emptied it.
|
|
218
|
+
*/
|
|
219
|
+
function describeSkip(run) {
|
|
220
|
+
if (run.skippedBecause === 'branch-not-taken') {
|
|
221
|
+
return 'Skipped: this is on the branch that was not taken. It did not run, so it wrote nothing and committed nothing — anything it publishes is still whatever was there before this run.';
|
|
222
|
+
}
|
|
223
|
+
return 'Skipped: the run stopped before reaching this step.';
|
|
224
|
+
}
|
|
70
225
|
export function WorkflowNodeBody({ id, data, selected }) {
|
|
71
|
-
const { onInspect, onEditCode, canEdit } = useWorkflowNodeHandlers();
|
|
226
|
+
const { onInspect, onEditCode, canEdit, wiring } = useWorkflowNodeHandlers();
|
|
227
|
+
const reduced = useReducedMotion();
|
|
72
228
|
const style = KIND_STYLE[data.kind];
|
|
73
229
|
const Icon = style.icon;
|
|
74
230
|
const errors = data.problems.filter((problem) => problem.level === 'error');
|
|
75
231
|
const warnings = data.problems.filter((problem) => problem.level === 'warning');
|
|
76
|
-
|
|
232
|
+
const landing = nodeWiringState(wiring, id);
|
|
233
|
+
return (_jsxs(motion.div
|
|
234
|
+
// The width comes from the constant rather than from a `w-56` class, and
|
|
235
|
+
// that is the whole mechanism behind the overlap fix: `WORKFLOW_NODE_WIDTH`
|
|
236
|
+
// is what the server spaces its columns by, so a node whose drawn width
|
|
237
|
+
// came from somewhere else could silently stop matching the layout that
|
|
238
|
+
// was computed for it. There is now one number and no way to change the
|
|
239
|
+
// box without changing it.
|
|
240
|
+
//
|
|
241
|
+
// A width in `style` rather than an animated value, deliberately: React
|
|
242
|
+
// Flow measures `offsetWidth` to place the edges, and a width mid-tween
|
|
243
|
+
// would move every connection while it settled.
|
|
244
|
+
, {
|
|
245
|
+
// The width comes from the constant rather than from a `w-56` class, and
|
|
246
|
+
// that is the whole mechanism behind the overlap fix: `WORKFLOW_NODE_WIDTH`
|
|
247
|
+
// is what the server spaces its columns by, so a node whose drawn width
|
|
248
|
+
// came from somewhere else could silently stop matching the layout that
|
|
249
|
+
// was computed for it. There is now one number and no way to change the
|
|
250
|
+
// box without changing it.
|
|
251
|
+
//
|
|
252
|
+
// A width in `style` rather than an animated value, deliberately: React
|
|
253
|
+
// Flow measures `offsetWidth` to place the edges, and a width mid-tween
|
|
254
|
+
// would move every connection while it settled.
|
|
255
|
+
style: { width: NODE_WIDTH }, initial: reduced ? false : { opacity: 0, scale: 0.94 }, animate: { opacity: 1, scale: 1 }, transition: reduced ? { duration: 0 } : ARRIVE, className: cn('group/node relative overflow-hidden rounded-xl border',
|
|
256
|
+
// A lift on hover and a deeper one while selected. `transition-all`
|
|
257
|
+
// rather than `transition-shadow` because the ring width changes too,
|
|
258
|
+
// and a ring that snaps while the shadow fades reads as a glitch.
|
|
259
|
+
'shadow-sm transition-all duration-150 motion-safe:hover:-translate-y-0.5 hover:shadow-lg', 'hover:border-zinc-300 dark:hover:border-zinc-700', RULE, PANEL, selected && 'shadow-md ring-2 ring-sky-500/50 dark:ring-sky-400/50', errors.length > 0 && 'border-red-400 dark:border-red-800', errors.length === 0 && warnings.length > 0 && 'border-amber-300 dark:border-amber-800',
|
|
260
|
+
// While a wire is open, the whole box says whether it can take it — the
|
|
261
|
+
// handle is 12px across and the node is 224, and somebody looking for
|
|
262
|
+
// "where can this go" is looking at boxes. Same judgement, same
|
|
263
|
+
// function, drawn bigger.
|
|
264
|
+
landing === 'open' && 'ring-2 ring-emerald-500/45 dark:ring-emerald-400/45', landing === 'origin' && 'ring-2 ring-violet-500/50 dark:ring-violet-400/50', landing === 'shut' && 'opacity-40'), children: [_jsx("span", { className: cn('absolute inset-y-0 left-0 w-1', style.accent) }), data.kind !== 'source' && (_jsx(Handle, { type: "target", position: Position.Left, className: cn(HANDLE, HANDLE_WIRING[handleWiringState(wiring, id, 'target')]), "aria-label": `input of ${data.label}`, ...wireOn(id, 'target', wiring) })), data.kind !== 'sink' && (_jsx(Handle, { type: "source", position: Position.Right, className: cn(HANDLE, HANDLE_WIRING[handleWiringState(wiring, id, 'source')]), "aria-label": `output of ${data.label}`, ...wireOn(id, 'source', wiring) })), _jsxs("div", { className: cn('flex items-center gap-1.5 border-b pl-3 pr-2 py-1', RULE, style.wash), children: [_jsx(Icon, { size: 12, className: style.chip }), _jsx("span", { className: cn('font-mono text-[9px] uppercase tracking-[0.16em]', style.chip), children: style.noun }), _jsxs("span", { className: "ml-auto flex items-center gap-1", children: [data.run && _jsx(RunBadge, { run: data.run }), errors.length > 0 && (_jsx(Tooltip, { content: errors.map((p) => p.message).join(' '), children: _jsx("span", { className: "flex items-center", children: _jsx(CircleAlert, { size: 11, className: "text-red-500" }) }) })), errors.length === 0 && warnings.length > 0 && (_jsx(Tooltip, { content: warnings.map((p) => p.message).join(' '), children: _jsx("span", { className: "flex items-center", children: _jsx(TriangleAlert, { size: 11, className: "text-amber-500" }) }) }))] })] }), _jsxs("div", { className: "pl-3 pr-2 py-2", children: [_jsxs("button", { type: "button", onClick: () => onInspect(id), className: "nodrag block w-full text-left", children: [_jsx("span", { className: "block truncate text-[13px] font-medium leading-snug", children: data.label }), _jsx("span", { className: cn('mt-0.5 block truncate font-mono text-[10px]', MUTED), children: data.subtitle })] }), data.kind === 'transform' && canEdit && (_jsx("div", { className: "mt-1.5 flex", children: _jsx(Tooltip, { content: "Open this transform's code. The canvas stays where it is.", children: _jsxs("button", { type: "button", onClick: () => onEditCode(id), "aria-label": `Edit the code behind ${data.label}`, className: cn('nodrag flex items-center gap-1 rounded border px-1.5 py-0.5 font-mono text-[9px]', 'transition-colors', RULE, MUTED, 'hover:bg-zinc-50 dark:hover:bg-zinc-800'), children: [_jsx(Code2, { size: 9 }), "code"] }) }) }))] })] }));
|
|
77
265
|
}
|
|
78
266
|
/**
|
|
79
267
|
* Declared once, at module scope.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a published graph runs as, and what it has done lately.
|
|
3
|
+
*
|
|
4
|
+
* WHY A CONNECTOR IS STILL ON SCREEN AT ALL
|
|
5
|
+
* -----------------------------------------
|
|
6
|
+
* Because it is the id everything else is keyed on. A connector is no longer
|
|
7
|
+
* something anybody creates — publishing a graph mints one, deleting the graph
|
|
8
|
+
* removes it, and there is no route that makes one directly — but the run
|
|
9
|
+
* history and the incremental watermark hang off that id, and the connector is
|
|
10
|
+
* what a scheduled fire is attributed to. An internal record no screen exposes
|
|
11
|
+
* is one an operator debugs by opening the database.
|
|
12
|
+
*
|
|
13
|
+
* So this panel is a READ and says so. There is no run button here (the run
|
|
14
|
+
* button is on the graph), no delete (deleting the graph is what removes it) and
|
|
15
|
+
* no edit (every field it used to hold is a node on the canvas now). Where one
|
|
16
|
+
* of those used to be, the panel says where the action went instead of quietly
|
|
17
|
+
* not being there.
|
|
18
|
+
*
|
|
19
|
+
* **Nothing here prints a config.** The server redacts a URL password on the way
|
|
20
|
+
* out and `allowInlineCredentials` decides whether one may be stored at all, so
|
|
21
|
+
* the honest thing for a screen is not to render the field: showing `REDACTED`
|
|
22
|
+
* beside a real host teaches people the console shows credentials, and the day
|
|
23
|
+
* one is not redacted is the day somebody screenshots it.
|
|
24
|
+
*/
|
|
25
|
+
import type { CatalogTransform } from '@dudousxd/nestjs-catalog/client';
|
|
26
|
+
/**
|
|
27
|
+
* The connector this graph runs as, and its recent loads.
|
|
28
|
+
*
|
|
29
|
+
* Rendered for a stored graph only. A draft has nothing behind it — that is
|
|
30
|
+
* what a draft is — and an empty "Runs as" panel over a canvas somebody is
|
|
31
|
+
* still drawing would be a permanent heading nobody reads.
|
|
32
|
+
*/
|
|
33
|
+
export declare function RunsAsPanel({ workflowId, status, transforms, }: {
|
|
34
|
+
workflowId: string;
|
|
35
|
+
status: 'draft' | 'ready';
|
|
36
|
+
/** The transforms this graph names, so a run's `code v3` can be compared. */
|
|
37
|
+
transforms: CatalogTransform[];
|
|
38
|
+
}): import("react/jsx-runtime").JSX.Element;
|