@dudousxd/nestjs-catalog-react 0.1.0 → 0.3.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.
@@ -10,6 +10,26 @@ import { Tooltip, TooltipProvider } from './ui/tooltip';
10
10
  const MUTED = 'text-zinc-400 dark:text-zinc-500';
11
11
  const RULE = 'border-zinc-200 dark:border-zinc-800';
12
12
  const PANEL = 'bg-white dark:bg-zinc-900';
13
+ function PeopleSearch({ value, onChange, }) {
14
+ return (_jsxs("label", { className: "mt-3 block", children: [_jsx("span", { className: "sr-only", children: "Search people" }), _jsx("input", { type: "search", value: value, onChange: (event) => onChange(event.target.value), placeholder: "Search by name or email", className: cn('w-full rounded-md border px-3 py-1.5 text-sm', RULE, PANEL, 'placeholder:text-zinc-400 dark:placeholder:text-zinc-600') })] }));
15
+ }
16
+ /**
17
+ * What the page is NOT showing.
18
+ *
19
+ * Rendered whenever there is a page at all, not only when there is more than
20
+ * one: a bounded list that looks complete is the failure worth spending a line
21
+ * of UI on, because an operator who reads it as complete concludes somebody has
22
+ * no access when they were merely on the next page.
23
+ */
24
+ function PageBar({ page, onOffset, busy, }) {
25
+ const shown = page.people.length;
26
+ const first = page.total === 0 ? 0 : page.offset + 1;
27
+ const last = page.offset + shown;
28
+ const hasMore = last < page.total;
29
+ return (_jsxs("div", { className: cn('mt-3 flex items-center justify-between text-xs', MUTED), children: [_jsx("span", { children: page.total === 0
30
+ ? 'No people'
31
+ : `Showing ${first}–${last} of ${page.total.toLocaleString()}` }), (page.offset > 0 || hasMore) && (_jsxs("span", { className: "flex gap-2", children: [_jsx("button", { type: "button", disabled: page.offset === 0 || busy, onClick: () => onOffset(Math.max(0, page.offset - page.limit)), className: "disabled:opacity-40", children: "Previous" }), _jsx("button", { type: "button", disabled: !hasMore || busy, onClick: () => onOffset(page.offset + page.limit), className: "disabled:opacity-40", children: "Next" })] }))] }));
32
+ }
13
33
  /**
14
34
  * One page answering the two questions a shared catalog creates: which
15
35
  * application is allowed to touch what, and which person is behind it.
@@ -27,15 +47,31 @@ export function AccessConsole({ identity, onSignOut, signOutPending, canAddPeopl
27
47
  // from here. Long enough that moving between tabs is instant.
28
48
  staleTime: 30_000,
29
49
  });
50
+ // Paged, because a host's user table is its whole directory: this screen is
51
+ // embedded in applications with thousands of employees, and the endpoint caps
52
+ // what it will return regardless of what is asked for. The key carries the
53
+ // query so a search does not read a previous search's page from the cache.
54
+ const [search, setSearch] = useState('');
55
+ const [offset, setOffset] = useState(0);
30
56
  const people = useQuery({
31
- queryKey: catalogQueryKeys.people,
32
- queryFn: () => client.listPeople(),
57
+ queryKey: [...catalogQueryKeys.people, { search, offset }],
58
+ queryFn: () => client.listPeople({ ...(search ? { search } : {}), offset }),
33
59
  staleTime: 30_000,
60
+ // The count and the page it describes must not be shown apart. Without
61
+ // this, typing into the search blanks the list to a spinner and then shows
62
+ // a total for a different query for one frame.
63
+ placeholderData: (previous) => previous,
34
64
  });
35
65
  const mayAdminister = canAddPeople ?? identity?.scopes.includes('catalog:admin') ?? false;
36
- return (_jsx(TooltipProvider, { children: _jsxs("div", { className: "mx-auto max-w-5xl px-8 py-8", 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: "mt-1 max-w-2xl text-sm text-zinc-500 dark:text-zinc-400", children: intro }), identity && (_jsx(YouPanel, { identity: identity, onSignOut: onSignOut, signOutPending: signOutPending })), _jsxs(Section, { title: "People", note: "Sign in to the console. Capped by the application they sign in through.", children: [mayAdminister && _jsx(AddPerson, {}), people.isPending && _jsx(Placeholder, { children: "Reading people\u2026" }), people.isError && (_jsx(Failed, { message: people.error instanceof Error
66
+ return (_jsx(TooltipProvider, { children: _jsxs("div", { className: "mx-auto max-w-5xl px-8 py-8", 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: "mt-1 max-w-2xl text-sm text-zinc-500 dark:text-zinc-400", children: intro }), identity && (_jsx(YouPanel, { identity: identity, onSignOut: onSignOut, signOutPending: signOutPending })), _jsxs(Section, { title: "People", note: "Sign in to the console. Capped by the application they sign in through.", children: [_jsx(PeopleSearch, { value: search, onChange: (next) => {
67
+ setSearch(next);
68
+ // Back to the first page. Staying on page 3 of the previous
69
+ // search shows an empty list for a search that has matches.
70
+ setOffset(0);
71
+ } }), mayAdminister && _jsx(AddPerson, {}), people.isPending && _jsx(Placeholder, { children: "Reading people\u2026" }), people.isError && (_jsx(Failed, { message: people.error instanceof Error
37
72
  ? people.error.message
38
- : 'Could not read the people list.', onRetry: () => people.refetch() })), people.data?.map((person) => (_jsx(PersonCard, { person: person }, person.email))), people.data?.length === 0 && (_jsx(Placeholder, { children: "Nobody can sign in yet. Seed the first administrator from the environment before anybody can reach this console as a person." }))] }), _jsxs(Section, { title: "Applications", note: "Provisioned by an operator \u2014 a console that could hand grants out is one that stops leaving a trail.", children: [applications.isPending && _jsx(Placeholder, { children: "Reading applications\u2026" }), applications.isError && (_jsx(Failed, { message: applications.error instanceof Error
73
+ : 'Could not read the people list.', onRetry: () => people.refetch() })), people.data?.people.map((person) => (_jsx(PersonCard, { person: person }, person.email))), people.data?.people.length === 0 &&
74
+ (search ? (_jsxs(Placeholder, { children: ["Nobody matches \u201C", search, "\u201D."] })) : (_jsx(Placeholder, { children: "Nobody can sign in yet. Seed the first administrator from the environment before anybody can reach this console as a person." }))), people.data && (_jsx(PageBar, { page: people.data, onOffset: setOffset, busy: people.isFetching }))] }), _jsxs(Section, { title: "Applications", note: "Provisioned by an operator \u2014 a console that could hand grants out is one that stops leaving a trail.", children: [applications.isPending && _jsx(Placeholder, { children: "Reading applications\u2026" }), applications.isError && (_jsx(Failed, { message: applications.error instanceof Error
39
75
  ? applications.error.message
40
76
  : 'Could not read the application list.', onRetry: () => applications.refetch() })), applications.data?.map((principal) => (_jsx(PrincipalCard, { principal: principal }, principal.id))), applications.data?.length === 0 && (_jsx(Placeholder, { children: "No applications are provisioned." }))] })] }) }));
41
77
  }
@@ -125,7 +161,7 @@ const AUTH_METHODS = {
125
161
  },
126
162
  session: {
127
163
  icon: ShieldHalf,
128
- tone: 'text-violet-600',
164
+ tone: 'text-sky-600',
129
165
  hint: 'Holds no credential of its own. Reachable only by a person signing in, and it caps what any of them can do.',
130
166
  },
131
167
  };
@@ -151,7 +187,7 @@ function Failed({ message, onRetry, }) {
151
187
  }
152
188
  const TONES = {
153
189
  neutral: 'bg-zinc-100 text-zinc-600 dark:bg-zinc-800 dark:text-zinc-300',
154
- write: 'bg-violet-100 text-violet-700 dark:bg-violet-950 dark:text-violet-300',
190
+ write: 'bg-sky-100 text-sky-700 dark:bg-sky-950 dark:text-sky-300',
155
191
  own: 'bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300',
156
192
  classified: 'bg-amber-100 text-amber-700 dark:bg-amber-950 dark:text-amber-300',
157
193
  };
@@ -16,7 +16,7 @@ import { Tooltip, TooltipProvider } from './ui/tooltip';
16
16
  */
