@dudousxd/nestjs-catalog-react 0.18.0 → 0.19.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.
Files changed (40) hide show
  1. package/dist/CatalogManager.d.ts +23 -1
  2. package/dist/CatalogManager.js +76 -13
  3. package/dist/ConnectionPanel.js +15 -123
  4. package/dist/LoadedBySection.d.ts +39 -0
  5. package/dist/LoadedBySection.js +143 -0
  6. package/dist/WorkflowCanvas.d.ts +16 -0
  7. package/dist/WorkflowCanvas.js +1026 -78
  8. package/dist/connection-form.d.ts +241 -0
  9. package/dist/connection-form.js +235 -0
  10. package/dist/context.d.ts +78 -4
  11. package/dist/context.js +11 -0
  12. package/dist/index.d.ts +5 -1
  13. package/dist/index.js +23 -0
  14. package/dist/routes.d.ts +30 -0
  15. package/dist/routes.js +2 -0
  16. package/dist/schema-discovery.d.ts +17 -1
  17. package/dist/schema-discovery.js +3 -3
  18. package/dist/source-connection.d.ts +82 -0
  19. package/dist/source-connection.js +176 -0
  20. package/dist/source-fields.d.ts +15 -2
  21. package/dist/source-fields.js +15 -2
  22. package/dist/ui/combobox.d.ts +97 -0
  23. package/dist/ui/combobox.js +80 -0
  24. package/dist/workflow/edges.d.ts +110 -0
  25. package/dist/workflow/edges.js +112 -0
  26. package/dist/workflow/graph.d.ts +63 -2
  27. package/dist/workflow/graph.js +322 -43
  28. package/dist/workflow/index.d.ts +7 -1
  29. package/dist/workflow/index.js +10 -5
  30. package/dist/workflow/lifecycle.d.ts +0 -29
  31. package/dist/workflow/lifecycle.js +2 -35
  32. package/dist/workflow/model.d.ts +28 -3
  33. package/dist/workflow/model.js +12 -2
  34. package/dist/workflow/nodes.d.ts +4 -1
  35. package/dist/workflow/nodes.js +226 -11
  36. package/dist/workflow/templates.js +21 -0
  37. package/dist/workflow/validate.js +11 -0
  38. package/dist/workflow/wiring.d.ts +84 -0
  39. package/dist/workflow/wiring.js +254 -0
  40. package/package.json +8 -8
@@ -1,12 +1,34 @@
1
1
  export interface CatalogManagerProps {
2
+ /**
3
+ * Which type to open. Omit to fall back to `?type=` then the first type.
4
+ *
5
+ * The same shape — and the same three-step fallback — as
6
+ * {@link ObjectExplorerProps.type}, deliberately: this screen became a
7
+ * destination the day a workflow's sink could link to the type it commits, and
8
+ * a second convention for "which one" would be a second thing to get wrong.
9
+ * See {@link useSelectedType} in `ObjectExplorer.tsx` for the argument the
10
+ * hook below mirrors.
11
+ *
12
+ * A name this catalog does not hold is **not** silently replaced by the first
13
+ * type. That is what makes a stale or premature link readable as one: a sink
14
+ * may name a type nothing has published yet, and showing an unrelated type
15
+ * under an address promising that one is the failure a deep link is supposed
16
+ * to be immune to.
17
+ */
18
+ type?: string;
2
19
  /**
3
20
  * Where the object explorer lives, if the host mounts one. Receives the type
4
21
  * name. Omit to hide the "Open …" button entirely.
5
22
  */
6
23
  explorerHref?: (typeName: string) => string;
24
+ /**
25
+ * Where one workflow lives, if the host mounts a screen for graphs. Receives
26
+ * the workflow's id; omit and the "Loaded by" rows render as plain rows.
27
+ */
28
+ workflowHref?: (workflowId: string) => string;
7
29
  /** Heading copy, so the host can call this whatever its users call it. */
8
30
  title?: string;
9
31
  eyebrow?: string;
10
32
  intro?: string;
11
33
  }
12
- export declare function CatalogManager({ explorerHref, title, eyebrow, intro, }: CatalogManagerProps): import("react/jsx-runtime").JSX.Element;
34
+ export declare function CatalogManager({ type: typeProp, explorerHref, workflowHref, title, eyebrow, intro, }: CatalogManagerProps): import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
3
3
  import { ArrowLeft, ArrowRight, ArrowUpRight, Eye, EyeOff, RotateCcw, Search, Unlink, } from 'lucide-react';
4
- import { useMemo, useState } from 'react';
4
+ import { useEffect, useMemo, useState } from 'react';
5
5
  import { CoverageLedger } from './CoverageLedger';
6
6
  import { EditableField } from './EditableField';
7
7
  import { LoadExpectationSection } from './LoadExpectationSection';
8
+ import { LoadedBySection } from './LoadedBySection';
9
+ import { paramFromLocation } from './ObjectExplorer';
8
10
  import { cn } from './cn';
9
11
  import { catalogQueryKeys, useCatalogClient } from './context';
10
12
  import { freshnessOf, isWorthFlagging } from './freshness';
@@ -35,7 +37,7 @@ const HAIRLINE = 'border-zinc-100 dark:border-zinc-900';
35
37
  function ScalarBadge({ type }) {
36
38
  return (_jsx("span", { className: cn('rounded-sm bg-zinc-100 px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wider dark:bg-zinc-800', TYPE_TONE[type]), children: type }));
37
39
  }