17
17
  const TYPE_TONE = {
18
18
  string: 'text-sky-700 dark:text-sky-300',
19
- number: 'text-violet-700 dark:text-violet-300',
19
+ number: 'text-sky-700 dark:text-sky-300',
20
20
  date: 'text-amber-700 dark:text-amber-300',
21
21
  boolean: 'text-emerald-700 dark:text-emerald-300',
22
22
  json: 'text-zinc-600 dark:text-zinc-300',
@@ -97,8 +97,8 @@ export function CatalogManager({ explorerHref, title = 'Catalog', eyebrow = 'Sem
97
97
  if (isError || !data) {
98
98
  return (_jsx("div", { className: "flex h-full items-center justify-center px-6", children: _jsxs("div", { className: "max-w-md text-center", children: [_jsx("h2", { className: "text-lg font-medium", children: "The catalog did not load" }), _jsx("p", { className: cn('mt-1 text-sm', SECONDARY), children: "The server builds it from ORM metadata at boot. Check that the API is reachable and that your account may read it." })] }) }));
99
99
  }
100
- 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(Stat, { label: "Links", 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-violet-500 focus:ring-2 focus:ring-violet-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
101
- ? 'bg-violet-100 dark:bg-violet-950'
100
+ 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(Stat, { label: "Links", 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
101
+ ? 'bg-sky-100 dark:bg-sky-950'
102
102
  : '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] }), _jsx("span", { className: cn('block truncate font-mono text-[10px]', MUTED), children: type.tableName })] })] }, type.name)))] }, group)))] })] }), _jsx("main", { className: "min-w-0 flex-1 overflow-y-auto", children: selected && (_jsx(TypeDetail, { type: selected, explorerHref: explorerHref, onPatchType: (patch) => typeMutation.mutate({ name: selected.name, patch }), onPatchProperty: (property, patch) => propertyMutation.mutate({ name: selected.name, property, patch }), onNavigate: setSelectedName }, selected.name)) })] })] }) }));
103
103
  }
104
104
  function Stat({ label, value }) {
@@ -106,11 +106,11 @@ function Stat({ label, value }) {
106
106
  }
107
107
  function TypeDetail({ type, explorerHref, onPatchType, onPatchProperty, onNavigate, }) {
108
108
  const visible = type.properties.filter((p) => !p.hidden).length;
109
- 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-violet-200 pl-4 dark:border-violet-900", children: _jsx(EditableField, { label: "description", multiline: true, 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), inputClassName: "text-sm leading-relaxed" }) }), _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: _jsxs("table", { className: "w-full text-sm", children: [_jsx("thead", { children: _jsxs("tr", { className: cn('border-b bg-zinc-50 text-left dark:bg-zinc-950', RULE), children: [_jsx(Th, { className: "w-[30%]", children: "Label" }), _jsx(Th, { className: "w-[22%]", children: "Column" }), _jsx(Th, { className: "w-[10%]", children: "Type" }), _jsx(Th, { className: "w-[12%]", children: "Unit" }), _jsx(Th, { className: "w-[20%]", children: "Meaning" }), _jsx(Th, { className: "w-[6%] text-right", children: "Shown" })] }) }), _jsx("tbody", { children: type.properties.map((property) => (_jsxs("tr", { className: cn('border-b last:border-0', HAIRLINE, property.hidden && 'opacity-45'), children: [_jsxs("td", { className: "px-3 py-2 align-top", children: [_jsx(EditableField, { label: `label for ${property.name}`, value: property.displayName, onSave: (displayName) => onPatchProperty(property.name, { displayName }), inputClassName: "text-sm" }), _jsxs("div", { className: cn('px-1.5 font-mono text-[10px]', MUTED), children: [property.name, property.primary && (_jsx(Tooltip, { content: "Primary key. Always fetched, even when hidden, so a row keeps a stable identity.", children: _jsx("span", { className: "ml-1.5 cursor-help text-violet-600 dark:text-violet-400", children: "pk" }) })), !property.nullable && !property.primary && (_jsx(Tooltip, { content: "NOT NULL in the database. Read from the ORM, not something this screen can change.", children: _jsx("span", { className: "ml-1.5 cursor-help text-amber-600", children: "required" }) }))] })] }), _jsx("td", { className: cn('px-3 py-2 align-top font-mono text-[11px]', SECONDARY), children: property.columnName }), _jsx("td", { className: "px-3 py-2 align-top", children: _jsx(ScalarBadge, { type: property.type }) }), _jsx("td", { className: "px-3 py-2 align-top", children: _jsx(EditableField, { label: `unit for ${property.name}`, value: property.unit ?? '', placeholder: "\u2014", onSave: (unit) => onPatchProperty(property.name, { unit }), inputClassName: "text-xs", className: "text-xs" }) }), _jsx("td", { className: "px-3 py-2 align-top", children: _jsx(EditableField, { label: `description for ${property.name}`, multiline: true, value: property.description ?? '', placeholder: "\u2014", onSave: (description) => onPatchProperty(property.name, { description }), className: cn('text-xs leading-snug', SECONDARY), inputClassName: "text-xs leading-snug" }) }), _jsx("td", { className: "px-3 py-2 text-right align-top", children: _jsx(Tooltip, { content: property.hidden
109
+ 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(EditableField, { label: "description", multiline: true, 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), inputClassName: "text-sm leading-relaxed" }) }), _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: _jsxs("table", { className: "w-full text-sm", children: [_jsx("thead", { children: _jsxs("tr", { className: cn('border-b bg-zinc-50 text-left dark:bg-zinc-950', RULE), children: [_jsx(Th, { className: "w-[30%]", children: "Label" }), _jsx(Th, { className: "w-[22%]", children: "Column" }), _jsx(Th, { className: "w-[10%]", children: "Type" }), _jsx(Th, { className: "w-[12%]", children: "Unit" }), _jsx(Th, { className: "w-[20%]", children: "Meaning" }), _jsx(Th, { className: "w-[6%] text-right", children: "Shown" })] }) }), _jsx("tbody", { children: type.properties.map((property) => (_jsxs("tr", { className: cn('border-b last:border-0', HAIRLINE, property.hidden && 'opacity-45'), children: [_jsxs("td", { className: "px-3 py-2 align-top", children: [_jsx(EditableField, { label: `label for ${property.name}`, value: property.displayName, onSave: (displayName) => onPatchProperty(property.name, { displayName }), inputClassName: "text-sm" }), _jsxs("div", { className: cn('px-1.5 font-mono text-[10px]', MUTED), children: [property.name, property.primary && (_jsx(Tooltip, { content: "Primary key. Always fetched, even when hidden, so a row keeps a stable identity.", children: _jsx("span", { className: "ml-1.5 cursor-help text-sky-600 dark:text-sky-400", children: "pk" }) })), !property.nullable && !property.primary && (_jsx(Tooltip, { content: "NOT NULL in the database. Read from the ORM, not something this screen can change.", children: _jsx("span", { className: "ml-1.5 cursor-help text-amber-600", children: "required" }) }))] })] }), _jsx("td", { className: cn('px-3 py-2 align-top font-mono text-[11px]', SECONDARY), children: property.columnName }), _jsx("td", { className: "px-3 py-2 align-top", children: _jsx(ScalarBadge, { type: property.type }) }), _jsx("td", { className: "px-3 py-2 align-top", children: _jsx(EditableField, { label: `unit for ${property.name}`, value: property.unit ?? '', placeholder: "\u2014", onSave: (unit) => onPatchProperty(property.name, { unit }), inputClassName: "text-xs", className: "text-xs" }) }), _jsx("td", { className: "px-3 py-2 align-top", children: _jsx(EditableField, { label: `description for ${property.name}`, multiline: true, value: property.description ?? '', placeholder: "\u2014", onSave: (description) => onPatchProperty(property.name, { description }), className: cn('text-xs leading-snug', SECONDARY), inputClassName: "text-xs leading-snug" }) }), _jsx("td", { className: "px-3 py-2 text-right align-top", children: _jsx(Tooltip, { content: property.hidden
110
110
  ? `Hidden from tables and search. ${property.displayName} is still stored — showing it again needs no migration.`
111
111
  : `Shown in tables and search. Hiding it only changes what is displayed; the column is untouched.`, children: _jsx("button", { type: "button", "aria-label": `${property.hidden ? 'Show' : 'Hide'} ${property.displayName}`, onClick: () => onPatchProperty(property.name, {
112
112
  hidden: !property.hidden,
113
- }), className: cn('rounded-sm p-1 hover:bg-zinc-100 dark:hover:bg-zinc-800', MUTED), children: property.hidden ? _jsx(EyeOff, { size: 14 }) : _jsx(Eye, { size: 14 }) }) }) })] }, property.name))) })] }) })] }), _jsxs("section", { className: "mt-10 pb-16", children: [_jsx(SectionHeading, { title: "Links", note: "Read from the foreign keys." }), type.relations.length === 0 ? (_jsxs("p", { className: cn('rounded-lg border border-dashed px-4 py-6 text-center text-sm', RULE, MUTED), children: ["Nothing links to or from ", type.displayName, " yet."] })) : (_jsx("div", { className: "flex flex-wrap gap-2", children: type.relations.map((relation) => (_jsxs("button", { type: "button", onClick: () => onNavigate(relation.targetType), className: cn('group flex items-center gap-2 rounded-md border px-3 py-2 text-left transition-colors', RULE, PANEL, 'hover:border-violet-500 hover:bg-violet-100 dark:hover:bg-violet-950'), children: [_jsx("span", { className: cn('font-mono text-[10px] uppercase tracking-wider', MUTED), children: relation.kind }), _jsx("span", { className: "text-sm", children: relation.displayName }), _jsxs("span", { className: cn('font-mono text-[10px]', MUTED), children: ["\u2192 ", relation.targetType] })] }, relation.name))) }))] })] }));
113
+ }), className: cn('rounded-sm p-1 hover:bg-zinc-100 dark:hover:bg-zinc-800', MUTED), children: property.hidden ? _jsx(EyeOff, { size: 14 }) : _jsx(Eye, { size: 14 }) }) }) })] }, property.name))) })] }) })] }), _jsxs("section", { className: "mt-10 pb-16", children: [_jsx(SectionHeading, { title: "Links", note: "Read from the foreign keys." }), type.relations.length === 0 ? (_jsxs("p", { className: cn('rounded-lg border border-dashed px-4 py-6 text-center text-sm', RULE, MUTED), children: ["Nothing links to or from ", type.displayName, " yet."] })) : (_jsx("div", { className: "flex flex-wrap gap-2", children: type.relations.map((relation) => (_jsxs("button", { type: "button", onClick: () => onNavigate(relation.targetType), className: cn('group flex items-center gap-2 rounded-md border px-3 py-2 text-left transition-colors', RULE, PANEL, 'hover:border-sky-500 hover:bg-sky-100 dark:hover:bg-sky-950'), children: [_jsx("span", { className: cn('font-mono text-[10px] uppercase tracking-wider', MUTED), children: relation.kind }), _jsx("span", { className: "text-sm", children: relation.displayName }), _jsxs("span", { className: cn('font-mono text-[10px]', MUTED), children: ["\u2192 ", relation.targetType] })] }, relation.name))) }))] })] }));
114
114
  }
115
115
  function SectionHeading({ title, note }) {
116
116
  return (_jsxs("div", { className: "mb-3", children: [_jsx("h2", { className: cn('font-mono text-[11px] uppercase tracking-[0.16em]', MUTED), children: title }), _jsx("p", { className: cn('mt-1 text-xs', MUTED), children: note })] }));
@@ -130,7 +130,7 @@ function ConnectionCard({ connection, users, canEdit, onEdit, onChanged, }) {
130
130
  },
131
131
  });
132
132
  const result = check.data;