38
- export function CatalogManager({ explorerHref, title = 'Catalog', eyebrow = 'Semantic layer', intro = 'Every object type the system already holds, derived from the ORM. Names, descriptions and units are yours to change — none of it touches the database.', }) {
40
+ export function CatalogManager({ type: typeProp, explorerHref, workflowHref, title = 'Catalog', eyebrow = 'Semantic layer', intro = 'Every object type the system already holds, derived from the ORM. Names, descriptions and units are yours to change — none of it touches the database.', }) {
39
41
  const client = useCatalogClient();
40
42
  const queryClient = useQueryClient();
41
43
  const { data, isLoading, isError } = useQuery({
@@ -43,7 +45,7 @@ export function CatalogManager({ explorerHref, title = 'Catalog', eyebrow = 'Sem
43
45
  queryFn: () => client.snapshot(),
44
46
  staleTime: 30_000,
45
47
  });
46
- const [selectedName, setSelectedName] = useState(null);
48
+ const [selectedName, setSelectedName] = useSelectedType(typeProp);
47
49
  const [filter, setFilter] = useState('');
48
50
  const [onlyUnnamed, setOnlyUnnamed] = useState(false);
49
51
  /** Presentation edits should feel like typing, not like saving. */
@@ -75,7 +77,19 @@ export function CatalogManager({ explorerHref, title = 'Catalog', eyebrow = 'Sem
75
77
  onSuccess: (snapshot) => queryClient.setQueryData(catalogQueryKeys.snapshot, snapshot),
76
78
  });
77
79
  const types = useMemo(() => data?.types ?? [], [data]);
78
- const selected = useMemo(() => types.find((t) => t.name === selectedName) ?? types[0], [types, selectedName]);
80
+ /**
81
+ * The type on screen, and — separately — a name that named nothing.
82
+ *
83
+ * The two are split because they used to be one `?? types[0]`, which answers
84
+ * both "nobody has chosen yet" and "the chosen one does not exist" with the
85
+ * same unrelated type. That is harmless while the only way to choose is the
86
+ * list on the left, where every entry exists by construction, and it stops
87
+ * being harmless the moment an address can name one: a sink may commit into a
88
+ * type nothing has published yet, so `#model?type=Fleet` is a link somebody
89
+ * can hold before the type behind it does.
90
+ */
91
+ const selected = useMemo(() => (selectedName === null ? types[0] : types.find((t) => t.name === selectedName)), [types, selectedName]);
92
+ const missing = selectedName !== null && types.length > 0 && !selected ? selectedName : null;
79
93
  const grouped = useMemo(() => {
80
94
  const term = filter.trim().toLowerCase();
81
95
  const matching = types.filter((t) => {
@@ -103,20 +117,69 @@ export function CatalogManager({ explorerHref, title = 'Catalog', eyebrow = 'Sem
103
117
  }
104
118
  return (_jsx(TooltipProvider, { children: _jsxs("div", { className: "flex h-full flex-col bg-zinc-50 dark:bg-zinc-950", children: [_jsxs("header", { className: cn('shrink-0 border-b px-8 py-6', RULE, PANEL), children: [_jsxs("div", { className: "flex flex-wrap items-start justify-between gap-6", children: [_jsxs("div", { children: [_jsx("p", { className: cn('font-mono text-[11px] uppercase tracking-[0.18em]', MUTED), children: eyebrow }), _jsx("h1", { className: "mt-1 text-2xl font-semibold tracking-tight", children: title }), _jsx("p", { className: cn('mt-1 max-w-xl text-sm', SECONDARY), children: intro })] }), _jsxs("div", { className: "flex items-center gap-6", children: [_jsx(Stat, { label: "Types", value: data.stats.types }), _jsx(Stat, { label: "Properties", value: data.stats.properties }), _jsx(Tooltip, { content: "Relations declared across every type. A link declared at both ends counts twice \u2014 the graph draws it once.", children: _jsx("span", { className: "cursor-help", children: _jsx(Stat, { label: "Relations", value: data.stats.relations }) }) }), _jsxs("button", { type: "button", onClick: () => resetMutation.mutate(), disabled: resetMutation.isPending, className: cn('flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs', RULE, SECONDARY, 'transition-colors hover:bg-zinc-50 disabled:opacity-50 dark:hover:bg-zinc-800'), children: [_jsx(RotateCcw, { size: 13 }), "Reset edits"] })] })] }), _jsx("div", { className: "mt-6", children: _jsx(CoverageLedger, { types: types, selected: selected?.name, onSelect: setSelectedName }) })] }), _jsxs("div", { className: "flex min-h-0 flex-1", children: [_jsxs("aside", { className: cn('flex w-72 shrink-0 flex-col border-r', RULE, PANEL), children: [_jsxs("div", { className: cn('shrink-0 space-y-2 border-b p-3', HAIRLINE), children: [_jsxs("div", { className: "relative", children: [_jsx(Search, { size: 14, className: cn('pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2', MUTED) }), _jsx("input", { type: "text", value: filter, onChange: (e) => setFilter(e.target.value), placeholder: "Find a type or table", "aria-label": "Filter object types", className: cn('w-full rounded-md border bg-zinc-50 py-1.5 pl-8 pr-2 text-sm outline-none dark:bg-zinc-950', RULE, 'placeholder:text-zinc-400 focus:border-sky-500 focus:ring-2 focus:ring-sky-500/15') })] }), _jsxs("label", { className: cn('flex cursor-pointer items-center gap-2 px-0.5 text-xs', SECONDARY), children: [_jsx("input", { type: "checkbox", checked: onlyUnnamed, onChange: (e) => setOnlyUnnamed(e.target.checked), className: "accent-amber-500" }), "Only types nobody has named"] })] }), _jsxs("nav", { className: "min-h-0 flex-1 overflow-y-auto p-2", children: [grouped.length === 0 && (_jsxs("p", { className: cn('px-2 py-6 text-center text-xs', MUTED), children: ["Nothing matches \u201C", filter, "\u201D."] })), grouped.map(([group, groupTypes]) => (_jsxs("div", { className: "mb-3", children: [_jsxs("div", { className: "flex items-baseline justify-between px-2 py-1", children: [_jsx("span", { className: cn('font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: group }), _jsx("span", { className: cn('font-mono text-[10px]', MUTED), children: groupTypes.length })] }), groupTypes.map((type) => (_jsxs("button", { type: "button", onClick: () => setSelectedName(type.name), className: cn('group flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors', selected?.name === type.name
105
119
  ? 'bg-sky-100 dark:bg-sky-950'
106
- : 'hover:bg-zinc-50 dark:hover:bg-zinc-800'), children: [_jsx("span", { "aria-hidden": true, className: cn('h-1.5 w-1.5 shrink-0 rounded-full', type.enriched ? 'bg-emerald-500' : 'bg-amber-400/60') }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsxs("span", { className: "block truncate text-sm", children: [type.icon ? `${type.icon} ` : '', type.displayName] }), _jsxs("span", { className: cn('block truncate font-mono text-[10px]', MUTED), children: [type.tableName, _jsx(FreshnessNote, { type: type })] })] })] }, type.name)))] }, group)))] })] }), _jsx("main", { className: "min-w-0 flex-1 overflow-y-auto", children: selected && (_jsx(TypeDetail, { type: selected,
107
- // The whole catalog, so the detail pane can answer what points
108
- // AT this type. Nothing on a type records its inbound links —
109
- // one row per declaration, and the declaration lives on the
110
- // other end — so the only place that question can be answered
111
- // is somewhere holding every type.
112
- types: types, explorerHref: explorerHref, onPatchType: (patch) => typeMutation.mutate({ name: selected.name, patch }), onPatchProperty: (property, patch) => propertyMutation.mutate({ name: selected.name, property, patch }), onNavigate: setSelectedName }, selected.name)) })] })] }) }));
120
+ : 'hover:bg-zinc-50 dark:hover:bg-zinc-800'), children: [_jsx("span", { "aria-hidden": true, className: cn('h-1.5 w-1.5 shrink-0 rounded-full', type.enriched ? 'bg-emerald-500' : 'bg-amber-400/60') }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsxs("span", { className: "block truncate text-sm", children: [type.icon ? `${type.icon} ` : '', type.displayName] }), _jsxs("span", { className: cn('block truncate font-mono text-[10px]', MUTED), children: [type.tableName, _jsx(FreshnessNote, { type: type })] })] })] }, type.name)))] }, group)))] })] }), _jsxs("main", { className: "min-w-0 flex-1 overflow-y-auto", children: [missing && _jsx(NoSuchType, { name: missing }), selected && (_jsx(TypeDetail, { type: selected, workflowHref: workflowHref,
121
+ // The whole catalog, so the detail pane can answer what points
122
+ // AT this type. Nothing on a type records its inbound links —
123
+ // one row per declaration, and the declaration lives on the
124
+ // other end — so the only place that question can be answered
125
+ // is somewhere holding every type.
126
+ types: types, explorerHref: explorerHref, onPatchType: (patch) => typeMutation.mutate({ name: selected.name, patch }), onPatchProperty: (property, patch) => propertyMutation.mutate({ name: selected.name, property, patch }), onNavigate: setSelectedName }, selected.name))] })] })] }) }));
127
+ }
128
+ /**
129
+ * Which type this screen is showing, and how it gets chosen.
130
+ *
131
+ * The same rules {@link useSelectedType} in `ObjectExplorer.tsx` argues for, and
132
+ * a deliberate second copy of them rather than a shared hook: that one owns a
133
+ * *found* type name (it resolves the prop against the catalog before storing it,
134
+ * because its query is `enabled` on a non-empty string), and this one must be
135
+ * able to hold a name the catalog does NOT have so that `missing` above can say
136
+ * so. Merging them would mean one hook with a flag deciding whether a bad name
137
+ * is remembered or discarded, which is two behaviours in one name.
138
+ *
139
+ * - **The prop wins whenever it changes**, not only on the first render. A host
140
+ * that links from one type to another — the ordinary way to arrive here — sets
141
+ * the prop, and a guard on "nothing chosen yet" would show the previous type
142
+ * under an address naming the new one.
143
+ * - Failing a prop, the hash's own query string, once. `paramFromLocation` is
144
+ * imported from `ObjectExplorer` rather than rewritten: it reads the real
145
+ * query string *and* the hash's, and a hash-routed console leaves
146
+ * `location.search` empty.
147
+ * - Failing both, `null` — which is what makes the first type the default, and
148
+ * which is a different state from a name that matched nothing.
149
+ */
150
+ function useSelectedType(typeProp) {
151
+ const [typeName, setTypeName] = useState(typeProp ?? null);
152
+ useEffect(() => {
153
+ if (typeProp)
154
+ setTypeName(typeProp);
155
+ }, [typeProp]);
156
+ useEffect(() => {
157
+ if (typeName !== null || typeProp)
158
+ return;
159
+ const requested = paramFromLocation('type');
160
+ if (requested)
161
+ setTypeName(requested);
162
+ }, [typeName, typeProp]);
163
+ return [typeName, setTypeName];
164
+ }
165
+ /**
166
+ * A link that named a type this catalog does not hold.
167
+ *
168
+ * Said rather than swallowed, and the second paragraph is the reason this state
169
+ * is worth a panel: the likeliest way to arrive here is a sink node committing
170
+ * into a type that has not been published yet, which is legal — a sink may name
171
+ * a type before anything creates it — and reads as a broken console unless
172
+ * somebody says otherwise.
173
+ */
174
+ function NoSuchType({ name }) {
175
+ return (_jsx("div", { className: "mx-auto max-w-5xl px-8 py-8", children: _jsxs("div", { className: cn('rounded-lg border border-dashed px-4 py-6', RULE), children: [_jsxs("p", { className: "text-sm", children: ["Nothing in this catalog is called ", _jsx("span", { className: "font-mono", children: name }), "."] }), _jsx("p", { className: cn('mt-1 text-sm', SECONDARY), children: "A type comes into existence when something publishes its schema, so a workflow sink can name one before it exists \u2014 the link is not wrong, the type has simply not arrived. Pick one on the left, or run the load that creates it." })] }) }));
113
176
  }