133
- return (_jsxs("div", { className: cn('rounded-lg border p-4', RULE, PANEL), children: [_jsxs("div", { className: "flex flex-wrap items-start justify-between gap-3", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx(Plug, { size: 13, className: MUTED }), _jsx("span", { className: "text-sm font-medium", children: connection.name }), _jsx("span", { className: "rounded-sm bg-zinc-100 px-1.5 py-0.5 font-mono text-[10px] uppercase dark:bg-zinc-800", children: connection.kind }), users.length > 0 && (_jsx(Tooltip, { content: `Read through by ${users.map((c) => c.name).join(', ')}. Moving this address moves all of them at once, which is the point.`, children: _jsxs("span", { className: cn('flex cursor-help items-center gap-1 font-mono text-[10px]', MUTED), children: [_jsx(Waypoints, { size: 10 }), users.length] }) }))] }), _jsx("div", { className: cn('mt-1 font-mono text-[11px]', MUTED), children: describeConnection(connection) }), connection.description && (_jsx("p", { className: cn('mt-1 text-[11px]', MUTED), children: connection.description })), connection.secretEnvVar && (_jsx(Tooltip, { content: "The catalog stores the NAME of this variable, never its value. A leaked catalog database gives away the shape of the integration, not the keys to it.", children: _jsxs("div", { className: cn('mt-1 flex w-fit cursor-help items-center gap-1 font-mono text-[10px]', MUTED), children: [_jsx(KeyRound, { size: 10 }), connection.secretEnvVar] }) }))] }), _jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [_jsxs("button", { type: "button", onClick: () => check.mutate(), disabled: check.isPending, className: cn('flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs disabled:opacity-40', RULE, 'hover:bg-zinc-50 dark:hover:bg-zinc-800'), children: [check.isPending ? _jsx(Loader2, { size: 12, className: "animate-spin" }) : _jsx(Plug, { size: 12 }), check.isPending ? 'Reaching…' : 'Test connection'] }), canEdit && (_jsxs(_Fragment, { children: [_jsx(Tooltip, { content: `Edit ${connection.name}`, children: _jsx("button", { type: "button", onClick: onEdit, "aria-label": `Edit ${connection.name}`, className: cn('rounded-sm p-1.5 hover:text-violet-600', MUTED), children: _jsx(Pencil, { size: 12 }) }) }), _jsx(Tooltip, { content: users.length > 0
133
+ return (_jsxs("div", { className: cn('rounded-lg border p-4', RULE, PANEL), children: [_jsxs("div", { className: "flex flex-wrap items-start justify-between gap-3", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx(Plug, { size: 13, className: MUTED }), _jsx("span", { className: "text-sm font-medium", children: connection.name }), _jsx("span", { className: "rounded-sm bg-zinc-100 px-1.5 py-0.5 font-mono text-[10px] uppercase dark:bg-zinc-800", children: connection.kind }), users.length > 0 && (_jsx(Tooltip, { content: `Read through by ${users.map((c) => c.name).join(', ')}. Moving this address moves all of them at once, which is the point.`, children: _jsxs("span", { className: cn('flex cursor-help items-center gap-1 font-mono text-[10px]', MUTED), children: [_jsx(Waypoints, { size: 10 }), users.length] }) }))] }), _jsx("div", { className: cn('mt-1 font-mono text-[11px]', MUTED), children: describeConnection(connection) }), connection.description && (_jsx("p", { className: cn('mt-1 text-[11px]', MUTED), children: connection.description })), connection.secretEnvVar && (_jsx(Tooltip, { content: "The catalog stores the NAME of this variable, never its value. A leaked catalog database gives away the shape of the integration, not the keys to it.", children: _jsxs("div", { className: cn('mt-1 flex w-fit cursor-help items-center gap-1 font-mono text-[10px]', MUTED), children: [_jsx(KeyRound, { size: 10 }), connection.secretEnvVar] }) }))] }), _jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [_jsxs("button", { type: "button", onClick: () => check.mutate(), disabled: check.isPending, className: cn('flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs disabled:opacity-40', RULE, 'hover:bg-zinc-50 dark:hover:bg-zinc-800'), children: [check.isPending ? _jsx(Loader2, { size: 12, className: "animate-spin" }) : _jsx(Plug, { size: 12 }), check.isPending ? 'Reaching…' : 'Test connection'] }), canEdit && (_jsxs(_Fragment, { children: [_jsx(Tooltip, { content: `Edit ${connection.name}`, children: _jsx("button", { type: "button", onClick: onEdit, "aria-label": `Edit ${connection.name}`, className: cn('rounded-sm p-1.5 hover:text-sky-600', MUTED), children: _jsx(Pencil, { size: 12 }) }) }), _jsx(Tooltip, { content: users.length > 0
134
134
  ? `${users.length} connector${users.length === 1 ? '' : 's'} read through this. Deleting it is refused while that is true.`
135
135
  : `Delete ${connection.name}`, children: _jsx("button", { type: "button", onClick: () => {
136
136
  setBlockedBy(null);
@@ -10,7 +10,7 @@ import { cn } from './cn';
10
10
  */
11
11
  export function CoverageLedger({ types, selected, onSelect }) {
12
12
  const named = types.filter((t) => t.enriched).length;
13
- return (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx("div", { className: "flex flex-wrap items-end gap-[3px]", children: types.map((type, index) => (_jsx("button", { type: "button", onClick: () => onSelect(type.name), title: `${type.displayName} — ${type.enriched ? 'named' : 'not yet named'}`, "aria-label": `${type.displayName}, ${type.enriched ? 'named' : 'not yet named'}`, style: { animationDelay: `${Math.min(index * 12, 600)}ms` }, className: cn('h-7 w-[7px] rounded-[1px] transition-all duration-150', 'hover:h-9 focus-visible:h-9 focus-visible:outline-2', 'focus-visible:outline-offset-2 focus-visible:outline-violet-500', type.enriched
13
+ return (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx("div", { className: "flex flex-wrap items-end gap-[3px]", children: types.map((type, index) => (_jsx("button", { type: "button", onClick: () => onSelect(type.name), title: `${type.displayName} — ${type.enriched ? 'named' : 'not yet named'}`, "aria-label": `${type.displayName}, ${type.enriched ? 'named' : 'not yet named'}`, style: { animationDelay: `${Math.min(index * 12, 600)}ms` }, className: cn('h-7 w-[7px] rounded-[1px] transition-all duration-150', 'hover:h-9 focus-visible:h-9 focus-visible:outline-2', 'focus-visible:outline-offset-2 focus-visible:outline-sky-500', type.enriched
14
14
  ? 'bg-emerald-500/85 hover:bg-emerald-500'
15
- : 'bg-amber-400/55 hover:bg-amber-400/90', selected === type.name && 'h-10 bg-violet-600 hover:bg-violet-600') }, type.name))) }), _jsxs("p", { className: "font-mono text-[11px] tracking-tight text-zinc-400 dark:text-zinc-500", children: [_jsx("span", { className: "text-zinc-950 dark:text-zinc-50", children: named }), " of ", types.length, " object types carry a name a person chose. The rest still answer to whatever the class was called."] })] }));
15
+ : 'bg-amber-400/55 hover:bg-amber-400/90', selected === type.name && 'h-10 bg-sky-600 hover:bg-sky-600') }, type.name))) }), _jsxs("p", { className: "font-mono text-[11px] tracking-tight text-zinc-400 dark:text-zinc-500", children: [_jsx("span", { className: "text-zinc-950 dark:text-zinc-50", children: named }), " of ", types.length, " object types carry a name a person chose. The rest still answer to whatever the class was called."] })] }));
16
16
  }
@@ -124,8 +124,8 @@ export function DashboardBoard() {
124
124
  e.preventDefault();
125
125
  create.mutate();
126
126
  }, children: [_jsx("input", { value: name, onChange: (e) => setName(e.target.value), placeholder: "Name", "aria-label": "Dashboard name", className: cn('min-w-0 flex-1 rounded-md border bg-white px-2 py-1 text-xs outline-none dark:bg-zinc-900', RULE) }), _jsx("button", { type: "submit", disabled: name.trim().length === 0, className: "rounded-md bg-zinc-950 px-2 text-xs text-zinc-50 disabled:opacity-40 dark:bg-zinc-100 dark:text-zinc-950", children: "Add" })] })), _jsxs("nav", { className: "min-h-0 flex-1 overflow-y-auto p-2", children: [dashboards.length === 0 && (_jsx("p", { className: cn('px-2 py-4 text-center text-[11px]', MUTED), children: "No dashboards yet." })), dashboards.map((dashboard) => (_jsxs("button", { type: "button", onClick: () => setSelectedId(dashboard.id), className: cn('flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-left text-sm', selected?.id === dashboard.id
127
- ? 'bg-violet-100 dark:bg-violet-950'
128
- : 'hover:bg-zinc-50 dark:hover:bg-zinc-800'), children: [_jsx(LayoutGrid, { size: 12, className: MUTED }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: dashboard.name }), _jsx("span", { className: cn('font-mono text-[10px]', MUTED), children: dashboard.cards.length })] }, dashboard.id)))] }), selected && saved.length > 0 && (_jsxs("div", { className: cn('border-t p-2', RULE), children: [_jsx("div", { className: cn('px-1 pb-1 font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: "Add a card" }), saved.map((query) => (_jsxs("button", { type: "button", onClick: () => addCard(query.id), className: cn('w-full truncate rounded-md px-2 py-1 text-left text-[11px]', 'transition-all hover:translate-x-0.5 hover:bg-violet-50', 'dark:hover:bg-violet-950/40'), children: ["+ ", query.name] }, query.id)))] }))] }), _jsx("main", { className: "min-w-0 flex-1 overflow-y-auto", children: !selected ? (_jsx("div", { className: "flex h-full items-center justify-center px-6", children: _jsxs("div", { className: "max-w-sm text-center", children: [_jsx("h2", { className: "text-lg font-medium", children: "No dashboard open" }), _jsx("p", { className: cn('mt-1 text-sm', MUTED), children: "Save a query first, then make a dashboard and add it as a card." })] }) })) : (_jsxs("div", { className: "mx-auto max-w-6xl px-8 py-6", children: [_jsxs("div", { className: "flex items-start justify-between gap-4", children: [_jsxs("div", { children: [_jsx("h1", { className: "text-2xl font-semibold tracking-tight", children: selected.name }), _jsxs("p", { className: cn('mt-0.5 font-mono text-[11px]', MUTED), children: [selected.cards.length, " cards \u00B7 by ", selected.createdBy] })] }), _jsxs("button", { type: "button", onClick: () => remove.mutate(selected.id), className: cn('flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs', RULE, MUTED, 'hover:bg-zinc-50 dark:hover:bg-zinc-800'), children: [_jsx(Trash2, { size: 12 }), "Delete"] })] }), selected.cards.length === 0 ? (_jsx("p", { className: cn('mt-8 rounded-lg border border-dashed px-4 py-12 text-center text-sm', RULE, MUTED), children: "Empty. Add a saved query from the left." })) : (_jsx(DndContext, { sensors: sensors, collisionDetection: closestCenter, onDragEnd: onDragEnd, children: _jsx(SortableContext, { items: [...selected.cards]
127
+ ? 'bg-sky-100 dark:bg-sky-950'
128
+ : 'hover:bg-zinc-50 dark:hover:bg-zinc-800'), children: [_jsx(LayoutGrid, { size: 12, className: MUTED }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: dashboard.name }), _jsx("span", { className: cn('font-mono text-[10px]', MUTED), children: dashboard.cards.length })] }, dashboard.id)))] }), selected && saved.length > 0 && (_jsxs("div", { className: cn('border-t p-2', RULE), children: [_jsx("div", { className: cn('px-1 pb-1 font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: "Add a card" }), saved.map((query) => (_jsxs("button", { type: "button", onClick: () => addCard(query.id), className: cn('w-full truncate rounded-md px-2 py-1 text-left text-[11px]', 'transition-all hover:translate-x-0.5 hover:bg-sky-50', 'dark:hover:bg-sky-950/40'), children: ["+ ", query.name] }, query.id)))] }))] }), _jsx("main", { className: "min-w-0 flex-1 overflow-y-auto", children: !selected ? (_jsx("div", { className: "flex h-full items-center justify-center px-6", children: _jsxs("div", { className: "max-w-sm text-center", children: [_jsx("h2", { className: "text-lg font-medium", children: "No dashboard open" }), _jsx("p", { className: cn('mt-1 text-sm', MUTED), children: "Save a query first, then make a dashboard and add it as a card." })] }) })) : (_jsxs("div", { className: "mx-auto max-w-6xl px-8 py-6", children: [_jsxs("div", { className: "flex items-start justify-between gap-4", children: [_jsxs("div", { children: [_jsx("h1", { className: "text-2xl font-semibold tracking-tight", children: selected.name }), _jsxs("p", { className: cn('mt-0.5 font-mono text-[11px]', MUTED), children: [selected.cards.length, " cards \u00B7 by ", selected.createdBy] })] }), _jsxs("button", { type: "button", onClick: () => remove.mutate(selected.id), className: cn('flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs', RULE, MUTED, 'hover:bg-zinc-50 dark:hover:bg-zinc-800'), children: [_jsx(Trash2, { size: 12 }), "Delete"] })] }), selected.cards.length === 0 ? (_jsx("p", { className: cn('mt-8 rounded-lg border border-dashed px-4 py-12 text-center text-sm', RULE, MUTED), children: "Empty. Add a saved query from the left." })) : (_jsx(DndContext, { sensors: sensors, collisionDetection: closestCenter, onDragEnd: onDragEnd, children: _jsx(SortableContext, { items: [...selected.cards]
129
129
  .sort((a, b) => a.position - b.position)
130
130
  .map((c) => c.id), strategy: rectSortingStrategy, children: _jsx("div", { className: "mt-6 grid grid-cols-4 gap-4", children: [...selected.cards]
131
131
  .sort((a, b) => a.position - b.position)
@@ -53,9 +53,9 @@ export function EditableField({ value, placeholder = 'Not named yet', onSave, mu
53
53
  commit();
54
54
  }
55
55
  },
56
- className: cn('w-full rounded-sm border border-violet-500 bg-white px-1.5 py-0.5 dark:bg-zinc-900', 'outline-none ring-2 ring-violet-500/20', inputClassName),
56
+ className: cn('w-full rounded-sm border border-sky-500 bg-white px-1.5 py-0.5 dark:bg-zinc-900', 'outline-none ring-2 ring-sky-500/20', inputClassName),
57
57
  };
58
58
  return (_jsxs("div", { className: cn('flex items-start gap-1.5', className), children: [multiline ? (_jsx("textarea", { ...shared, ref: textareaRef, rows: 3 })) : (_jsx("input", { ...shared, ref: inputRef, type: "text" })), _jsx("button", { type: "button", onMouseDown: (e) => e.preventDefault(), onClick: commit, "aria-label": `Save ${label}`, className: "mt-0.5 rounded-sm p-0.5 text-emerald-600 hover:bg-emerald-100 dark:hover:bg-emerald-950", children: _jsx(Check, { size: 14 }) }), _jsx("button", { type: "button", onMouseDown: (e) => e.preventDefault(), onClick: cancel, "aria-label": `Cancel editing ${label}`, className: "mt-0.5 rounded-sm p-0.5 text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800", children: _jsx(X, { size: 14 }) })] }));
59
59
  }
60
- return (_jsxs("button", { type: "button", onClick: () => setEditing(true), "aria-label": `Edit ${label}`, className: cn('group/edit flex w-full items-start gap-1.5 rounded-sm px-1.5 py-0.5 text-left', 'border border-transparent hover:border-zinc-200 hover:bg-zinc-50', 'dark:hover:border-zinc-800 dark:hover:bg-zinc-950', 'focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-violet-500', className), children: [_jsx("span", { className: cn(!value && 'italic text-zinc-400 dark:text-zinc-500'), children: value || placeholder }), _jsx(Pencil, { size: 12, className: "mt-1 shrink-0 opacity-0 transition-opacity group-hover/edit:opacity-60" })] }));
60
+ return (_jsxs("button", { type: "button", onClick: () => setEditing(true), "aria-label": `Edit ${label}`, className: cn('group/edit flex w-full items-start gap-1.5 rounded-sm px-1.5 py-0.5 text-left', 'border border-transparent hover:border-zinc-200 hover:bg-zinc-50', 'dark:hover:border-zinc-800 dark:hover:bg-zinc-950', 'focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-sky-500', className), children: [_jsx("span", { className: cn(!value && 'italic text-zinc-400 dark:text-zinc-500'), children: value || placeholder }), _jsx(Pencil, { size: 12, className: "mt-1 shrink-0 opacity-0 transition-opacity group-hover/edit:opacity-60" })] }));
61
61
  }
@@ -134,8 +134,8 @@ export function ObjectExplorer({ type: typeProp, pageSize = 25, backHref, backLa
134
134
  setSort(undefined);
135
135
  setSearch('');
136
136
  }, className: cn('flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm', t.name === typeName
137
- ? 'bg-violet-100 dark:bg-violet-950'
138
- : 'hover:bg-zinc-50 dark:hover:bg-zinc-800'), children: [_jsx("span", { children: t.icon ?? '◈' }), _jsx("span", { className: "flex-1 truncate", children: t.pluralDisplayName }), _jsx("span", { className: cn('font-mono text-[10px]', MUTED), children: t.tableName })] }, t.name))) }))] }), _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: search, onChange: (e) => setSearch(e.target.value), placeholder: `Search ${selectedType?.pluralDisplayName?.toLowerCase() ?? 'objects'}`, "aria-label": "Search objects", className: cn('w-72 rounded-md border bg-zinc-50 py-2 pl-8 pr-3 text-sm outline-none dark:bg-zinc-950', RULE, 'placeholder:text-zinc-400 focus:border-violet-500 focus:ring-2 focus:ring-violet-500/15') })] })] })] }), _jsxs("div", { className: "min-h-0 flex-1 overflow-auto px-8 py-6", children: [_jsxs("div", { className: cn('overflow-hidden rounded-lg border transition-opacity', RULE, PANEL, isFetching && 'opacity-60'), children: [_jsx("div", { className: "overflow-x-auto", children: _jsxs("table", { className: "w-full min-w-max text-sm", children: [_jsx("thead", { children: _jsx("tr", { className: cn('border-b bg-zinc-50 dark:bg-zinc-950', RULE), children: data?.columns.map((column) => {
137
+ ? 'bg-sky-100 dark:bg-sky-950'
138
+ : 'hover:bg-zinc-50 dark:hover:bg-zinc-800'), children: [_jsx("span", { children: t.icon ?? '◈' }), _jsx("span", { className: "flex-1 truncate", children: t.pluralDisplayName }), _jsx("span", { className: cn('font-mono text-[10px]', MUTED), children: t.tableName })] }, t.name))) }))] }), _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: search, onChange: (e) => setSearch(e.target.value), placeholder: `Search ${selectedType?.pluralDisplayName?.toLowerCase() ?? 'objects'}`, "aria-label": "Search objects", className: cn('w-72 rounded-md border bg-zinc-50 py-2 pl-8 pr-3 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("div", { className: "min-h-0 flex-1 overflow-auto px-8 py-6", children: [_jsxs("div", { className: cn('overflow-hidden rounded-lg border transition-opacity', RULE, PANEL, isFetching && 'opacity-60'), children: [_jsx("div", { className: "overflow-x-auto", children: _jsxs("table", { className: "w-full min-w-max text-sm", children: [_jsx("thead", { children: _jsx("tr", { className: cn('border-b bg-zinc-50 dark:bg-zinc-950', RULE), children: data?.columns.map((column) => {
139
139
  const active = sort === column.name;
140
140
  return (_jsxs("th", { className: cn('whitespace-nowrap px-3 py-2 text-left font-normal', isNumeric(column.type) && 'text-right'), children: [_jsxs("button", { type: "button", onClick: () => toggleSort(column.name), className: cn('group inline-flex items-center gap-1', isNumeric(column.type) && 'flex-row-reverse'), children: [_jsxs("span", { className: cn('text-xs', active
141
141
  ? 'text-zinc-950 dark:text-zinc-50'
@@ -144,7 +144,7 @@ export function ObjectExplorer({ type: typeProp, pageSize = 25, backHref, backLa
144
144
  }
145
145
  function EmptyState({ type, search, onClear, }) {
146
146
  if (search) {
147
- return (_jsxs("div", { className: "px-6 py-16 text-center", children: [_jsxs("p", { className: "text-sm text-zinc-500 dark:text-zinc-400", children: ["Nothing matches \u201C", search, "\u201D."] }), _jsx("button", { type: "button", onClick: onClear, className: "mt-2 text-sm text-violet-600 underline underline-offset-2 dark:text-violet-400", children: "Clear the search" })] }));
147
+ return (_jsxs("div", { className: "px-6 py-16 text-center", children: [_jsxs("p", { className: "text-sm text-zinc-500 dark:text-zinc-400", children: ["Nothing matches \u201C", search, "\u201D."] }), _jsx("button", { type: "button", onClick: onClear, className: "mt-2 text-sm text-sky-600 underline underline-offset-2 dark:text-sky-400", children: "Clear the search" })] }));
148
148
  }
149
149
  return (_jsxs("div", { className: "px-6 py-16 text-center", children: [_jsxs("p", { className: "text-sm text-zinc-500 dark:text-zinc-400", children: [type?.tableName, " has no rows yet."] }), _jsx("p", { className: cn('mt-1 text-xs', MUTED), children: "The type is in the catalog, so this table will fill in as soon as something writes to it." })] }));
150
150
  }
@@ -139,7 +139,7 @@ function ConnectorCard({ connector, transform, connection, canEdit, running, onR
139
139
  onDeleted();
140
140
  },
141
141
  });
142
- return (_jsxs("div", { className: cn('rounded-lg border p-4', RULE, PANEL), children: [_jsxs("div", { className: "flex flex-wrap items-start justify-between gap-3", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("span", { className: "text-sm font-medium", children: connector.name }), _jsx("span", { className: "rounded-sm bg-zinc-100 px-1.5 py-0.5 font-mono text-[10px] uppercase dark:bg-zinc-800", children: connector.kind }), _jsxs("span", { className: cn('font-mono text-[10px]', MUTED), children: ["\u2192 ", connector.targetType] }), connection && (_jsx(Tooltip, { content: `Reads through the ${connection.name} connection, which supplies the address and the credential. Moving that connection moves this connector with it.`, children: _jsxs("span", { className: cn('flex cursor-help items-center gap-1 font-mono text-[10px]', MUTED), children: [_jsx(Plug, { size: 10 }), connection.name] }) })), connector.mode === 'incremental' && (_jsx(Tooltip, { content: "Reads only what changed since the last run, and carries the rest forward.", children: _jsxs("span", { className: cn('flex cursor-help items-center gap-1 font-mono text-[10px]', MUTED), children: [_jsx(RefreshCw, { size: 10 }), "incremental"] }) })), !connector.enabled && (_jsx("span", { className: "rounded-sm bg-zinc-100 px-1.5 py-0.5 font-mono text-[10px] uppercase text-zinc-500 dark:bg-zinc-800", children: "disabled" }))] }), _jsx("div", { className: cn('mt-1 font-mono text-[11px]', MUTED), children: describeSource(connector, connection) }), connector.secretEnvVar && (_jsx(Tooltip, { content: "The catalog stores the NAME of this variable, never its value. A leaked catalog database gives away the shape of the integration, not the keys to it.", children: _jsxs("div", { className: cn('mt-1 flex w-fit cursor-help items-center gap-1 font-mono text-[10px]', MUTED), children: [_jsx(KeyRound, { size: 10 }), connector.secretEnvVar] }) }))] }), _jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [_jsxs("button", { type: "button", onClick: onRun, disabled: running || !connector.enabled, className: "flex items-center gap-1.5 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: [running ? _jsx(Loader2, { size: 12, className: "animate-spin" }) : _jsx(Play, { size: 12 }), running ? 'Running…' : 'Run now'] }), canEdit && (_jsx(Tooltip, { content: `Delete ${connector.name}`, children: _jsx("button", { type: "button", onClick: () => setConfirming(true), "aria-label": `Delete ${connector.name}`, className: cn('rounded-sm p-1.5 hover:text-red-600', MUTED), children: _jsx(Trash2, { size: 12 }) }) }))] })] }), transform && (_jsxs("button", { type: "button", onClick: onEdit, className: cn('mt-3 flex items-center gap-1.5 text-[11px]', MUTED, 'hover:text-violet-600'), children: [_jsx(Code2, { size: 11 }), transform.name, _jsxs("span", { className: "font-mono", children: [transform.language, " \u00B7 v", transform.version] })] })), runs.length > 0 && (_jsxs("div", { className: cn('mt-3 border-t pt-3', RULE), children: [_jsx("div", { className: cn('mb-1.5 font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: "Recent runs" }), _jsx("div", { className: "space-y-1", children: runs.slice(0, 4).map((entry) => (_jsx(Tooltip, { content: entry.error ? (_jsx("span", { className: "font-mono text-[11px]", children: entry.error })) : (_jsx("span", { className: "font-mono text-[11px]", children: entry.logs.slice(-3).join('\n') || 'No logs.' })), children: _jsxs("div", { className: "flex cursor-help items-center gap-2 text-[11px]", children: [_jsxs("span", { className: "sr-only", children: [entry.status, ": "] }), entry.status === 'succeeded' ? (_jsx(CircleCheck, { size: 11, "aria-hidden": true, className: "text-emerald-600" })) : entry.status === 'failed' ? (_jsx(CircleX, { size: 11, "aria-hidden": true, className: "text-red-600" })) : (_jsx(Loader2, { size: 11, "aria-hidden": true, className: "animate-spin text-sky-600" })), _jsx("span", { className: "font-mono", children: entry.snapshotId }), _jsxs("span", { className: MUTED, children: [entry.fetched, " fetched \u00B7 ", entry.written, " written", entry.transformVersion ? ` · code v${entry.transformVersion}` : ''] }), _jsx("span", { className: cn('ml-auto font-mono text-[10px]', MUTED), children: new Date(entry.startedAt).toLocaleTimeString() })] }) }, entry.id))) })] })), _jsx(ConfirmDialog, { open: confirming, onOpenChange: setConfirming, title: `Delete ${connector.name}?`, description: "The snapshots it already wrote stay where they are \u2014 this removes the connector, its schedule and its incremental watermark. Recreating it later starts reading from the beginning again.", confirmLabel: remove.isPending ? 'Deleting…' : 'Delete', pending: remove.isPending, onConfirm: () => remove.mutate(), error: remove.error
142
+ return (_jsxs("div", { className: cn('rounded-lg border p-4', RULE, PANEL), children: [_jsxs("div", { className: "flex flex-wrap items-start justify-between gap-3", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("span", { className: "text-sm font-medium", children: connector.name }), _jsx("span", { className: "rounded-sm bg-zinc-100 px-1.5 py-0.5 font-mono text-[10px] uppercase dark:bg-zinc-800", children: connector.kind }), _jsxs("span", { className: cn('font-mono text-[10px]', MUTED), children: ["\u2192 ", connector.targetType] }), connection && (_jsx(Tooltip, { content: `Reads through the ${connection.name} connection, which supplies the address and the credential. Moving that connection moves this connector with it.`, children: _jsxs("span", { className: cn('flex cursor-help items-center gap-1 font-mono text-[10px]', MUTED), children: [_jsx(Plug, { size: 10 }), connection.name] }) })), connector.mode === 'incremental' && (_jsx(Tooltip, { content: "Reads only what changed since the last run, and carries the rest forward.", children: _jsxs("span", { className: cn('flex cursor-help items-center gap-1 font-mono text-[10px]', MUTED), children: [_jsx(RefreshCw, { size: 10 }), "incremental"] }) })), !connector.enabled && (_jsx("span", { className: "rounded-sm bg-zinc-100 px-1.5 py-0.5 font-mono text-[10px] uppercase text-zinc-500 dark:bg-zinc-800", children: "disabled" }))] }), _jsx("div", { className: cn('mt-1 font-mono text-[11px]', MUTED), children: describeSource(connector, connection) }), connector.secretEnvVar && (_jsx(Tooltip, { content: "The catalog stores the NAME of this variable, never its value. A leaked catalog database gives away the shape of the integration, not the keys to it.", children: _jsxs("div", { className: cn('mt-1 flex w-fit cursor-help items-center gap-1 font-mono text-[10px]', MUTED), children: [_jsx(KeyRound, { size: 10 }), connector.secretEnvVar] }) }))] }), _jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [_jsxs("button", { type: "button", onClick: onRun, disabled: running || !connector.enabled, className: "flex items-center gap-1.5 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: [running ? _jsx(Loader2, { size: 12, className: "animate-spin" }) : _jsx(Play, { size: 12 }), running ? 'Running…' : 'Run now'] }), canEdit && (_jsx(Tooltip, { content: `Delete ${connector.name}`, children: _jsx("button", { type: "button", onClick: () => setConfirming(true), "aria-label": `Delete ${connector.name}`, className: cn('rounded-sm p-1.5 hover:text-red-600', MUTED), children: _jsx(Trash2, { size: 12 }) }) }))] })] }), transform && (_jsxs("button", { type: "button", onClick: onEdit, className: cn('mt-3 flex items-center gap-1.5 text-[11px]', MUTED, 'hover:text-sky-600'), children: [_jsx(Code2, { size: 11 }), transform.name, _jsxs("span", { className: "font-mono", children: [transform.language, " \u00B7 v", transform.version] })] })), runs.length > 0 && (_jsxs("div", { className: cn('mt-3 border-t pt-3', RULE), children: [_jsx("div", { className: cn('mb-1.5 font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: "Recent runs" }), _jsx("div", { className: "space-y-1", children: runs.slice(0, 4).map((entry) => (_jsx(Tooltip, { content: entry.error ? (_jsx("span", { className: "font-mono text-[11px]", children: entry.error })) : (_jsx("span", { className: "font-mono text-[11px]", children: entry.logs.slice(-3).join('\n') || 'No logs.' })), children: _jsxs("div", { className: "flex cursor-help items-center gap-2 text-[11px]", children: [_jsxs("span", { className: "sr-only", children: [entry.status, ": "] }), entry.status === 'succeeded' ? (_jsx(CircleCheck, { size: 11, "aria-hidden": true, className: "text-emerald-600" })) : entry.status === 'failed' ? (_jsx(CircleX, { size: 11, "aria-hidden": true, className: "text-red-600" })) : (_jsx(Loader2, { size: 11, "aria-hidden": true, className: "animate-spin text-sky-600" })), _jsx("span", { className: "font-mono", children: entry.snapshotId }), _jsxs("span", { className: MUTED, children: [entry.fetched, " fetched \u00B7 ", entry.written, " written", entry.transformVersion ? ` · code v${entry.transformVersion}` : ''] }), _jsx("span", { className: cn('ml-auto font-mono text-[10px]', MUTED), children: new Date(entry.startedAt).toLocaleTimeString() })] }) }, entry.id))) })] })), _jsx(ConfirmDialog, { open: confirming, onOpenChange: setConfirming, title: `Delete ${connector.name}?`, description: "The snapshots it already wrote stay where they are \u2014 this removes the connector, its schedule and its incremental watermark. Recreating it later starts reading from the beginning again.", confirmLabel: remove.isPending ? 'Deleting…' : 'Delete', pending: remove.isPending, onConfirm: () => remove.mutate(), error: remove.error
143
143
  ? remove.error instanceof Error
144
144
  ? remove.error.message
145
145
  : 'Could not delete it.'
@@ -82,10 +82,10 @@ export function QueryConsole({ onGenerate, maxRows = 500 }) {
82
82
  // Tab still moves focus; indentation is Shift-agnostic two spaces on Enter.
83
83
  }
84
84
  const error = run.error instanceof Error ? run.error.message : null;
85
- return (_jsx(TooltipProvider, { children: _jsxs("div", { className: "flex h-full min-h-0", children: [_jsxs("aside", { className: cn('flex w-64 shrink-0 flex-col border-r', RULE, PANEL), children: [_jsx("div", { className: cn('border-b px-3 py-2', RULE), children: _jsx("p", { className: cn('font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: "Relations" }) }), _jsxs("div", { className: "min-h-0 flex-1 overflow-y-auto p-2", children: [grouped.length === 0 && (_jsx("p", { className: cn('px-2 py-6 text-center text-xs', MUTED), children: "Nothing has been published yet." })), grouped.map(([objectType, list]) => (_jsxs("div", { className: "mb-3", children: [_jsx("div", { className: cn('px-2 py-1 font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: objectType }), list.map((relation) => (_jsx(RelationRow, { relation: relation, onInsert: insert }, relation.name)))] }, objectType)))] }), _jsx(SavedQueryPanel, { currentSql: sql, onLoad: (query) => setSql(query.sql) })] }), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [_jsxs("div", { className: cn('flex shrink-0 items-center gap-2 border-b px-4 py-2', RULE, PANEL), children: [_jsxs("button", { type: "button", onClick: () => run.mutate(), disabled: run.isPending, className: "flex items-center gap-1.5 rounded-md bg-zinc-950 px-3 py-1.5 text-xs text-zinc-50 transition-colors hover:bg-zinc-800 disabled:opacity-50 dark:bg-zinc-100 dark:text-zinc-950", children: [_jsx(Play, { size: 12 }), run.isPending ? 'Running…' : 'Run'] }), _jsx("span", { className: cn('font-mono text-[10px]', MUTED), children: "\u2318\u21B5" }), onGenerate && (_jsxs("button", { type: "button", onClick: () => setAskOpen((open) => !open), className: cn('flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs transition-colors', RULE, 'hover:bg-zinc-50 dark:hover:bg-zinc-800', askOpen && 'bg-violet-100 dark:bg-violet-950'), children: [_jsx(Sparkles, { size: 12 }), "Ask"] })), run.data && (_jsxs("span", { className: cn('ml-auto font-mono text-[11px]', MUTED), children: [run.data.rowCount, " rows \u00B7 ", run.data.cached ? 'cached' : `${run.data.elapsedMs} ms`, run.data.truncated && ' · capped'] }))] }), askOpen && onGenerate && (_jsxs("div", { className: cn('shrink-0 border-b bg-violet-50/60 px-4 py-3 dark:bg-violet-950/20', RULE), children: [_jsxs("form", { className: "flex gap-2", onSubmit: (e) => {
85
+ return (_jsx(TooltipProvider, { children: _jsxs("div", { className: "flex h-full min-h-0", children: [_jsxs("aside", { className: cn('flex w-64 shrink-0 flex-col border-r', RULE, PANEL), children: [_jsx("div", { className: cn('border-b px-3 py-2', RULE), children: _jsx("p", { className: cn('font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: "Relations" }) }), _jsxs("div", { className: "min-h-0 flex-1 overflow-y-auto p-2", children: [grouped.length === 0 && (_jsx("p", { className: cn('px-2 py-6 text-center text-xs', MUTED), children: "Nothing has been published yet." })), grouped.map(([objectType, list]) => (_jsxs("div", { className: "mb-3", children: [_jsx("div", { className: cn('px-2 py-1 font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: objectType }), list.map((relation) => (_jsx(RelationRow, { relation: relation, onInsert: insert }, relation.name)))] }, objectType)))] }), _jsx(SavedQueryPanel, { currentSql: sql, onLoad: (query) => setSql(query.sql) })] }), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [_jsxs("div", { className: cn('flex shrink-0 items-center gap-2 border-b px-4 py-2', RULE, PANEL), children: [_jsxs("button", { type: "button", onClick: () => run.mutate(), disabled: run.isPending, className: "flex items-center gap-1.5 rounded-md bg-zinc-950 px-3 py-1.5 text-xs text-zinc-50 transition-colors hover:bg-zinc-800 disabled:opacity-50 dark:bg-zinc-100 dark:text-zinc-950", children: [_jsx(Play, { size: 12 }), run.isPending ? 'Running…' : 'Run'] }), _jsx("span", { className: cn('font-mono text-[10px]', MUTED), children: "\u2318\u21B5" }), onGenerate && (_jsxs("button", { type: "button", onClick: () => setAskOpen((open) => !open), className: cn('flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs transition-colors', RULE, 'hover:bg-zinc-50 dark:hover:bg-zinc-800', askOpen && 'bg-sky-100 dark:bg-sky-950'), children: [_jsx(Sparkles, { size: 12 }), "Ask"] })), run.data && (_jsxs("span", { className: cn('ml-auto font-mono text-[11px]', MUTED), children: [run.data.rowCount, " rows \u00B7 ", run.data.cached ? 'cached' : `${run.data.elapsedMs} ms`, run.data.truncated && ' · capped'] }))] }), askOpen && onGenerate && (_jsxs("div", { className: cn('shrink-0 border-b bg-sky-50/60 px-4 py-3 dark:bg-sky-950/20', RULE), children: [_jsxs("form", { className: "flex gap-2", onSubmit: (e) => {
86
86
  e.preventDefault();
87
87
  generate.mutate();
88
- }, children: [_jsx("input", { value: prompt, onChange: (e) => setPrompt(e.target.value), placeholder: "Which vehicles gained the most work orders since the last load?", "aria-label": "Describe the query", className: cn('flex-1 rounded-md border px-3 py-1.5 text-sm outline-none', RULE, PANEL, 'focus:border-violet-500 focus:ring-2 focus:ring-violet-500/15') }), _jsx("button", { type: "submit", disabled: generate.isPending || prompt.trim().length === 0, className: "rounded-md bg-violet-600 px-3 py-1.5 text-xs text-white disabled:opacity-40", children: generate.isPending ? 'Writing…' : 'Write the SQL' })] }), _jsx("p", { className: cn('mt-1.5 text-[11px]', MUTED), children: "It sees the relation and column names above, never the rows. Read the SQL before running it." }), generate.error && (_jsx("p", { className: "mt-1 text-[11px] text-red-600", children: generate.error instanceof Error
88
+ }, children: [_jsx("input", { value: prompt, onChange: (e) => setPrompt(e.target.value), placeholder: "Which vehicles gained the most work orders since the last load?", "aria-label": "Describe the query", className: cn('flex-1 rounded-md border px-3 py-1.5 text-sm outline-none', RULE, PANEL, 'focus:border-sky-500 focus:ring-2 focus:ring-sky-500/15') }), _jsx("button", { type: "submit", disabled: generate.isPending || prompt.trim().length === 0, className: "rounded-md bg-sky-600 px-3 py-1.5 text-xs text-white disabled:opacity-40", children: generate.isPending ? 'Writing…' : 'Write the SQL' })] }), _jsx("p", { className: cn('mt-1.5 text-[11px]', MUTED), children: "It sees the relation and column names above, never the rows. Read the SQL before running it." }), generate.error && (_jsx("p", { className: "mt-1 text-[11px] text-red-600", children: generate.error instanceof Error
89
89
  ? generate.error.message
90
90
  : 'The assistant could not write that.' }))] })), _jsx(SqlEditor, { value: sql, onChange: setSql, onKeyDown: onEditorKeyDown, textareaRef: editorRef }), _jsxs("div", { className: "min-h-0 flex-1 overflow-auto", children: [error && (_jsxs("div", { className: "m-4 flex items-start gap-2 rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700 dark:border-red-900 dark:bg-red-950/40 dark:text-red-300", children: [_jsx(AlertTriangle, { size: 14, className: "mt-0.5 shrink-0" }), _jsx("span", { className: "font-mono leading-relaxed", children: error })] })), run.data && _jsx(ResultTable, { result: run.data }), !run.data && !error && (_jsx("p", { className: cn('p-8 text-center text-sm', MUTED), children: "Results appear here." }))] })] })] }) }));
91
91
  }
@@ -59,7 +59,7 @@ export function SavedQueryPanel({ currentSql, onLoad, }) {
59
59
  return (_jsxs("div", { className: cn('border-t', RULE), children: [_jsxs("div", { className: "flex items-center justify-between px-3 py-2", children: [_jsx("span", { className: cn('font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: "Saved" }), _jsx("button", { type: "button", onClick: () => setSaving((open) => !open), disabled: currentSql.trim().length === 0, className: cn('rounded-sm p-1 disabled:opacity-30', MUTED, 'hover:bg-zinc-100 hover:text-zinc-900 dark:hover:bg-zinc-800'), "aria-label": "Save the current query", children: _jsx(Bookmark, { size: 12 }) })] }), saving && (_jsxs("form", { className: "space-y-1.5 px-3 pb-3", onSubmit: (e) => {
60
60
  e.preventDefault();
61
61
  save.mutate();
62
- }, children: [_jsx("input", { value: draft.name, onChange: (e) => setDraft({ ...draft, name: e.target.value }), placeholder: "Name", "aria-label": "Query name", className: cn('w-full rounded-md border bg-white px-2 py-1 text-xs outline-none dark:bg-zinc-900', RULE, 'focus:border-violet-500') }), _jsx("input", { value: draft.folder ?? '', onChange: (e) => setDraft({ ...draft, folder: e.target.value }), placeholder: "Folder (optional)", "aria-label": "Folder", className: cn('w-full rounded-md border bg-white px-2 py-1 text-xs outline-none dark:bg-zinc-900', RULE, 'focus:border-violet-500') }), _jsxs("div", { className: "flex gap-1.5", children: [_jsx("select", { value: draft.visualization?.kind ?? 'table', onChange: (e) => setDraft({
62
+ }, children: [_jsx("input", { value: draft.name, onChange: (e) => setDraft({ ...draft, name: e.target.value }), placeholder: "Name", "aria-label": "Query name", className: cn('w-full rounded-md border bg-white px-2 py-1 text-xs outline-none dark:bg-zinc-900', RULE, 'focus:border-sky-500') }), _jsx("input", { value: draft.folder ?? '', onChange: (e) => setDraft({ ...draft, folder: e.target.value }), placeholder: "Folder (optional)", "aria-label": "Folder", className: cn('w-full rounded-md border bg-white px-2 py-1 text-xs outline-none dark:bg-zinc-900', RULE, 'focus:border-sky-500') }), _jsxs("div", { className: "flex gap-1.5", children: [_jsx("select", { value: draft.visualization?.kind ?? 'table', onChange: (e) => setDraft({
63
63
  ...draft,
64
64
  visualization: {
65
65
  ...(draft.visualization ?? {}),
@@ -71,7 +71,7 @@ export function SavedQueryPanel({ currentSql, onLoad, }) {
71
71
  ...(draft.visualization ?? { kind: 'table' }),
72
72
  library: e.target.value === 'css' ? undefined : e.target.value,
73
73
  },
74
- }), "aria-label": "Chart library", title: "Which chart library draws this. Only libraries this app registered appear here.", className: cn('min-w-0 flex-1 rounded-md border bg-white px-1 py-1 text-[11px] outline-none dark:bg-zinc-900', RULE), children: registeredChartLibraries().map((library) => (_jsx("option", { value: library, children: library }, library))) })] }), _jsxs("label", { className: cn('flex items-center gap-1.5 text-[11px]', MUTED), children: [_jsx("input", { type: "checkbox", checked: draft.shared ?? false, onChange: (e) => setDraft({ ...draft, shared: e.target.checked }), className: "accent-violet-500" }), "Let other apps embed this"] }), _jsxs("label", { className: cn('flex items-center gap-1.5 text-[11px]', MUTED), children: [_jsx(Timer, { size: 11 }), "Reuse the result for", _jsx("input", { type: "number", min: 0, value: draft.cacheTtlSeconds ?? 0, onChange: (e) => setDraft({ ...draft, cacheTtlSeconds: Number(e.target.value) }), "aria-label": "Cache seconds", className: cn('w-14 rounded-md border bg-white px-1 py-0.5 text-right text-[11px] outline-none dark:bg-zinc-900', RULE) }), "s"] }), _jsx("button", { type: "submit", disabled: save.isPending || draft.name.trim().length === 0, className: "w-full rounded-md bg-zinc-950 px-2 py-1 text-xs text-zinc-50 disabled:opacity-40 dark:bg-zinc-100 dark:text-zinc-950", children: save.isPending ? 'Saving…' : 'Save this query' }), save.error && (_jsx("p", { className: "text-[11px] text-red-600", children: save.error instanceof Error ? save.error.message : 'Could not save.' }))] })), _jsxs("div", { className: "max-h-64 overflow-y-auto px-2 pb-2", children: [saved.length === 0 && (_jsx("p", { className: cn('px-2 py-3 text-center text-[11px]', MUTED), children: "Nothing saved yet." })), grouped.map(([folder, list]) => (_jsxs("div", { className: "mb-2", children: [_jsx("div", { className: cn('px-2 py-1 font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: folder }), list.map((query) => (_jsxs("div", { className: "group flex items-center", children: [_jsx(Tooltip, { side: "right", content: query.description ??
74
+ }), "aria-label": "Chart library", title: "Which chart library draws this. Only libraries this app registered appear here.", className: cn('min-w-0 flex-1 rounded-md border bg-white px-1 py-1 text-[11px] outline-none dark:bg-zinc-900', RULE), children: registeredChartLibraries().map((library) => (_jsx("option", { value: library, children: library }, library))) })] }), _jsxs("label", { className: cn('flex items-center gap-1.5 text-[11px]', MUTED), children: [_jsx("input", { type: "checkbox", checked: draft.shared ?? false, onChange: (e) => setDraft({ ...draft, shared: e.target.checked }), className: "accent-sky-500" }), "Let other apps embed this"] }), _jsxs("label", { className: cn('flex items-center gap-1.5 text-[11px]', MUTED), children: [_jsx(Timer, { size: 11 }), "Reuse the result for", _jsx("input", { type: "number", min: 0, value: draft.cacheTtlSeconds ?? 0, onChange: (e) => setDraft({ ...draft, cacheTtlSeconds: Number(e.target.value) }), "aria-label": "Cache seconds", className: cn('w-14 rounded-md border bg-white px-1 py-0.5 text-right text-[11px] outline-none dark:bg-zinc-900', RULE) }), "s"] }), _jsx("button", { type: "submit", disabled: save.isPending || draft.name.trim().length === 0, className: "w-full rounded-md bg-zinc-950 px-2 py-1 text-xs text-zinc-50 disabled:opacity-40 dark:bg-zinc-100 dark:text-zinc-950", children: save.isPending ? 'Saving…' : 'Save this query' }), save.error && (_jsx("p", { className: "text-[11px] text-red-600", children: save.error instanceof Error ? save.error.message : 'Could not save.' }))] })), _jsxs("div", { className: "max-h-64 overflow-y-auto px-2 pb-2", children: [saved.length === 0 && (_jsx("p", { className: cn('px-2 py-3 text-center text-[11px]', MUTED), children: "Nothing saved yet." })), grouped.map(([folder, list]) => (_jsxs("div", { className: "mb-2", children: [_jsx("div", { className: cn('px-2 py-1 font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: folder }), list.map((query) => (_jsxs("div", { className: "group flex items-center", children: [_jsx(Tooltip, { side: "right", content: query.description ??
75
75
  (query.cacheTtlSeconds > 0
76
76
  ? `Results reused for ${query.cacheTtlSeconds}s.`
77
77
  : 'Never cached — runs every time.'), children: _jsxs("button", { type: "button", onClick: () => onLoad(query), className: "min-w-0 flex-1 truncate rounded-md px-2 py-1 text-left text-[11px] hover:bg-zinc-50 dark:hover:bg-zinc-800", children: [query.name, query.cacheTtlSeconds > 0 && (_jsxs("span", { className: cn('ml-1 font-mono text-[9px]', MUTED), children: [query.cacheTtlSeconds, "s"] }))] }) }), _jsx(Tooltip, { content: "Download as CSV", children: _jsx("a", { href: client.exportUrl(query.id), className: cn('rounded-sm p-1 opacity-0 group-hover:opacity-100', MUTED), "aria-label": `Export ${query.name}`, children: _jsx(Download, { size: 11 }) }) }), _jsx("button", { type: "button", onClick: () => remove.mutate(query.id), className: cn('rounded-sm p-1 opacity-0 group-hover:opacity-100 hover:text-red-600', MUTED), "aria-label": `Delete ${query.name}`, children: _jsx(Trash2, { size: 11 }) })] }, query.id)))] }, folder)))] })] }));
@@ -84,8 +84,8 @@ export const CATALOG_EVENT_META = {
84
84
  },
85
85
  'transform.changed': {
86
86
  icon: ScrollText,
87
- tone: 'text-violet-600',
88
- bar: 'bg-violet-500/70',
87
+ tone: 'text-sky-600',
88
+ bar: 'bg-sky-500/70',
89
89
  label: 'Transform changed',
90
90
  meaning: 'Code that shapes stored data was edited. The first question about a surprising load.',
91
91
  },
@@ -126,8 +126,8 @@ export const CATALOG_EVENT_META = {
126
126
  },
127
127
  'type.curated': {
128
128
  icon: Pencil,
129
- tone: 'text-violet-600',
130
- bar: 'bg-violet-500/70',
129
+ tone: 'text-sky-600',
130
+ bar: 'bg-sky-500/70',
131
131
  label: 'Curated',
132
132
  meaning: 'A label, description or unit changed. No migration.',
133
133
  },
@@ -23,7 +23,7 @@ export function CssBarChart({ result, visualization }) {
23
23
  const max = Math.max(...rows.map((row) => Number(row[value]) || 0).filter(Number.isFinite), 0);
24
24
  return (_jsx("div", { className: "space-y-1.5", children: rows.map((row, index) => {
25
25
  const raw = Number(row[value]) || 0;
26
- return (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "w-24 shrink-0 truncate text-[11px]", children: String(row[label] ?? '—') }), _jsx("div", { className: "h-3 flex-1 overflow-hidden rounded-sm bg-zinc-100 dark:bg-zinc-800", children: _jsx("div", { className: "h-full rounded-sm bg-violet-500/80", style: { width: max > 0 ? `${(raw / max) * 100}%` : '0%' } }) }), _jsx("span", { className: "w-12 shrink-0 text-right font-mono text-[11px] tabular-nums", children: raw })] }, index));
26
+ return (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "w-24 shrink-0 truncate text-[11px]", children: String(row[label] ?? '—') }), _jsx("div", { className: "h-3 flex-1 overflow-hidden rounded-sm bg-zinc-100 dark:bg-zinc-800", children: _jsx("div", { className: "h-full rounded-sm bg-sky-500/80", style: { width: max > 0 ? `${(raw / max) * 100}%` : '0%' } }) }), _jsx("span", { className: "w-12 shrink-0 text-right font-mono text-[11px] tabular-nums", children: raw })] }, index));
27
27
  }) }));
28
28
  }
29
29
  /**
package/dist/context.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { CatalogAuditEvent, CatalogConnection, CatalogConnector, CatalogObjectPage, CatalogQueryRelation, CatalogQueryResult, CatalogSnapshot, CatalogTraceList, CatalogTransform, ConnectionCheck, ConnectorRun, Dashboard, DashboardCard, ObjectQueryParams, PropertyPatch, SaveQueryInput, SavedQuery, TraceQuery, TransformLanguage, TransformResult, TypePatch } from '@dudousxd/nestjs-catalog/client';
2
2
  import { type ReactNode } from 'react';
3
+ import { type PeopleQuery } from './routes';
3
4
  import type { CatalogWorkflow, WorkflowDurability, WorkflowInput, WorkflowRun } from './workflow/model';
4
5
  /**
5
6
  * How these screens talk to the server.
@@ -125,6 +126,13 @@ export interface CatalogPrincipalSummary {
125
126
  lastSeenAt: string | null;
126
127
  ownedTypes: string[];
127
128
  }
129
+ export interface CatalogPeoplePage {
130
+ people: CatalogPersonSummary[];
131
+ /** How many match, ignoring the page. */
132
+ total: number;
133
+ limit: number;
134
+ offset: number;
135
+ }
128
136
  /** A person: signs in, and acts through an application that caps them. */
129
137
  export interface CatalogPersonSummary {
130
138
  email: string;
@@ -299,7 +307,12 @@ export interface CatalogClient {
299
307
  * becomes a button it stops leaving a reviewable trail.
300
308
  */
301
309
  listPrincipals(): Promise<CatalogPrincipalSummary[]>;
302
- listPeople(): Promise<CatalogPersonSummary[]>;
310
+ /**
311
+ * A PAGE, not the list. The server bounds it whatever is asked for, so a
312
+ * caller that ignores `total` is a screen that silently under-reports who has
313
+ * access — which reads as "this person has none" rather than "look further".
314
+ */
315
+ listPeople(query?: PeopleQuery): Promise<CatalogPeoplePage>;
303
316
  upsertPerson(input: PersonInput): Promise<PersonUpsertResult>;
304
317
  }
305
318
  export interface CatalogProviderProps {
package/dist/context.js CHANGED
@@ -56,7 +56,7 @@ export function CatalogProvider({ transport, pipelineBasePath = DEFAULT_PIPELINE
56
56
  deleteWorkflow: (id) => transport.delete(pipeline.workflow(id)),
57
57
  runWorkflow: (id) => transport.post(pipeline.runWorkflow(id), {}),
58
58
  listPrincipals: () => transport.get(access.principals()),
59
- listPeople: () => transport.get(access.people()),
59
+ listPeople: (query) => transport.get(access.people(query)),
60
60
  upsertPerson: (input) => transport.post(access.people(), input),
61
61
  };
62
62
  }, [transport, pipelineBasePath, accessBasePath]);
package/dist/routes.d.ts CHANGED
@@ -64,7 +64,18 @@ export interface PipelineRoutes {
64
64
  export declare function pipelineRoutes(basePath?: string): PipelineRoutes;
65
65
  export interface AccessRoutes {
66
66
  principals(): string;
67
- /** GET lists people; POST creates or updates one. */
68
- people(): string;
67
+ /**
68
+ * GET lists people; POST creates or updates one.
69
+ *
70
+ * The GET is PAGED — a host's user table is its whole directory, and the
71
+ * server caps whatever is asked for. Omitting the query is asking for the
72
+ * server's default page, never for all of them.
73
+ */
74
+ people(query?: PeopleQuery): string;
75
+ }
76
+ export interface PeopleQuery {
77
+ search?: string;
78
+ limit?: number;
79
+ offset?: number;
69
80
  }
70
81
  export declare function accessRoutes(basePath?: string): AccessRoutes;
package/dist/routes.js CHANGED
@@ -68,6 +68,16 @@ export function accessRoutes(basePath = DEFAULT_ACCESS_BASE_PATH) {
68
68
  const base = normalise(basePath);
69
69
  return {
70
70
  principals: () => `${base}/principals`,
71
- people: () => `${base}/people`,
71
+ people: (query) => {
72
+ const params = new URLSearchParams();
73
+ if (query?.search)
74
+ params.set('search', query.search);
75
+ if (query?.limit !== undefined)
76
+ params.set('limit', String(query.limit));
77
+ if (query?.offset !== undefined)
78
+ params.set('offset', String(query.offset));
79
+ const search = params.toString();
80
+ return search ? `${base}/people?${search}` : `${base}/people`;
81
+ },
72
82
  };
73
83
  }
package/dist/ui/field.js CHANGED
@@ -12,7 +12,7 @@ import { cn } from '../cn';
12
12
  * checking a half-filled connector form has no way to tell which box held the
13
13
  * prefix and which held the suffix.
14
14
  */
15
- const CONTROL = cn('w-full rounded-md border px-2 py-1.5 text-xs outline-none', 'border-zinc-200 bg-white text-zinc-900 placeholder:text-zinc-400', 'dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-100 dark:placeholder:text-zinc-600', 'focus-visible:border-violet-500 focus-visible:ring-2 focus-visible:ring-violet-500/15');
15
+ const CONTROL = cn('w-full rounded-md border px-2 py-1.5 text-xs outline-none', 'border-zinc-200 bg-white text-zinc-900 placeholder:text-zinc-400', 'dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-100 dark:placeholder:text-zinc-600', 'focus-visible:border-sky-500 focus-visible:ring-2 focus-visible:ring-sky-500/15');
16
16
  function Label({ children }) {
17
17
  return (_jsx("span", { className: "mb-1 block font-mono text-[10px] uppercase tracking-[0.14em] text-zinc-400 dark:text-zinc-500", children: children }));
18
18
  }
package/dist/ui/select.js CHANGED
@@ -12,12 +12,12 @@ export function Select({ value, onValueChange, options, ariaLabel, placeholder =
12
12
  onValueChange: (next) => {
13
13
  if (typeof next === 'string')
14
14
  onValueChange(next);
15
- }, disabled: disabled, children: [_jsxs(BaseSelect.Trigger, { "aria-label": ariaLabel, className: cn('flex w-full items-center justify-between gap-2 rounded-md border px-2 py-1.5 text-left text-xs', 'border-zinc-200 bg-white text-zinc-900 outline-none', 'dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-100', 'focus-visible:border-violet-500 focus-visible:ring-2 focus-visible:ring-violet-500/15', 'disabled:opacity-40', className), children: [_jsx(BaseSelect.Value, { className: "truncate", children: selected ? (selected.label) : (_jsx("span", { className: "text-zinc-400 dark:text-zinc-500", children: placeholder })) }), _jsx(BaseSelect.Icon, { children: _jsx(ChevronsUpDown, { size: 12, className: "shrink-0 text-zinc-400" }) })] }), _jsx(BaseSelect.Portal, { children: _jsx(BaseSelect.Positioner, { sideOffset: 4,
15
+ }, disabled: disabled, children: [_jsxs(BaseSelect.Trigger, { "aria-label": ariaLabel, className: cn('flex w-full items-center justify-between gap-2 rounded-md border px-2 py-1.5 text-left text-xs', 'border-zinc-200 bg-white text-zinc-900 outline-none', 'dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-100', 'focus-visible:border-sky-500 focus-visible:ring-2 focus-visible:ring-sky-500/15', 'disabled:opacity-40', className), children: [_jsx(BaseSelect.Value, { className: "truncate", children: selected ? (selected.label) : (_jsx("span", { className: "text-zinc-400 dark:text-zinc-500", children: placeholder })) }), _jsx(BaseSelect.Icon, { children: _jsx(ChevronsUpDown, { size: 12, className: "shrink-0 text-zinc-400" }) })] }), _jsx(BaseSelect.Portal, { children: _jsx(BaseSelect.Positioner, { sideOffset: 4,
16
16
  // Overlapping the trigger so the chosen row lands under the cursor is
17
17
  // Base UI's default and it is wrong here: these popups carry a hint
18
18
  // line per row, so the popup is much taller than the trigger and the
19
19
  // overlap puts it over the field somebody is reading.
20
- alignItemWithTrigger: false, className: "z-50", children: _jsx(BaseSelect.Popup, { className: cn('max-h-72 min-w-[var(--anchor-width)] overflow-y-auto rounded-md border p-1 shadow-md', 'border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900', 'origin-[var(--transform-origin)] transition-[opacity,transform] duration-100 ease-out', 'data-[starting-style]:scale-95 data-[starting-style]:opacity-0', 'data-[ending-style]:scale-95 data-[ending-style]:opacity-0'), children: _jsx(BaseSelect.List, { children: options.map((option) => (_jsxs(BaseSelect.Item, { value: option.value, disabled: option.disabled, className: cn('flex cursor-default items-start gap-2 rounded-sm px-2 py-1.5 text-xs outline-none', 'data-[highlighted]:bg-zinc-100 dark:data-[highlighted]:bg-zinc-800', 'data-[disabled]:opacity-40'), children: [_jsx(BaseSelect.ItemIndicator, { className: "mt-0.5 shrink-0", children: _jsx(Check, { size: 11, className: "text-violet-600" }) }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx(BaseSelect.ItemText, { className: "block truncate", children: option.label }), option.hint && (_jsx("span", { className: "mt-0.5 block truncate font-mono text-[10px] text-zinc-400 dark:text-zinc-500", children: option.hint }))] })] }, option.value))) }) }) }) })] }));
20
+ alignItemWithTrigger: false, className: "z-50", children: _jsx(BaseSelect.Popup, { className: cn('max-h-72 min-w-[var(--anchor-width)] overflow-y-auto rounded-md border p-1 shadow-md', 'border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900', 'origin-[var(--transform-origin)] transition-[opacity,transform] duration-100 ease-out', 'data-[starting-style]:scale-95 data-[starting-style]:opacity-0', 'data-[ending-style]:scale-95 data-[ending-style]:opacity-0'), children: _jsx(BaseSelect.List, { children: options.map((option) => (_jsxs(BaseSelect.Item, { value: option.value, disabled: option.disabled, className: cn('flex cursor-default items-start gap-2 rounded-sm px-2 py-1.5 text-xs outline-none', 'data-[highlighted]:bg-zinc-100 dark:data-[highlighted]:bg-zinc-800', 'data-[disabled]:opacity-40'), children: [_jsx(BaseSelect.ItemIndicator, { className: "mt-0.5 shrink-0", children: _jsx(Check, { size: 11, className: "text-sky-600" }) }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx(BaseSelect.ItemText, { className: "block truncate", children: option.label }), option.hint && (_jsx("span", { className: "mt-0.5 block truncate font-mono text-[10px] text-zinc-400 dark:text-zinc-500", children: option.hint }))] })] }, option.value))) }) }) }) })] }));
21
21
  }
22
22
  /**
23
23
  * A select with a label above it, which is what every form in this package
package/dist/ui/sheet.js CHANGED
@@ -33,5 +33,5 @@ import { Tooltip } from './tooltip';
33
33
  export function Sheet({ open, onOpenChange, title, description, width = 'narrow', modal = true, children, }) {
34
34
  return (_jsx(BaseDialog.Root, { open: open, onOpenChange: onOpenChange, modal: modal, children: _jsxs(BaseDialog.Portal, { children: [modal && (_jsx(BaseDialog.Backdrop, { className: cn('fixed inset-0 z-40 bg-zinc-950/20 dark:bg-zinc-950/50', 'transition-opacity duration-150', 'data-[starting-style]:opacity-0 data-[ending-style]:opacity-0') })), _jsxs(BaseDialog.Popup, { className: cn('fixed inset-y-0 right-0 z-50 flex flex-col border-l shadow-xl outline-none', 'border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900', width === 'wide'
35
35
  ? 'w-[min(64rem,calc(100vw-2rem))]'
36
- : 'w-[min(24rem,calc(100vw-2rem))]', 'transition-transform duration-200 ease-out', 'data-[starting-style]:translate-x-full data-[ending-style]:translate-x-full'), children: [_jsxs("div", { className: "flex items-start gap-3 border-b border-zinc-200 px-4 py-3 dark:border-zinc-800", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx(BaseDialog.Title, { className: "truncate text-sm font-semibold tracking-tight", children: title }), description && (_jsx(BaseDialog.Description, { className: "mt-0.5 text-[11px] leading-relaxed text-zinc-500 dark:text-zinc-400", children: description }))] }), _jsx(Tooltip, { content: "Close (Esc)", children: _jsx(BaseDialog.Close, { "aria-label": "Close", className: cn('rounded-md p-1 text-zinc-400 outline-none', 'hover:bg-zinc-100 hover:text-zinc-900', 'focus-visible:ring-2 focus-visible:ring-violet-500/30', 'dark:hover:bg-zinc-800 dark:hover:text-zinc-100'), children: _jsx(X, { size: 14 }) }) })] }), _jsx("div", { className: "min-h-0 flex-1 overflow-y-auto px-4 py-4", children: children })] })] }) }));
36
+ : 'w-[min(24rem,calc(100vw-2rem))]', 'transition-transform duration-200 ease-out', 'data-[starting-style]:translate-x-full data-[ending-style]:translate-x-full'), children: [_jsxs("div", { className: "flex items-start gap-3 border-b border-zinc-200 px-4 py-3 dark:border-zinc-800", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx(BaseDialog.Title, { className: "truncate text-sm font-semibold tracking-tight", children: title }), description && (_jsx(BaseDialog.Description, { className: "mt-0.5 text-[11px] leading-relaxed text-zinc-500 dark:text-zinc-400", children: description }))] }), _jsx(Tooltip, { content: "Close (Esc)", children: _jsx(BaseDialog.Close, { "aria-label": "Close", className: cn('rounded-md p-1 text-zinc-400 outline-none', 'hover:bg-zinc-100 hover:text-zinc-900', 'focus-visible:ring-2 focus-visible:ring-sky-500/30', 'dark:hover:bg-zinc-800 dark:hover:text-zinc-100'), children: _jsx(X, { size: 14 }) }) })] }), _jsx("div", { className: "min-h-0 flex-1 overflow-y-auto px-4 py-4", children: children })] })] }) }));
37
37
  }
package/dist/ui/switch.js CHANGED
@@ -10,5 +10,5 @@ import { cn } from '../cn';
10
10
  * checkbox reads as "include this in what I am about to submit".
11
11
  */
12
12
  export function Switch({ checked, onCheckedChange, label, hint, disabled, }) {
13
- return (_jsxs("label", { className: "flex items-start gap-2.5", children: [_jsx(BaseSwitch.Root, { checked: checked, onCheckedChange: onCheckedChange, disabled: disabled, className: cn('relative mt-0.5 h-4 w-7 shrink-0 rounded-full border transition-colors outline-none', 'border-zinc-300 bg-zinc-200 dark:border-zinc-700 dark:bg-zinc-800', 'data-[checked]:border-violet-600 data-[checked]:bg-violet-600', 'focus-visible:ring-2 focus-visible:ring-violet-500/30', 'disabled:opacity-40'), children: _jsx(BaseSwitch.Thumb, { className: cn('block h-3 w-3 translate-x-0.5 rounded-full bg-white shadow-sm transition-transform', 'data-[checked]:translate-x-[14px]') }) }), _jsxs("span", { className: "min-w-0", children: [_jsx("span", { className: "block text-[11px] text-zinc-600 dark:text-zinc-300", children: label }), hint && _jsx("span", { className: "block text-[11px] text-zinc-400 dark:text-zinc-500", children: hint })] })] }));
13
+ return (_jsxs("label", { className: "flex items-start gap-2.5", children: [_jsx(BaseSwitch.Root, { checked: checked, onCheckedChange: onCheckedChange, disabled: disabled, className: cn('relative mt-0.5 h-4 w-7 shrink-0 rounded-full border transition-colors outline-none', 'border-zinc-300 bg-zinc-200 dark:border-zinc-700 dark:bg-zinc-800', 'data-[checked]:border-sky-600 data-[checked]:bg-sky-600', 'focus-visible:ring-2 focus-visible:ring-sky-500/30', 'disabled:opacity-40'), children: _jsx(BaseSwitch.Thumb, { className: cn('block h-3 w-3 translate-x-0.5 rounded-full bg-white shadow-sm transition-transform', 'data-[checked]:translate-x-[14px]') }) }), _jsxs("span", { className: "min-w-0", children: [_jsx("span", { className: "block text-[11px] text-zinc-600 dark:text-zinc-300", children: label }), hint && _jsx("span", { className: "block text-[11px] text-zinc-400 dark:text-zinc-500", children: hint })] })] }));
14
14
  }
package/dist/ui/tabs.js CHANGED
@@ -25,7 +25,7 @@ export function TabsList({ children, className, }) {
25
25
  return (_jsx(BaseTabs.List, { className: cn('flex gap-1 border-b border-zinc-200 dark:border-zinc-800', className), children: children }));
26
26
  }
27
27
  export function TabsTab({ value, children, }) {
28
- return (_jsx(BaseTabs.Tab, { value: value, className: cn('flex items-center gap-1.5 border-b-2 px-3 py-2 text-sm transition-colors outline-none', 'border-transparent text-zinc-500', 'hover:text-zinc-950 dark:hover:text-zinc-50', 'focus-visible:ring-2 focus-visible:ring-violet-500/30', 'data-[selected]:border-violet-600 data-[selected]:text-zinc-950', 'dark:data-[selected]:text-zinc-50'), children: children }));
28
+ return (_jsx(BaseTabs.Tab, { value: value, className: cn('flex items-center gap-1.5 border-b-2 px-3 py-2 text-sm transition-colors outline-none', 'border-transparent text-zinc-500', 'hover:text-zinc-950 dark:hover:text-zinc-50', 'focus-visible:ring-2 focus-visible:ring-sky-500/30', 'data-[selected]:border-sky-600 data-[selected]:text-zinc-950', 'dark:data-[selected]:text-zinc-50'), children: children }));
29
29
  }
30
30
  export function TabsPanel({ value, children, className, }) {
31
31
  // Not `keepMounted`: a panel holding a half-typed connector form should keep
@@ -26,8 +26,8 @@ const KIND_STYLE = {
26
26
  noun: 'source',
27
27
  },
28
28
  transform: {
29
- accent: 'bg-violet-500',
30
- chip: 'text-violet-700 dark:text-violet-300',
29
+ accent: 'bg-sky-500',
30
+ chip: 'text-sky-700 dark:text-sky-300',
31
31
  icon: Repeat,
32
32
  noun: 'transform',
33
33
  },
@@ -73,7 +73,7 @@ export function WorkflowNodeBody({ id, data, selected }) {
73
73
  const Icon = style.icon;
74
74
  const errors = data.problems.filter((problem) => problem.level === 'error');
75
75
  const warnings = data.problems.filter((problem) => problem.level === 'warning');
76
- return (_jsxs("div", { className: cn('relative w-56 overflow-hidden rounded-lg border shadow-sm transition-shadow', RULE, PANEL, selected && 'ring-2 ring-violet-500/40', errors.length > 0 && 'border-red-400 dark:border-red-800', errors.length === 0 && warnings.length > 0 && 'border-amber-300 dark:border-amber-800'), 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: HANDLE, "aria-label": `input of ${data.label}` })), data.kind !== 'sink' && (_jsx(Handle, { type: "source", position: Position.Right, className: HANDLE, "aria-label": `output of ${data.label}` })), _jsxs("div", { className: "pl-3 pr-2 py-2", children: [_jsxs("div", { className: "flex items-center gap-1.5", 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("button", { type: "button", onClick: () => onInspect(id), className: "nodrag mt-1 block w-full text-left", children: [_jsx("span", { className: "block truncate text-[13px] font-medium", children: data.label }), _jsx("span", { className: cn('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]', RULE, MUTED, 'hover:bg-zinc-50 dark:hover:bg-zinc-800'), children: [_jsx(Code2, { size: 9 }), "code"] }) }) }))] })] }));
76
+ return (_jsxs("div", { className: cn('relative w-56 overflow-hidden rounded-lg border shadow-sm transition-shadow', RULE, PANEL, selected && 'ring-2 ring-sky-500/40', errors.length > 0 && 'border-red-400 dark:border-red-800', errors.length === 0 && warnings.length > 0 && 'border-amber-300 dark:border-amber-800'), 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: HANDLE, "aria-label": `input of ${data.label}` })), data.kind !== 'sink' && (_jsx(Handle, { type: "source", position: Position.Right, className: HANDLE, "aria-label": `output of ${data.label}` })), _jsxs("div", { className: "pl-3 pr-2 py-2", children: [_jsxs("div", { className: "flex items-center gap-1.5", 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("button", { type: "button", onClick: () => onInspect(id), className: "nodrag mt-1 block w-full text-left", children: [_jsx("span", { className: "block truncate text-[13px] font-medium", children: data.label }), _jsx("span", { className: cn('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]', RULE, MUTED, 'hover:bg-zinc-50 dark:hover:bg-zinc-800'), children: [_jsx(Code2, { size: 9 }), "code"] }) }) }))] })] }));
77
77
  }
78
78
  /**
79
79
  * Declared once, at module scope.
@@ -22,7 +22,9 @@ import { type WorkflowEdge, type WorkflowIssueCode, type WorkflowNode } from '@d
22
22
  * - **A sink with no object type.** Core's type requires `targetType` on a sink
23
23
  * but its validator never checks that the string is non-empty, and the server
24
24
  * refuses one that is. The check is additive, not contradictory.
25
- * - **Two sinks writing the same type.** Core reports it as `duplicate-sink-type`.
25
+ *
26
+ * Two sinks writing the same type is NOT in that list: core reports it itself,
27
+ * as `duplicate-sink-type`, and is passed straight through.
26
28
  *
27
29
  * The consequence worth stating: nothing in the canvas may *skip* a server check
28
30
  * because this passed. Save always goes to the server, the server's refusal
@@ -15,9 +15,10 @@ import { WORKFLOW_NAME } from './name';
15
15
  * each sink commits its own type independently, which this screen is, rather
16
16
  * than to forbid the shape.
17
17
  *
18
- * The half of the rule that survives is enforced below as `duplicate-sink-type`:
19
- * two sinks writing the *same* type really is ambiguous, because it is two
20
- * snapshots of one type in one run with nothing to say which won.
18
+ * The half of the rule that survives is `duplicate-sink-type`: two sinks writing
19
+ * the *same* type really is ambiguous, because it is two snapshots of one type
20
+ * in one run with nothing to say which won. It is core's to raise, and this file
21
+ * raises no copy of it — see `validateWorkflow` below.
21
22
  *
22
23
  * Core now agrees: it emits `duplicate-sink-type` and no longer has
23
24
  * `multiple-sinks` or `mixed-output-types`. There is consequently nothing left
@@ -62,7 +63,18 @@ export function validateWorkflow(draft, options) {
62
63
  // Everything below is canvas-only. It runs whatever core said, because these
63
64
  // are different questions and suppressing them behind a structural error would
64
65
  // make somebody fix one problem to be told about the next.
65
- const sinkTypes = new Map();
66
+ //
67
+ // `duplicate-sink-type` is deliberately NOT among them any more. This file
68
+ // used to raise it as well, from the days when core did not — and once core
69
+ // started emitting it the canvas showed the same complaint twice, in two
70
+ // different wordings, ringing the same two nodes. Which is the drift this
71
+ // module's whole doctrine exists to prevent: the rules are core's.
72
+ //
73
+ // The one case the deleted copy caught and core does not is two sinks whose
74
+ // types differ only by surrounding whitespace, because it trimmed and core
75
+ // does not. That is a case core deliberately treats as two types, and a canvas
76
+ // that refused a graph the server accepts is the failure this file opens by
77
+ // describing.
66
78
  for (const node of nodes) {
67
79
  const name = nodeName(node);
68
80
  if (node.kind === 'transform') {
@@ -91,26 +103,7 @@ export function validateWorkflow(draft, options) {
91
103
  nodeIds: [node.id],
92
104
  edgeIds: [],
93
105
  });
94
- continue;
95
106
  }
96
- sinkTypes.set(type, [...(sinkTypes.get(type) ?? []), node.id]);
97
- }
98
- for (const [type, ids] of sinkTypes) {
99
- if (ids.length < 2)
100
- continue;
101
- const named = ids
102
- .map((id) => {
103
- const node = nodes.find((candidate) => candidate.id === id);
104
- return node ? `"${nodeName(node)}"` : `"${id}"`;
105
- })
106
- .join(' and ');
107
- problems.push({
108
- level: 'error',
109
- code: 'duplicate-sink-type',
110
- message: `${named} both write ${type}. Two sinks may write two different types — that is the point of a ${WORKFLOW_NAME.singular}, one read feeding several outputs — but two writing the same type would commit two snapshots of ${type} in one run with nothing to say which one won. Merge the branches into a single ${type} sink.`,
111
- nodeIds: ids,
112
- edgeIds: [],
113
- });
114
107
  }
115
108
  return problems;
116
109
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dudousxd/nestjs-catalog-react",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Ready-made React screens for @dudousxd/nestjs-catalog — a model manager and a generic object explorer you can drop into your own app shell.",
5
5
  "license": "MIT",
6
6
  "author": "Davide Carvalho",
@@ -74,7 +74,7 @@
74
74
  "@types/d3-array": "^3.2.2",
75
75
  "@types/d3-shape": "^3.1.8",
76
76
  "@types/react": "19.2.14",
77
- "@types/react-dom": "^19.2.4",
77
+ "@types/react-dom": "19.2.0",
78
78
  "@visx/curve": "4.0.1-alpha.0",
79
79
  "@visx/event": "4.0.1-alpha.0",
80
80
  "@visx/grid": "4.0.1-alpha.0",
@@ -90,11 +90,11 @@
90
90
  "motion": "^12.43.0",
91
91
  "prism-react-renderer": "2.4.1",
92
92
  "react": "19.2.0",
93
- "react-dom": "^19.2.8",
93
+ "react-dom": "19.2.0",
94
94
  "recharts": "2.15.4",
95
95
  "tailwind-merge": "3.4.1",
96
96
  "typescript": "5.9.3",
97
- "@dudousxd/nestjs-catalog": "0.1.0"
97
+ "@dudousxd/nestjs-catalog": "0.3.1"
98
98
  },
99
99
  "dependencies": {
100
100
  "clsx": "2.1.1",