114
177
  function Stat({ label, value }) {
115
178
  return (_jsxs("div", { className: "text-right", children: [_jsx("div", { className: "font-mono text-xl leading-none tabular-nums", children: value }), _jsx("div", { className: cn('mt-1 font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: label })] }));
116
179
  }
117
- function TypeDetail({ type, types, explorerHref, onPatchType, onPatchProperty, onNavigate, }) {
180
+ function TypeDetail({ type, types, explorerHref, workflowHref, onPatchType, onPatchProperty, onNavigate, }) {
118
181
  const visible = type.properties.filter((p) => !p.hidden).length;
119
- return (_jsxs("div", { className: "mx-auto max-w-5xl px-8 py-8", children: [_jsxs("div", { className: "flex flex-wrap items-start justify-between gap-4", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex items-baseline gap-2", children: [_jsx("span", { className: "text-2xl leading-none", children: type.icon ?? '◈' }), _jsx(EditableField, { label: "display name", value: type.displayName, onSave: (displayName) => onPatchType({ displayName }), className: "text-2xl font-semibold tracking-tight", inputClassName: "text-2xl font-semibold tracking-tight" })] }), _jsxs("div", { className: cn('mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 pl-1 font-mono text-[11px]', MUTED), children: [_jsx("span", { children: type.name }), _jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsx("span", { children: type.tableName }), _jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsxs("span", { children: ["pk ", type.primaryKey.join(', ') || 'none'] }), _jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsxs("span", { children: [visible, " of ", type.properties.length, " shown"] })] })] }), explorerHref && (_jsxs("a", { href: explorerHref(type.name), className: cn('flex items-center gap-1.5 rounded-md bg-zinc-950 px-3 py-2 text-xs text-zinc-50', 'transition-colors hover:bg-zinc-800 dark:bg-zinc-100 dark:text-zinc-950 dark:hover:bg-zinc-300'), children: ["Open ", type.pluralDisplayName, _jsx(ArrowUpRight, { size: 13 })] }))] }), _jsx("div", { className: "mt-5 border-l-2 border-sky-200 pl-4 dark:border-sky-900", children: _jsx(RichTextField, { label: "description", value: type.description ?? '', placeholder: "No one has written down what this type means yet.", onSave: (description) => onPatchType({ description }), className: cn('text-sm leading-relaxed', SECONDARY) }) }), _jsxs("div", { className: "mt-4 flex flex-wrap items-center gap-2", children: [_jsx(FieldChip, { label: "Group", value: type.group, onSave: (group) => onPatchType({ group }) }), _jsx(FieldChip, { label: "Plural", value: type.pluralDisplayName, onSave: (pluralDisplayName) => onPatchType({ pluralDisplayName }) }), _jsx(FieldChip, { label: "Icon", value: type.icon ?? '', onSave: (icon) => onPatchType({ icon }) })] }), _jsxs("section", { className: "mt-10", children: [_jsx(SectionHeading, { title: "Properties", note: "The column and its SQL type are read from the ORM. The label, description and unit are yours." }), _jsx("div", { className: cn('overflow-hidden rounded-lg border', RULE, PANEL), children: _jsx(PropertyTable, { properties: type.properties, onPatchProperty: onPatchProperty }) })] }), _jsx(LoadExpectationSection, { typeName: type.name, displayName: type.displayName }), _jsx(LinkSection, { type: type, types: types, onPatchProperty: onPatchProperty, onNavigate: onNavigate })] }));
182
+ return (_jsxs("div", { className: "mx-auto max-w-5xl px-8 py-8", children: [_jsxs("div", { className: "flex flex-wrap items-start justify-between gap-4", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex items-baseline gap-2", children: [_jsx("span", { className: "text-2xl leading-none", children: type.icon ?? '◈' }), _jsx(EditableField, { label: "display name", value: type.displayName, onSave: (displayName) => onPatchType({ displayName }), className: "text-2xl font-semibold tracking-tight", inputClassName: "text-2xl font-semibold tracking-tight" })] }), _jsxs("div", { className: cn('mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 pl-1 font-mono text-[11px]', MUTED), children: [_jsx("span", { children: type.name }), _jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsx("span", { children: type.tableName }), _jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsxs("span", { children: ["pk ", type.primaryKey.join(', ') || 'none'] }), _jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsxs("span", { children: [visible, " of ", type.properties.length, " shown"] })] })] }), explorerHref && (_jsxs("a", { href: explorerHref(type.name), className: cn('flex items-center gap-1.5 rounded-md bg-zinc-950 px-3 py-2 text-xs text-zinc-50', 'transition-colors hover:bg-zinc-800 dark:bg-zinc-100 dark:text-zinc-950 dark:hover:bg-zinc-300'), children: ["Open ", type.pluralDisplayName, _jsx(ArrowUpRight, { size: 13 })] }))] }), _jsx("div", { className: "mt-5 border-l-2 border-sky-200 pl-4 dark:border-sky-900", children: _jsx(RichTextField, { label: "description", value: type.description ?? '', placeholder: "No one has written down what this type means yet.", onSave: (description) => onPatchType({ description }), className: cn('text-sm leading-relaxed', SECONDARY) }) }), _jsxs("div", { className: "mt-4 flex flex-wrap items-center gap-2", children: [_jsx(FieldChip, { label: "Group", value: type.group, onSave: (group) => onPatchType({ group }) }), _jsx(FieldChip, { label: "Plural", value: type.pluralDisplayName, onSave: (pluralDisplayName) => onPatchType({ pluralDisplayName }) }), _jsx(FieldChip, { label: "Icon", value: type.icon ?? '', onSave: (icon) => onPatchType({ icon }) })] }), _jsxs("section", { className: "mt-10", children: [_jsx(SectionHeading, { title: "Properties", note: "The column and its SQL type are read from the ORM. The label, description and unit are yours." }), _jsx("div", { className: cn('overflow-hidden rounded-lg border', RULE, PANEL), children: _jsx(PropertyTable, { properties: type.properties, onPatchProperty: onPatchProperty }) })] }), _jsx(LoadedBySection, { typeName: type.name, displayName: type.displayName, workflowHref: workflowHref }), _jsx(LoadExpectationSection, { typeName: type.name, displayName: type.displayName }), _jsx(LinkSection, { type: type, types: types, onPatchProperty: onPatchProperty, onNavigate: onNavigate })] }));
120
183
  }
121
184
  /** What each kind actually says, for people who do not read `m:n` fluently. */
122
185
  const KIND_MEANING = {
@@ -3,42 +3,29 @@ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
3
3
  import { CircleCheck, CircleX, KeyRound, Loader2, Pencil, Plug, Plus, Trash2, Waypoints, } from 'lucide-react';
4
4
  import { useState } from 'react';
5
5
  import { cn } from './cn';
6
+ import { CONNECTION_KIND_OPTIONS, ConnectionCheckResult, ConnectionKindFields, connectionConfigFor, connectionDraftFrom, connectionIsIncomplete, configString as text, toConnectableKind, } from './connection-form';
6
7
  import { catalogQueryKeys, useCatalogClient, } from './context';
7
8
  import { ConfirmDialog } from './ui/dialog';
8
- import { FieldGroup, TextField } from './ui/field';
9
+ import { TextField } from './ui/field';
9
10
  import { SelectField } from './ui/select';
10
- import { Switch } from './ui/switch';
11
11
  import { Tooltip } from './ui/tooltip';
12
12
  import { nodeName } from './workflow/model';
13
13
  import { WORKFLOW_NAME } from './workflow/name';
14
14
  const MUTED = 'text-zinc-400 dark:text-zinc-500';
15
15
  const RULE = 'border-zinc-200 dark:border-zinc-800';
16
16
  const PANEL = 'bg-white dark:bg-zinc-900';
17
- /**
18
- * The kinds worth naming once and reusing.
17
+ /*
18
+ * The kinds, the draft, the per-kind fields and the two rules about what a
19
+ * connection needs all moved to `connection-form.tsx`, and the move is the
20
+ * point rather than tidiness: the source node's inspector creates a connection
21
+ * without leaving the canvas now, so there are two screens asking what an S3
22
+ * connection needs. Two copies would mean the one updated second is quietly the
23
+ * one that is right — which is the argument `source-fields.tsx` already makes
24
+ * about the other half of the same question.
19
25
  *
20
- * Deliberately three of the five kinds a source node can be, and the two that are
21
- * missing are missing for the same reason the checker refuses to probe them: a
22
- * file's path and a set of pasted records belong to the load, not to a shared
23
- * address. A connection there would be a name with no address behind it, and a
24
- * "Test connection" that always passes is worse than no button — it teaches
25
- * people that a green tick means nothing.
26
+ * A plain comment rather than a docblock: there is no declaration left here for
27
+ * one to attach to, and a `/**` would describe the constant below it.
26
28
  */
27
- const CONNECTABLE_KINDS = ['http', 'sql', 's3'];
28
- /** A select hands back a string. Narrow it rather than promise it is a kind. */
29
- function toConnectableKind(value) {
30
- return CONNECTABLE_KINDS.find((kind) => kind === value) ?? 'http';
31
- }
32
- const KIND_OPTIONS = [
33
- { value: 'http', label: 'HTTP — a JSON endpoint' },
34
- { value: 'sql', label: 'SQL — a database' },
35
- { value: 's3', label: 'S3 — a bucket, or anything S3-compatible' },
36
- ];
37
- /** Read a string out of a stored config without believing it is one. */
38
- function text(config, key) {
39
- const value = config[key];
40
- return typeof value === 'string' ? value : '';
41
- }
42
29
  /**
43
30
  * One line saying what a connection actually points at.
44
31
  *
@@ -153,18 +140,6 @@ function StoredCheckSummary({ connection }) {
153
140
  return null;
154
141
  return (_jsxs("div", { className: cn('mt-3 flex items-center gap-2 border-t pt-3 text-[11px]', RULE), children: [connection.lastCheckOk ? (_jsx(CircleCheck, { size: 12, "aria-hidden": true, className: "text-emerald-600" })) : (_jsx(CircleX, { size: 12, "aria-hidden": true, className: "text-red-600" })), _jsx("span", { className: "sr-only", children: connection.lastCheckOk ? 'Reachable: ' : 'Unreachable: ' }), _jsx("span", { className: MUTED, children: connection.lastCheckOk ? 'Reached' : (connection.lastCheckError ?? 'Could not reach it') }), _jsx("span", { className: cn('ml-auto font-mono text-[10px]', MUTED), children: new Date(connection.lastCheckedAt).toLocaleString() })] }));
155
142
  }
156
- /**
157
- * What a check that just ran found, in the checker's own words.
158
- *
159
- * A server version, a bucket and whether anything is under the prefix, an HTTP
160
- * status. That sentence is the whole product of the button; "OK" would prove
161
- * only that something is listening on a port.
162
- */
163
- function LiveCheckResult({ result }) {
164
- return (_jsx("div", { className: cn('mt-3 rounded-md border px-3 py-2 text-[11px]', result.ok
165
- ? 'border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-900 dark:bg-emerald-950/40 dark:text-emerald-300'
166
- : 'border-red-200 bg-red-50 text-red-700 dark:border-red-900 dark:bg-red-950/40 dark:text-red-300'), children: _jsxs("div", { className: "flex items-start gap-2", children: [result.ok ? (_jsx(CircleCheck, { size: 13, "aria-hidden": true, className: "mt-px shrink-0" })) : (_jsx(CircleX, { size: 13, "aria-hidden": true, className: "mt-px shrink-0" })), _jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "font-medium", children: result.ok ? 'Reached it.' : 'Could not reach it.' }), _jsx("div", { className: "mt-0.5 font-mono leading-relaxed", children: result.detail }), result.error && (_jsx("div", { className: "mt-1 font-mono leading-relaxed opacity-80", children: result.error })), _jsxs("div", { className: "mt-1 font-mono text-[10px] opacity-70", children: [result.elapsedMs, " ms"] })] })] }) }));
167
- }
168
143
  /**
169
144
  * Why a delete would be refused, said before it is attempted.
170
145
  *
@@ -234,85 +209,12 @@ function ConnectionCard({ connection, users, canEdit, onEdit, onChanged, }) {
234
209
  setBlockedBy(null);
235
210
  remove.reset();
236
211
  setConfirming(true);
237
- } })] }), !result && _jsx(StoredCheckSummary, { connection: connection }), result && _jsx(LiveCheckResult, { result: result }), check.error && !result && (_jsx("p", { className: "mt-3 text-[11px] text-red-600", children: check.error instanceof Error ? check.error.message : 'The check itself failed.' })), _jsx(ConfirmDialog, { open: confirming, onOpenChange: (open) => {
212
+ } })] }), !result && _jsx(StoredCheckSummary, { connection: connection }), result && _jsx(ConnectionCheckResult, { result: result }), check.error && !result && (_jsx("p", { className: "mt-3 text-[11px] text-red-600", children: check.error instanceof Error ? check.error.message : 'The check itself failed.' })), _jsx(ConfirmDialog, { open: confirming, onOpenChange: (open) => {
238
213
  setConfirming(open);
239
214
  if (!open)
240
215
  setBlockedBy(null);
241
216
  }, title: `Delete ${connection.name}?`, description: deleteConsequence(users), confirmLabel: remove.isPending ? 'Deleting…' : 'Delete', pending: remove.isPending, onConfirm: () => remove.mutate(), error: deleteRefusalMessage(blockedBy, remove.error) })] }));
242
217
  }
243
- /**
244
- * Only the config fields the chosen kind actually reads.
245
- *
246
- * Carrying the rest would leave a stale bucket on an HTTP connection, which
247
- * reads as configuration somebody meant rather than as a leftover from a
248
- * dropdown they changed.
249
- */
250
- function connectionConfigFor(kind, draft) {
251
- if (kind === 's3') {
252
- return {
253
- bucket: draft.bucket,
254
- ...(draft.endpoint ? { endpoint: draft.endpoint } : {}),
255
- ...(draft.region ? { region: draft.region } : {}),
256
- ...(draft.forcePathStyle ? { forcePathStyle: true } : {}),
257
- };
258
- }
259
- return draft.url ? { url: draft.url } : {};
260
- }
261
- /**
262
- * Whether there is not yet enough here to save.
263
- *
264
- * A SQL connection needs one of its two addresses and neither is more correct:
265
- * the variable is the right answer in a deployment, the inline URL is the one
266
- * that gets somebody running locally in a minute.
267
- */
268
- function connectionIsIncomplete(kind, draft) {
269
- if (draft.name.trim().length === 0)
270
- return true;
271
- if (kind === 's3')
272
- return draft.bucket.trim().length === 0;
273
- if (kind === 'http')
274
- return draft.url.trim().length === 0;
275
- return draft.url.trim().length === 0 && draft.secretEnvVar.trim().length === 0;
276
- }
277
- /** A base URL, and the token sent against it. */
278
- function HttpFields({ draft, update }) {
279
- return (_jsxs(_Fragment, { children: [_jsx(TextField, { label: "URL", value: draft.url, onChange: (url) => update({ url }), placeholder: "https://api.example.mil/v1", hint: "The base every source reading through this will hang its path off." }), _jsx(TextField, { label: "Credential env var", value: draft.secretEnvVar, onChange: (secretEnvVar) => update({ secretEnvVar }), placeholder: "Optional \u2014 sent as a bearer token" })] }));
280
- }
281
- /**
282
- * The connection string, and nothing beside it.
283
- *
284
- * This was two fields — an inline URL and the name of an environment variable
285
- * holding one — presented side by side with a paragraph explaining when each
286
- * applied. Two doors for one decision, and only one of them worked for a
287
- * database with a password, which is every database anybody connects to. The
288
- * question it produced was "what is this second field", which is the form
289
- * asking the reader to understand its implementation.
290
- *
291
- * One field now. Whether the URL may REST in the catalog's own table is the
292
- * store's decision (`allowInlineCredentials`) and not something to ask on a
293
- * form — and it is a decision about the deployment, not about this connection.
294
- * The server refuses and says why if the answer is no, which is a better place
295
- * to learn it than a hint nobody reads until afterwards.
296
- *
297
- * `secretEnvVar` still exists on the model and is still what a hardened
298
- * deployment should use; it is not on this screen. A host that wants it back
299
- * has the field on the record.
300
- */
301
- function SqlFields({ draft, update }) {
302
- return (_jsx(FieldGroup, { title: "Address", hint: "The connection string, as your database gives it to you. It is served back redacted, so the password never travels in a response \u2014 but it does rest in this catalog's own table, and a deployment can refuse that.", children: _jsx(TextField, { label: "Connection URL", value: draft.url, onChange: (url) => update({ url }), placeholder: "mysql://user:pass@host:3306/database" }) }));
303
- }
304
- /** A bucket, plus everything needed to address a non-AWS one. */
305
- function S3Fields({ draft, update }) {
306
- return (_jsxs(FieldGroup, { title: "Bucket", children: [_jsxs("div", { className: "grid gap-3 sm:grid-cols-2", children: [_jsx(TextField, { label: "Bucket", value: draft.bucket, onChange: (bucket) => update({ bucket }), placeholder: "fleet-drops" }), _jsx(TextField, { label: "Region", value: draft.region, onChange: (region) => update({ region }), placeholder: "Blank uses the environment's" }), _jsx(TextField, { label: "Endpoint", value: draft.endpoint, onChange: (endpoint) => update({ endpoint }), placeholder: "MinIO, e.g. http://localhost:9000" }), _jsx(TextField, { label: "Env var holding accessKeyId:secretAccessKey", value: draft.secretEnvVar, onChange: (secretEnvVar) => update({ secretEnvVar }), placeholder: "Optional", hint: "Leave blank anywhere the pod has its own role \u2014 those credentials rotate, and a static pair named here would not." })] }), _jsx(Switch, { checked: draft.forcePathStyle, onCheckedChange: (forcePathStyle) => update({ forcePathStyle }), label: "Path-style addressing", hint: "MinIO needs it; AWS does not." })] }));
307
- }
308
- /** The address fields for whichever kind is selected, and only those. */
309
- function ConnectionKindFields({ kind, draft, update, }) {
310
- if (kind === 'http')
311
- return _jsx(HttpFields, { draft: draft, update: update });
312
- if (kind === 'sql')
313
- return _jsx(SqlFields, { draft: draft, update: update });
314
- return _jsx(S3Fields, { draft: draft, update: update });
315
- }
316
218
  /**
317
219
  * Create or edit one.
318
220
  *
@@ -324,18 +226,8 @@ function ConnectionKindFields({ kind, draft, update, }) {
324
226
  */
325
227
  function ConnectionForm({ connection, onClose, onSaved, }) {
326
228
  const client = useCatalogClient();
327
- const config = connection?.config ?? {};
328
229
  const [kind, setKind] = useState(toConnectableKind(connection?.kind ?? 'http'));
329
- const [draft, setDraft] = useState({
330
- name: connection?.name ?? '',
331
- description: connection?.description ?? '',
332
- url: text(config, 'url'),
333
- bucket: text(config, 'bucket'),
334
- endpoint: text(config, 'endpoint'),
335
- region: text(config, 'region'),
336
- forcePathStyle: config.forcePathStyle === true,
337
- secretEnvVar: connection?.secretEnvVar ?? '',
338
- });
230
+ const [draft, setDraft] = useState(() => connectionDraftFrom(connection));
339
231
  const update = (patch) => setDraft({ ...draft, ...patch });
340
232
  const save = useMutation({
341
233
  mutationFn: () => {
@@ -355,7 +247,7 @@ function ConnectionForm({ connection, onClose, onSaved, }) {
355
247
  return (_jsxs("form", { className: cn('mt-6 space-y-4 rounded-lg border p-4', RULE, PANEL), onSubmit: (event) => {
356
248
  event.preventDefault();
357
249
  save.mutate();
358
- }, children: [_jsxs("div", { className: "grid gap-3 sm:grid-cols-3", children: [_jsx(TextField, { label: "Name", value: draft.name, onChange: (name) => update({ name }), placeholder: "Fleet warehouse" }), _jsx(TextField, { label: "Description", value: draft.description, onChange: (description) => update({ description }), placeholder: "What lives behind it (optional)" }), _jsx(SelectField, { label: "Kind", ariaLabel: "Connection kind", value: kind, onValueChange: (value) => setKind(toConnectableKind(value)), options: KIND_OPTIONS })] }), _jsx(ConnectionKindFields, { kind: kind, draft: draft, update: update }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("button", { type: "submit", disabled: save.isPending || incomplete, className: "rounded-md bg-zinc-950 px-3 py-1.5 text-xs text-zinc-50 disabled:opacity-40 dark:bg-zinc-100 dark:text-zinc-950", children: save.isPending ? 'Saving…' : connection ? 'Save changes' : 'Save connection' }), _jsx("button", { type: "button", onClick: onClose, className: cn('rounded-md px-3 py-1.5 text-xs', MUTED), children: "Cancel" }), _jsx("span", { className: cn('text-[11px]', MUTED), children: "Saving does not reach it. Test the connection from its card." })] }), save.error && (_jsx("p", { className: "text-[11px] text-red-600", children: save.error instanceof Error ? save.error.message : 'Could not save.' }))] }));
250
+ }, children: [_jsxs("div", { className: "grid gap-3 sm:grid-cols-3", children: [_jsx(TextField, { label: "Name", value: draft.name, onChange: (name) => update({ name }), placeholder: "Fleet warehouse" }), _jsx(TextField, { label: "Description", value: draft.description, onChange: (description) => update({ description }), placeholder: "What lives behind it (optional)" }), _jsx(SelectField, { label: "Kind", ariaLabel: "Connection kind", value: kind, onValueChange: (value) => setKind(toConnectableKind(value)), options: CONNECTION_KIND_OPTIONS })] }), _jsx(ConnectionKindFields, { kind: kind, draft: draft, update: update }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("button", { type: "submit", disabled: save.isPending || incomplete, className: "rounded-md bg-zinc-950 px-3 py-1.5 text-xs text-zinc-50 disabled:opacity-40 dark:bg-zinc-100 dark:text-zinc-950", children: save.isPending ? 'Saving…' : connection ? 'Save changes' : 'Save connection' }), _jsx("button", { type: "button", onClick: onClose, className: cn('rounded-md px-3 py-1.5 text-xs', MUTED), children: "Cancel" }), _jsx("span", { className: cn('text-[11px]', MUTED), children: "Saving does not reach it. Test the connection from its card." })] }), save.error && (_jsx("p", { className: "text-[11px] text-red-600", children: save.error instanceof Error ? save.error.message : 'Could not save.' }))] }));
359
251
  }
360
252
  /**
361
253
  * The options a source node offers for "read through".
@@ -0,0 +1,39 @@
1
+ import { type CatalogWorkflow } from './workflow/model';
2
+ export interface LoadedBySectionProps {
3
+ typeName: string;
4
+ /** What a person calls the type. The sentences here are about the type. */
5
+ displayName: string;
6
+ /**
7
+ * Where a graph lives, if the host mounts a screen for one. Receives the
8
+ * workflow's id. Omit and the rows stay rows.
9
+ */
10
+ workflowHref?: (workflowId: string) => string;
11
+ }
12
+ /**
13
+ * One graph that commits this type, with what it would take for it to run.
14
+ *
15
+ * Derived rather than stored, and computed here rather than asked of the server:
16
+ * the workflow list is already a query this console makes, and a per-type route
17
+ * would be a second answer to a question the sinks already answer.
18
+ */
19
+ interface Loader {
20
+ id: string;
21
+ name: string;
22
+ /** What stops it running, or nothing at all when the answer is "it runs". */
23
+ standing: string;
24
+ /** Whether `standing` is the reason it does NOT currently load anything. */
25
+ idle: boolean;
26
+ /** The other types this same graph commits. Empty when it commits only this one. */
27
+ alsoCommits: string[];
28
+ }
29
+ /**
30
+ * Every graph whose sinks commit this type.
31
+ *
32
+ * A whitespace-only `targetType` on a sink is not a match, which
33
+ * `producedTypes` already handles by dropping it — a half-configured sink names
34
+ * nothing, and treating a blank as a match would attach every unfinished graph
35
+ * in the deployment to whichever type happened to sort first.
36
+ */
37
+ export declare function loadersOf(workflows: CatalogWorkflow[], typeName: string): Loader[];
38
+ export declare function LoadedBySection({ typeName, displayName, workflowHref }: LoadedBySectionProps): import("react/jsx-runtime").JSX.Element;
39
+ export {};
@@ -0,0 +1,143 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useQuery } from '@tanstack/react-query';
3
+ import { ArrowUpRight, CalendarClock, PauseCircle } from 'lucide-react';
4
+ import { useMemo } from 'react';
5
+ import { cn } from './cn';
6
+ import { catalogQueryKeys, useCatalogClient } from './context';
7
+ import { producedTypes } from './workflow/model';
8
+ import { WORKFLOW_NAME } from './workflow/name';
9
+ /**
10
+ * What loads this type — the answer the model screen could not give.
11
+ *
12
+ * A sink node knows exactly which type it commits, and until this section
13
+ * existed that knowledge only ever pointed one way: you could stand on a graph
14
+ * and read off the type, and standing on the type there was nothing at all. The
15
+ * question a deployment actually asks is the second one — *there is an `af_fleet`
16
+ * workflow, how is it tied to this type* — and it was answerable only by opening
17
+ * every graph in turn.
18
+ *
19
+ * ## Why the list may be empty, plural, and still incomplete
20
+ *
21
+ * These three are not edge cases to be tidied away; they are what the answer is,
22
+ * and the section says all three out loud rather than implying a single owner.
23
+ *
24
+ * - **Plural.** Several graphs may commit one type, and one graph may commit
25
+ * several — a sink is what commits, and a graph may hold more than one. So the
26
+ * membership test is `producedTypes(nodes)` over the sinks rather than
27
+ * {@link CatalogWorkflow.targetType}, which is one stored string and can only
28
+ * ever name one of them.
29
+ * - **Empty.** A type with no graph behind it is an ordinary state, not a
30
+ * fault: it may be loaded by an application, or not loaded at all yet.
31
+ * - **Incomplete, always.** An application holding a `catalog:write` key can
32
+ * `POST` straight to the publish API, and no workflow will ever explain that
33
+ * load. So the note below is rendered in *both* states — the empty one and the
34
+ * populated one — because a list of two that quietly omits a third writer is
35
+ * more misleading than a list of none.
36
+ *
37
+ * ## What each row does and does not claim
38
+ *
39
+ * Naming a type at a sink is not the same as loading it. A draft is not
40
+ * scheduled, a disabled graph does not run, and a published graph with no cron
41
+ * runs only when somebody presses Run. Each row therefore says which of those it
42
+ * is, because "loaded by af_fleet" beside a graph nobody has published is the
43
+ * kind of half-truth that gets read off a screen and believed.
44
+ *
45
+ * ## Where the link goes, and why the host decides
46
+ *
47
+ * `workflowHref` is the host's, in the shape `explorerHref` already established
48
+ * on this screen: this package does not know where — or whether — a host mounts
49
+ * a canvas. Omit it and the rows render as plain rows rather than as dead links,
50
+ * which is the rule `search-console.tsx` argues for a row that has nowhere to go.
51
+ */
52
+ const MUTED = 'text-zinc-400 dark:text-zinc-500';
53
+ const SECONDARY = 'text-zinc-500 dark:text-zinc-400';
54
+ const PANEL = 'bg-white dark:bg-zinc-900';
55
+ const RULE = 'border-zinc-200 dark:border-zinc-800';
56
+ /**
57
+ * Whether this graph would run on its own, and what says so.
58
+ *
59
+ * Four states rather than a status badge, because `status` alone answers the
60
+ * wrong question here. A reader on the model screen is asking "does this type
61
+ * get refreshed", and a graph can be `ready` and still never run — `enabled` is
62
+ * false, or nothing ever set a cron on it. Reporting `ready` for all three would
63
+ * be the screen agreeing with a schedule that does not exist, which is the
64
+ * incident `CatalogWorkflow.schedule` carries its own warning about.
65
+ */
66
+ function standingOf(workflow) {
67
+ if (workflow.status !== 'ready') {
68
+ return {
69
+ standing: 'draft — nobody has published it, so nothing schedules it',
70
+ idle: true,
71
+ };
72
+ }
73
+ if (!workflow.enabled) {
74
+ return { standing: 'published, but turned off', idle: true };
75
+ }
76
+ const schedule = workflow.schedule?.trim();
77
+ if (!schedule) {
78
+ return { standing: 'published, and runs only when somebody starts it', idle: false };
79
+ }
80
+ return { standing: `runs on ${schedule}`, idle: false };
81
+ }
82
+ /**
83
+ * Every graph whose sinks commit this type.
84
+ *
85
+ * A whitespace-only `targetType` on a sink is not a match, which
86
+ * `producedTypes` already handles by dropping it — a half-configured sink names
87
+ * nothing, and treating a blank as a match would attach every unfinished graph
88
+ * in the deployment to whichever type happened to sort first.
89
+ */
90
+ export function loadersOf(workflows, typeName) {
91
+ const loaders = [];
92
+ for (const workflow of workflows) {
93
+ const produces = producedTypes(workflow.nodes);
94
+ if (!produces.includes(typeName))
95
+ continue;
96
+ loaders.push({
97
+ id: workflow.id,
98
+ name: workflow.name,
99
+ ...standingOf(workflow),
100
+ alsoCommits: produces.filter((produced) => produced !== typeName),
101
+ });
102
+ }
103
+ return loaders;
104
+ }
105
+ export function LoadedBySection({ typeName, displayName, workflowHref }) {
106
+ const client = useCatalogClient();
107
+ const { data: workflows, isPending, isError, error, } = useQuery({
108
+ queryKey: catalogQueryKeys.workflows,
109
+ queryFn: () => client.listWorkflows(),
110
+ // Not retried, for the reason `LoadExpectationSection` gives beside the same
111
+ // decision: the likely failure is a host that mounts no pipeline endpoints,
112
+ // and four attempts at a 404 is half a minute of a section saying nothing
113
+ // before it says that.
114
+ retry: false,
115
+ });
116
+ const loaders = useMemo(() => (workflows ? loadersOf(workflows, typeName) : []), [workflows, typeName]);
117
+ return (_jsxs("section", { className: "mt-10", children: [_jsxs("div", { className: "mb-3", children: [_jsx("h2", { className: cn('font-mono text-[11px] uppercase tracking-[0.16em]', MUTED), children: "Loaded by" }), _jsxs("p", { className: cn('mt-1 text-xs', MUTED), children: ["Which authored ", WORKFLOW_NAME.plural, " commit into ", displayName, ", read from their sink nodes. Not the whole answer \u2014 see below."] })] }), isPending && (_jsxs("p", { className: cn('font-mono text-xs', MUTED), children: ["Reading the ", WORKFLOW_NAME.plural, "\u2026"] })), isError && (_jsxs("div", { className: cn('rounded-lg border px-4 py-3', RULE, PANEL), children: [_jsxs("p", { className: "text-sm", children: ["Could not read the ", WORKFLOW_NAME.plural, "."] }), _jsxs("p", { className: cn('mt-1 text-xs', SECONDARY), children: ["They are served by the pipeline endpoints, which are the host's rather than this library's \u2014 this deployment may not mount them, or this account may not read them. Nothing here says what loads ", displayName, "; in particular this is ", _jsx("em", { children: "not" }), " the same answer as \"nothing does\"."] }), error instanceof Error && (_jsx("p", { className: cn('mt-1 font-mono text-[11px]', MUTED), children: error.message }))] })), workflows &&
118
+ (loaders.length === 0 ? (_jsxs("p", { className: cn('rounded-lg border border-dashed px-4 py-6 text-center text-sm', RULE, MUTED), children: ["No ", WORKFLOW_NAME.singular, " in this catalog commits ", displayName, "."] })) : (_jsx("ul", { className: "space-y-1.5", children: loaders.map((loader) => (_jsx(LoaderRow, { loader: loader, href: workflowHref?.(loader.id), displayName: displayName }, loader.id))) }))), workflows && (_jsxs("p", { className: cn('mt-2 text-[11px] leading-relaxed', MUTED), children: ["An application holding a key of its own can publish straight into ", displayName, " through the publish API, and such a load is authored nowhere in this catalog \u2014 so it cannot appear above, whether the list is empty or not. What did land, and when, is on the type's freshness note and in Activity."] }))] }));
119
+ }
120
+ /**
121
+ * One graph, as a row.
122
+ *
123
+ * The link wraps the NAME only, and the standing sits outside it. Wrapping both
124
+ * would fold "draft — nobody has published it" into the link's accessible name,
125
+ * so a screen reader would announce the whole sentence as the destination — and
126
+ * two rows whose names differ only after forty characters are two links nobody
127
+ * can tell apart by ear.
128
+ */
129
+ function LoaderRow({ loader, href, displayName, }) {
130
+ return (_jsxs("li", { className: cn('flex flex-wrap items-center gap-x-2 gap-y-1 rounded-md border px-3 py-2', RULE, PANEL,
131
+ // Dimmed, not dropped: a draft that commits this type is the answer to
132
+ // "somebody is building one", which is a different and more useful
133
+ // answer than an empty list.
134
+ loader.idle && 'opacity-70'), children: [href ? (_jsxs("a", { href: href, "aria-label": `${loader.name} — open the ${WORKFLOW_NAME.singular} that commits ${displayName}`, className: cn('flex items-center gap-1.5 rounded-sm text-sm outline-none', 'hover:text-sky-700 focus-visible:ring-2 focus-visible:ring-sky-500/40 dark:hover:text-sky-400'), children: [loader.name, _jsx(ArrowUpRight, { size: 13, "aria-hidden": true, className: MUTED })] })) : (
135
+ // A plain row, never an anchor to nowhere: the host mounts no screen for
136
+ // a graph, and a link that looks live and goes nowhere is worse than
137
+ // text.
138
+ _jsx("span", { className: "text-sm", children: loader.name })), _jsxs("span", { className: cn('flex items-center gap-1 font-mono text-[10px]', MUTED), children: [loader.idle ? (_jsx(PauseCircle, { size: 11, "aria-hidden": true })) : (_jsx(CalendarClock, { size: 11, "aria-hidden": true })), loader.standing] }), loader.alsoCommits.length > 0 && (
139
+ // Said because it changes what a run of this graph means: it is one read
140
+ // feeding several outputs, so a failure here may leave the other types
141
+ // committed. `WorkflowRun.status` is failed if any sink failed.
142
+ _jsxs("span", { className: cn('font-mono text-[10px]', SECONDARY), children: ["also commits ", loader.alsoCommits.join(', ')] }))] }));
143
+ }
@@ -9,6 +9,22 @@ export interface WorkflowCanvasProps {
9
9
  * regardless; this only stops the canvas offering controls that always 403.
10
10
  */
11
11
  canEdit?: boolean;
12
+ /**
13
+ * Where the model screen lives, if the host mounts one. Receives the object
14
+ * type name.
15
+ *
16
+ * The mirror of `CatalogManager`'s `explorerHref`, and it exists for the
17
+ * question a sink node could always answer and never act on: a sink says
18
+ * exactly which type it commits, and there was nothing on this screen that
19
+ * would take you to it. Omit it and the sink inspector shows the type and no
20
+ * link, which is what a host that mounts no model screen should get.
21
+ *
22
+ * Given to the **sink inspector only**. A source reads a system this catalog
23
+ * knows nothing about, a transform is code, and a call node hands its step to
24
+ * a workflow that owns its own outputs — the sink is the one node whose
25
+ * configuration names a type in this catalog.
26
+ */
27
+ modelHref?: (typeName: string) => string;
12
28
  }
13
29
  /**
14
30
  * Transforms wired to each other, ending at one or more sinks.