@dudousxd/nestjs-catalog-react 0.17.0 → 0.19.0-preview.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -13
- package/dist/CatalogManager.d.ts +23 -1
- package/dist/CatalogManager.js +76 -13
- package/dist/ConnectionPanel.d.ts +11 -7
- package/dist/ConnectionPanel.js +78 -149
- package/dist/LoadedBySection.d.ts +39 -0
- package/dist/LoadedBySection.js +143 -0
- package/dist/PipelineConsole.d.ts +23 -126
- package/dist/PipelineConsole.js +39 -551
- package/dist/WorkflowCanvas.d.ts +16 -0
- package/dist/WorkflowCanvas.js +1064 -64
- package/dist/connection-form.d.ts +241 -0
- package/dist/connection-form.js +235 -0
- package/dist/context.d.ts +236 -38
- package/dist/context.js +46 -11
- package/dist/index.d.ts +10 -3
- package/dist/index.js +63 -14
- package/dist/routes.d.ts +84 -13
- package/dist/routes.js +7 -4
- package/dist/schema-discovery.d.ts +232 -0
- package/dist/schema-discovery.js +225 -0
- package/dist/source-connection.d.ts +82 -0
- package/dist/source-connection.js +176 -0
- package/dist/source-fields.d.ts +16 -14
- package/dist/source-fields.js +28 -18
- package/dist/ui/code-editor.d.ts +44 -2
- package/dist/ui/code-editor.js +10 -2
- package/dist/ui/combobox.d.ts +97 -0
- package/dist/ui/combobox.js +80 -0
- package/dist/ui/dialog.d.ts +13 -1
- package/dist/ui/dialog.js +13 -2
- package/dist/workflow/edges.d.ts +110 -0
- package/dist/workflow/edges.js +112 -0
- package/dist/workflow/graph.d.ts +39 -1
- package/dist/workflow/graph.js +212 -52
- package/dist/workflow/index.d.ts +8 -0
- package/dist/workflow/index.js +12 -0
- package/dist/workflow/lifecycle.d.ts +135 -0
- package/dist/workflow/lifecycle.js +216 -0
- package/dist/workflow/model.d.ts +17 -3
- package/dist/workflow/model.js +7 -2
- package/dist/workflow/nodes.d.ts +4 -1
- package/dist/workflow/nodes.js +198 -10
- package/dist/workflow/runs.d.ts +38 -0
- package/dist/workflow/runs.js +101 -0
- package/dist/workflow/shape.d.ts +169 -0
- package/dist/workflow/shape.js +249 -0
- package/dist/workflow/templates.d.ts +623 -0
- package/dist/workflow/templates.js +1102 -0
- package/dist/workflow/validate.d.ts +20 -1
- package/dist/workflow/validate.js +52 -3
- package/dist/workflow/wiring.d.ts +84 -0
- package/dist/workflow/wiring.js +254 -0
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -44,13 +44,14 @@ Requires a `QueryClientProvider` from `@tanstack/react-query` above it.
|
|
|
44
44
|
snapshots, saved queries, and cards built from them.
|
|
45
45
|
- **`<GovernanceTimeline />`**, **`<TraceExplorer />`** — what happened, flat and
|
|
46
46
|
grouped into causal stories.
|
|
47
|
-
- **`<PipelineConsole />`** —
|
|
48
|
-
|
|
49
|
-
answered
|
|
50
|
-
prefix, an HTTP status.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
- **`<PipelineConsole />`** — the two things a workflow borrows: connections and
|
|
48
|
+
transforms. Includes a **Test connection** button that reports what actually
|
|
49
|
+
answered — a server version, a bucket and whether anything sits under the
|
|
50
|
+
prefix, an HTTP status. It is deliberately **not** where a pipeline is
|
|
51
|
+
authored; there is no connector screen, because nothing authors a connector.
|
|
52
|
+
- **`<WorkflowCanvas />`** — the one place a workflow is authored: sources wired
|
|
53
|
+
through transforms into sinks, published, scheduled and run. On its own subpath
|
|
54
|
+
(see [Workflows](#workflows)) because it needs an optional peer.
|
|
54
55
|
- **`<AccessConsole />`** — which applications may touch what, and which people
|
|
55
56
|
sign in through them.
|
|
56
57
|
- **`<CoverageLedger />`**, **`<EditableField />`**, and the vendored primitives
|
|
@@ -120,13 +121,36 @@ as the theme the app is actually in.
|
|
|
120
121
|
|
|
121
122
|
### What it asks of the server
|
|
122
123
|
|
|
123
|
-
|
|
124
|
+
These routes on top of the pipeline base path, listed by `pipelineRoutes()`:
|
|
124
125
|
|
|
125
126
|
| Route | Purpose |
|
|
126
127
|
| --- | --- |
|
|
127
128
|
| `GET/POST {base}/workflows` | list; create or update |
|
|
128
|
-
| `DELETE {base}/workflows/:id` | delete |
|
|
129
|
-
| `POST {base}/workflows/:id/
|
|
129
|
+
| `DELETE {base}/workflows/:id` | delete, taking the connector and its history with it |
|
|
130
|
+
| `POST {base}/workflows/:id/publish` | declare it finished, and mint the connector it runs as |
|
|
131
|
+
| `POST {base}/workflows/:id/unpublish` | back to draft; the connector is disabled and keeps its id |
|
|
132
|
+
| `POST {base}/workflows/:id/run` | execute, optionally carrying `expectShrink` |
|
|
133
|
+
| `PUT {base}/workflows/:id/schedule` | set the cron and whether it runs at all |
|
|
134
|
+
| `POST {base}/workflows/:id/nodes/:nodeId/discover` | ask one source what its columns are |
|
|
135
|
+
|
|
136
|
+
**A connector is not one of them.** It is what a published graph runs as: minted
|
|
137
|
+
by `publish`, disabled by `unpublish`, removed with the graph, and there is no
|
|
138
|
+
route that creates one. `GET {base}/connectors` stays as a read, because that id
|
|
139
|
+
is what the run history and the incremental watermark are keyed on, and the
|
|
140
|
+
canvas shows it under "Runs as".
|
|
141
|
+
|
|
142
|
+
**`discover` answers on a draft, deliberately.** A sink cannot commit into an
|
|
143
|
+
object type that does not exist, so requiring a published graph would require
|
|
144
|
+
publishing a graph whose target type cannot be created until it is published.
|
|
145
|
+
What it does need is a graph that has been *saved* — it reads the stored node.
|
|
146
|
+
|
|
147
|
+
**`expectShrink` on `run` is the escape hatch for a load the row-count bound
|
|
148
|
+
refused**, and this is the only route that accepts it. It is a reason rather than
|
|
149
|
+
a flag: the sentence is written into the snapshot's `_expectShrink` label, an
|
|
150
|
+
empty one is refused with a 400, and it stands the bound down for that snapshot
|
|
151
|
+
alone. The alternative an operator reaches for without it is raising
|
|
152
|
+
`rowCount.maxShrink` in the type's policy, which stands the guard down for every
|
|
153
|
+
future load of that type.
|
|
130
154
|
|
|
131
155
|
…plus one optional field on `GET {base}/capabilities`:
|
|
132
156
|
|
|
@@ -165,9 +189,11 @@ What the server checks that the canvas cannot:
|
|
|
165
189
|
as they commit different types — and a refusal names each type it turned
|
|
166
190
|
down. The same check runs again on `POST /workflows/:id/run`, because a graph
|
|
167
191
|
saved by somebody who held the grant can be run by somebody who does not, and
|
|
168
|
-
the run is what actually commits. `POST /
|
|
169
|
-
`
|
|
170
|
-
|
|
192
|
+
the run is what actually commits. `POST /workflows/:id/publish`,
|
|
193
|
+
`PUT /workflows/:id/schedule` and `POST /workflows/:id/nodes/:nodeId/discover`
|
|
194
|
+
are checked the same way — discovery included, because without it a principal
|
|
195
|
+
with `catalog:write` and no grants could press it against somebody else's graph
|
|
196
|
+
and read back the column names of a database they were never allowed near.
|
|
171
197
|
|
|
172
198
|
These routes now require a principal: they read grants, not just a name to
|
|
173
199
|
attribute the write to, so a deployment that mounts the pipeline without a
|
package/dist/CatalogManager.d.ts
CHANGED
|
@@ -1,12 +1,34 @@
|
|
|
1
1
|
export interface CatalogManagerProps {
|
|
2
|
+
/**
|
|
3
|
+
* Which type to open. Omit to fall back to `?type=` then the first type.
|
|
4
|
+
*
|
|
5
|
+
* The same shape — and the same three-step fallback — as
|
|
6
|
+
* {@link ObjectExplorerProps.type}, deliberately: this screen became a
|
|
7
|
+
* destination the day a workflow's sink could link to the type it commits, and
|
|
8
|
+
* a second convention for "which one" would be a second thing to get wrong.
|
|
9
|
+
* See {@link useSelectedType} in `ObjectExplorer.tsx` for the argument the
|
|
10
|
+
* hook below mirrors.
|
|
11
|
+
*
|
|
12
|
+
* A name this catalog does not hold is **not** silently replaced by the first
|
|
13
|
+
* type. That is what makes a stale or premature link readable as one: a sink
|
|
14
|
+
* may name a type nothing has published yet, and showing an unrelated type
|
|
15
|
+
* under an address promising that one is the failure a deep link is supposed
|
|
16
|
+
* to be immune to.
|
|
17
|
+
*/
|
|
18
|
+
type?: string;
|
|
2
19
|
/**
|
|
3
20
|
* Where the object explorer lives, if the host mounts one. Receives the type
|
|
4
21
|
* name. Omit to hide the "Open …" button entirely.
|
|
5
22
|
*/
|
|
6
23
|
explorerHref?: (typeName: string) => string;
|
|
24
|
+
/**
|
|
25
|
+
* Where one workflow lives, if the host mounts a screen for graphs. Receives
|
|
26
|
+
* the workflow's id; omit and the "Loaded by" rows render as plain rows.
|
|
27
|
+
*/
|
|
28
|
+
workflowHref?: (workflowId: string) => string;
|
|
7
29
|
/** Heading copy, so the host can call this whatever its users call it. */
|
|
8
30
|
title?: string;
|
|
9
31
|
eyebrow?: string;
|
|
10
32
|
intro?: string;
|
|
11
33
|
}
|
|
12
|
-
export declare function CatalogManager({ explorerHref, title, eyebrow, intro, }: CatalogManagerProps): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export declare function CatalogManager({ type: typeProp, explorerHref, workflowHref, title, eyebrow, intro, }: CatalogManagerProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/CatalogManager.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
3
3
|
import { ArrowLeft, ArrowRight, ArrowUpRight, Eye, EyeOff, RotateCcw, Search, Unlink, } from 'lucide-react';
|
|
4
|
-
import { useMemo, useState } from 'react';
|
|
4
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
5
5
|
import { CoverageLedger } from './CoverageLedger';
|
|
6
6
|
import { EditableField } from './EditableField';
|
|
7
7
|
import { LoadExpectationSection } from './LoadExpectationSection';
|
|
8
|
+
import { LoadedBySection } from './LoadedBySection';
|
|
9
|
+
import { paramFromLocation } from './ObjectExplorer';
|
|
8
10
|
import { cn } from './cn';
|
|
9
11
|
import { catalogQueryKeys, useCatalogClient } from './context';
|
|
10
12
|
import { freshnessOf, isWorthFlagging } from './freshness';
|
|
@@ -35,7 +37,7 @@ const HAIRLINE = 'border-zinc-100 dark:border-zinc-900';
|
|
|
35
37
|
function ScalarBadge({ type }) {
|
|
36
38
|
return (_jsx("span", { className: cn('rounded-sm bg-zinc-100 px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wider dark:bg-zinc-800', TYPE_TONE[type]), children: type }));
|
|
37
39
|
}
|
|
38
|
-
export function CatalogManager({ explorerHref, title = 'Catalog', eyebrow = 'Semantic layer', intro = 'Every object type the system already holds, derived from the ORM. Names, descriptions and units are yours to change — none of it touches the database.', }) {
|
|
40
|
+
export function CatalogManager({ type: typeProp, explorerHref, workflowHref, title = 'Catalog', eyebrow = 'Semantic layer', intro = 'Every object type the system already holds, derived from the ORM. Names, descriptions and units are yours to change — none of it touches the database.', }) {
|
|
39
41
|
const client = useCatalogClient();
|
|
40
42
|
const queryClient = useQueryClient();
|
|
41
43
|
const { data, isLoading, isError } = useQuery({
|
|
@@ -43,7 +45,7 @@ export function CatalogManager({ explorerHref, title = 'Catalog', eyebrow = 'Sem
|
|
|
43
45
|
queryFn: () => client.snapshot(),
|
|
44
46
|
staleTime: 30_000,
|
|
45
47
|
});
|
|
46
|
-
const [selectedName, setSelectedName] =
|
|
48
|
+
const [selectedName, setSelectedName] = useSelectedType(typeProp);
|
|
47
49
|
const [filter, setFilter] = useState('');
|
|
48
50
|
const [onlyUnnamed, setOnlyUnnamed] = useState(false);
|
|
49
51
|
/** Presentation edits should feel like typing, not like saving. */
|
|
@@ -75,7 +77,19 @@ export function CatalogManager({ explorerHref, title = 'Catalog', eyebrow = 'Sem
|
|
|
75
77
|
onSuccess: (snapshot) => queryClient.setQueryData(catalogQueryKeys.snapshot, snapshot),
|
|
76
78
|
});
|
|
77
79
|
const types = useMemo(() => data?.types ?? [], [data]);
|
|
78
|
-
|
|
80
|
+
/**
|
|
81
|
+
* The type on screen, and — separately — a name that named nothing.
|
|
82
|
+
*
|
|
83
|
+
* The two are split because they used to be one `?? types[0]`, which answers
|
|
84
|
+
* both "nobody has chosen yet" and "the chosen one does not exist" with the
|
|
85
|
+
* same unrelated type. That is harmless while the only way to choose is the
|
|
86
|
+
* list on the left, where every entry exists by construction, and it stops
|
|
87
|
+
* being harmless the moment an address can name one: a sink may commit into a
|
|
88
|
+
* type nothing has published yet, so `#model?type=Fleet` is a link somebody
|
|
89
|
+
* can hold before the type behind it does.
|
|
90
|
+
*/
|
|
91
|
+
const selected = useMemo(() => (selectedName === null ? types[0] : types.find((t) => t.name === selectedName)), [types, selectedName]);
|
|
92
|
+
const missing = selectedName !== null && types.length > 0 && !selected ? selectedName : null;
|
|
79
93
|
const grouped = useMemo(() => {
|
|
80
94
|
const term = filter.trim().toLowerCase();
|
|
81
95
|
const matching = types.filter((t) => {
|
|
@@ -103,20 +117,69 @@ export function CatalogManager({ explorerHref, title = 'Catalog', eyebrow = 'Sem
|
|
|
103
117
|
}
|
|
104
118
|
return (_jsx(TooltipProvider, { children: _jsxs("div", { className: "flex h-full flex-col bg-zinc-50 dark:bg-zinc-950", children: [_jsxs("header", { className: cn('shrink-0 border-b px-8 py-6', RULE, PANEL), children: [_jsxs("div", { className: "flex flex-wrap items-start justify-between gap-6", children: [_jsxs("div", { children: [_jsx("p", { className: cn('font-mono text-[11px] uppercase tracking-[0.18em]', MUTED), children: eyebrow }), _jsx("h1", { className: "mt-1 text-2xl font-semibold tracking-tight", children: title }), _jsx("p", { className: cn('mt-1 max-w-xl text-sm', SECONDARY), children: intro })] }), _jsxs("div", { className: "flex items-center gap-6", children: [_jsx(Stat, { label: "Types", value: data.stats.types }), _jsx(Stat, { label: "Properties", value: data.stats.properties }), _jsx(Tooltip, { content: "Relations declared across every type. A link declared at both ends counts twice \u2014 the graph draws it once.", children: _jsx("span", { className: "cursor-help", children: _jsx(Stat, { label: "Relations", value: data.stats.relations }) }) }), _jsxs("button", { type: "button", onClick: () => resetMutation.mutate(), disabled: resetMutation.isPending, className: cn('flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs', RULE, SECONDARY, 'transition-colors hover:bg-zinc-50 disabled:opacity-50 dark:hover:bg-zinc-800'), children: [_jsx(RotateCcw, { size: 13 }), "Reset edits"] })] })] }), _jsx("div", { className: "mt-6", children: _jsx(CoverageLedger, { types: types, selected: selected?.name, onSelect: setSelectedName }) })] }), _jsxs("div", { className: "flex min-h-0 flex-1", children: [_jsxs("aside", { className: cn('flex w-72 shrink-0 flex-col border-r', RULE, PANEL), children: [_jsxs("div", { className: cn('shrink-0 space-y-2 border-b p-3', HAIRLINE), children: [_jsxs("div", { className: "relative", children: [_jsx(Search, { size: 14, className: cn('pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2', MUTED) }), _jsx("input", { type: "text", value: filter, onChange: (e) => setFilter(e.target.value), placeholder: "Find a type or table", "aria-label": "Filter object types", className: cn('w-full rounded-md border bg-zinc-50 py-1.5 pl-8 pr-2 text-sm outline-none dark:bg-zinc-950', RULE, 'placeholder:text-zinc-400 focus:border-sky-500 focus:ring-2 focus:ring-sky-500/15') })] }), _jsxs("label", { className: cn('flex cursor-pointer items-center gap-2 px-0.5 text-xs', SECONDARY), children: [_jsx("input", { type: "checkbox", checked: onlyUnnamed, onChange: (e) => setOnlyUnnamed(e.target.checked), className: "accent-amber-500" }), "Only types nobody has named"] })] }), _jsxs("nav", { className: "min-h-0 flex-1 overflow-y-auto p-2", children: [grouped.length === 0 && (_jsxs("p", { className: cn('px-2 py-6 text-center text-xs', MUTED), children: ["Nothing matches \u201C", filter, "\u201D."] })), grouped.map(([group, groupTypes]) => (_jsxs("div", { className: "mb-3", children: [_jsxs("div", { className: "flex items-baseline justify-between px-2 py-1", children: [_jsx("span", { className: cn('font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: group }), _jsx("span", { className: cn('font-mono text-[10px]', MUTED), children: groupTypes.length })] }), groupTypes.map((type) => (_jsxs("button", { type: "button", onClick: () => setSelectedName(type.name), className: cn('group flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors', selected?.name === type.name
|
|
105
119
|
? 'bg-sky-100 dark:bg-sky-950'
|
|
106
|
-
: 'hover:bg-zinc-50 dark:hover:bg-zinc-800'), children: [_jsx("span", { "aria-hidden": true, className: cn('h-1.5 w-1.5 shrink-0 rounded-full', type.enriched ? 'bg-emerald-500' : 'bg-amber-400/60') }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsxs("span", { className: "block truncate text-sm", children: [type.icon ? `${type.icon} ` : '', type.displayName] }), _jsxs("span", { className: cn('block truncate font-mono text-[10px]', MUTED), children: [type.tableName, _jsx(FreshnessNote, { type: type })] })] })] }, type.name)))] }, group)))] })] }),
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
120
|
+
: 'hover:bg-zinc-50 dark:hover:bg-zinc-800'), children: [_jsx("span", { "aria-hidden": true, className: cn('h-1.5 w-1.5 shrink-0 rounded-full', type.enriched ? 'bg-emerald-500' : 'bg-amber-400/60') }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsxs("span", { className: "block truncate text-sm", children: [type.icon ? `${type.icon} ` : '', type.displayName] }), _jsxs("span", { className: cn('block truncate font-mono text-[10px]', MUTED), children: [type.tableName, _jsx(FreshnessNote, { type: type })] })] })] }, type.name)))] }, group)))] })] }), _jsxs("main", { className: "min-w-0 flex-1 overflow-y-auto", children: [missing && _jsx(NoSuchType, { name: missing }), selected && (_jsx(TypeDetail, { type: selected, workflowHref: workflowHref,
|
|
121
|
+
// The whole catalog, so the detail pane can answer what points
|
|
122
|
+
// AT this type. Nothing on a type records its inbound links —
|
|
123
|
+
// one row per declaration, and the declaration lives on the
|
|
124
|
+
// other end — so the only place that question can be answered
|
|
125
|
+
// is somewhere holding every type.
|
|
126
|
+
types: types, explorerHref: explorerHref, onPatchType: (patch) => typeMutation.mutate({ name: selected.name, patch }), onPatchProperty: (property, patch) => propertyMutation.mutate({ name: selected.name, property, patch }), onNavigate: setSelectedName }, selected.name))] })] })] }) }));
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Which type this screen is showing, and how it gets chosen.
|
|
130
|
+
*
|
|
131
|
+
* The same rules {@link useSelectedType} in `ObjectExplorer.tsx` argues for, and
|
|
132
|
+
* a deliberate second copy of them rather than a shared hook: that one owns a
|
|
133
|
+
* *found* type name (it resolves the prop against the catalog before storing it,
|
|
134
|
+
* because its query is `enabled` on a non-empty string), and this one must be
|
|
135
|
+
* able to hold a name the catalog does NOT have so that `missing` above can say
|
|
136
|
+
* so. Merging them would mean one hook with a flag deciding whether a bad name
|
|
137
|
+
* is remembered or discarded, which is two behaviours in one name.
|
|
138
|
+
*
|
|
139
|
+
* - **The prop wins whenever it changes**, not only on the first render. A host
|
|
140
|
+
* that links from one type to another — the ordinary way to arrive here — sets
|
|
141
|
+
* the prop, and a guard on "nothing chosen yet" would show the previous type
|
|
142
|
+
* under an address naming the new one.
|
|
143
|
+
* - Failing a prop, the hash's own query string, once. `paramFromLocation` is
|
|
144
|
+
* imported from `ObjectExplorer` rather than rewritten: it reads the real
|
|
145
|
+
* query string *and* the hash's, and a hash-routed console leaves
|
|
146
|
+
* `location.search` empty.
|
|
147
|
+
* - Failing both, `null` — which is what makes the first type the default, and
|
|
148
|
+
* which is a different state from a name that matched nothing.
|
|
149
|
+
*/
|
|
150
|
+
function useSelectedType(typeProp) {
|
|
151
|
+
const [typeName, setTypeName] = useState(typeProp ?? null);
|
|
152
|
+
useEffect(() => {
|
|
153
|
+
if (typeProp)
|
|
154
|
+
setTypeName(typeProp);
|
|
155
|
+
}, [typeProp]);
|
|
156
|
+
useEffect(() => {
|
|
157
|
+
if (typeName !== null || typeProp)
|
|
158
|
+
return;
|
|
159
|
+
const requested = paramFromLocation('type');
|
|
160
|
+
if (requested)
|
|
161
|
+
setTypeName(requested);
|
|
162
|
+
}, [typeName, typeProp]);
|
|
163
|
+
return [typeName, setTypeName];
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* A link that named a type this catalog does not hold.
|
|
167
|
+
*
|
|
168
|
+
* Said rather than swallowed, and the second paragraph is the reason this state
|
|
169
|
+
* is worth a panel: the likeliest way to arrive here is a sink node committing
|
|
170
|
+
* into a type that has not been published yet, which is legal — a sink may name
|
|
171
|
+
* a type before anything creates it — and reads as a broken console unless
|
|
172
|
+
* somebody says otherwise.
|
|
173
|
+
*/
|
|
174
|
+
function NoSuchType({ name }) {
|
|
175
|
+
return (_jsx("div", { className: "mx-auto max-w-5xl px-8 py-8", children: _jsxs("div", { className: cn('rounded-lg border border-dashed px-4 py-6', RULE), children: [_jsxs("p", { className: "text-sm", children: ["Nothing in this catalog is called ", _jsx("span", { className: "font-mono", children: name }), "."] }), _jsx("p", { className: cn('mt-1 text-sm', SECONDARY), children: "A type comes into existence when something publishes its schema, so a workflow sink can name one before it exists \u2014 the link is not wrong, the type has simply not arrived. Pick one on the left, or run the load that creates it." })] }) }));
|
|
113
176
|
}
|
|
114
177
|
function Stat({ label, value }) {
|
|
115
178
|
return (_jsxs("div", { className: "text-right", children: [_jsx("div", { className: "font-mono text-xl leading-none tabular-nums", children: value }), _jsx("div", { className: cn('mt-1 font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: label })] }));
|
|
116
179
|
}
|
|
117
|
-
function TypeDetail({ type, types, explorerHref, onPatchType, onPatchProperty, onNavigate, }) {
|
|
180
|
+
function TypeDetail({ type, types, explorerHref, workflowHref, onPatchType, onPatchProperty, onNavigate, }) {
|
|
118
181
|
const visible = type.properties.filter((p) => !p.hidden).length;
|
|
119
|
-
return (_jsxs("div", { className: "mx-auto max-w-5xl px-8 py-8", children: [_jsxs("div", { className: "flex flex-wrap items-start justify-between gap-4", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex items-baseline gap-2", children: [_jsx("span", { className: "text-2xl leading-none", children: type.icon ?? '◈' }), _jsx(EditableField, { label: "display name", value: type.displayName, onSave: (displayName) => onPatchType({ displayName }), className: "text-2xl font-semibold tracking-tight", inputClassName: "text-2xl font-semibold tracking-tight" })] }), _jsxs("div", { className: cn('mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 pl-1 font-mono text-[11px]', MUTED), children: [_jsx("span", { children: type.name }), _jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsx("span", { children: type.tableName }), _jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsxs("span", { children: ["pk ", type.primaryKey.join(', ') || 'none'] }), _jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsxs("span", { children: [visible, " of ", type.properties.length, " shown"] })] })] }), explorerHref && (_jsxs("a", { href: explorerHref(type.name), className: cn('flex items-center gap-1.5 rounded-md bg-zinc-950 px-3 py-2 text-xs text-zinc-50', 'transition-colors hover:bg-zinc-800 dark:bg-zinc-100 dark:text-zinc-950 dark:hover:bg-zinc-300'), children: ["Open ", type.pluralDisplayName, _jsx(ArrowUpRight, { size: 13 })] }))] }), _jsx("div", { className: "mt-5 border-l-2 border-sky-200 pl-4 dark:border-sky-900", children: _jsx(RichTextField, { label: "description", value: type.description ?? '', placeholder: "No one has written down what this type means yet.", onSave: (description) => onPatchType({ description }), className: cn('text-sm leading-relaxed', SECONDARY) }) }), _jsxs("div", { className: "mt-4 flex flex-wrap items-center gap-2", children: [_jsx(FieldChip, { label: "Group", value: type.group, onSave: (group) => onPatchType({ group }) }), _jsx(FieldChip, { label: "Plural", value: type.pluralDisplayName, onSave: (pluralDisplayName) => onPatchType({ pluralDisplayName }) }), _jsx(FieldChip, { label: "Icon", value: type.icon ?? '', onSave: (icon) => onPatchType({ icon }) })] }), _jsxs("section", { className: "mt-10", children: [_jsx(SectionHeading, { title: "Properties", note: "The column and its SQL type are read from the ORM. The label, description and unit are yours." }), _jsx("div", { className: cn('overflow-hidden rounded-lg border', RULE, PANEL), children: _jsx(PropertyTable, { properties: type.properties, onPatchProperty: onPatchProperty }) })] }), _jsx(LoadExpectationSection, { typeName: type.name, displayName: type.displayName }), _jsx(LinkSection, { type: type, types: types, onPatchProperty: onPatchProperty, onNavigate: onNavigate })] }));
|
|
182
|
+
return (_jsxs("div", { className: "mx-auto max-w-5xl px-8 py-8", children: [_jsxs("div", { className: "flex flex-wrap items-start justify-between gap-4", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex items-baseline gap-2", children: [_jsx("span", { className: "text-2xl leading-none", children: type.icon ?? '◈' }), _jsx(EditableField, { label: "display name", value: type.displayName, onSave: (displayName) => onPatchType({ displayName }), className: "text-2xl font-semibold tracking-tight", inputClassName: "text-2xl font-semibold tracking-tight" })] }), _jsxs("div", { className: cn('mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 pl-1 font-mono text-[11px]', MUTED), children: [_jsx("span", { children: type.name }), _jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsx("span", { children: type.tableName }), _jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsxs("span", { children: ["pk ", type.primaryKey.join(', ') || 'none'] }), _jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsxs("span", { children: [visible, " of ", type.properties.length, " shown"] })] })] }), explorerHref && (_jsxs("a", { href: explorerHref(type.name), className: cn('flex items-center gap-1.5 rounded-md bg-zinc-950 px-3 py-2 text-xs text-zinc-50', 'transition-colors hover:bg-zinc-800 dark:bg-zinc-100 dark:text-zinc-950 dark:hover:bg-zinc-300'), children: ["Open ", type.pluralDisplayName, _jsx(ArrowUpRight, { size: 13 })] }))] }), _jsx("div", { className: "mt-5 border-l-2 border-sky-200 pl-4 dark:border-sky-900", children: _jsx(RichTextField, { label: "description", value: type.description ?? '', placeholder: "No one has written down what this type means yet.", onSave: (description) => onPatchType({ description }), className: cn('text-sm leading-relaxed', SECONDARY) }) }), _jsxs("div", { className: "mt-4 flex flex-wrap items-center gap-2", children: [_jsx(FieldChip, { label: "Group", value: type.group, onSave: (group) => onPatchType({ group }) }), _jsx(FieldChip, { label: "Plural", value: type.pluralDisplayName, onSave: (pluralDisplayName) => onPatchType({ pluralDisplayName }) }), _jsx(FieldChip, { label: "Icon", value: type.icon ?? '', onSave: (icon) => onPatchType({ icon }) })] }), _jsxs("section", { className: "mt-10", children: [_jsx(SectionHeading, { title: "Properties", note: "The column and its SQL type are read from the ORM. The label, description and unit are yours." }), _jsx("div", { className: cn('overflow-hidden rounded-lg border', RULE, PANEL), children: _jsx(PropertyTable, { properties: type.properties, onPatchProperty: onPatchProperty }) })] }), _jsx(LoadedBySection, { typeName: type.name, displayName: type.displayName, workflowHref: workflowHref }), _jsx(LoadExpectationSection, { typeName: type.name, displayName: type.displayName }), _jsx(LinkSection, { type: type, types: types, onPatchProperty: onPatchProperty, onNavigate: onNavigate })] }));
|
|
120
183
|
}
|
|
121
184
|
/** What each kind actually says, for people who do not read `m:n` fluently. */
|
|
122
185
|
const KIND_MEANING = {
|
|
@@ -21,18 +21,22 @@ export interface ConnectionPanelProps {
|
|
|
21
21
|
* The reason this screen is worth having at all is the test. Before it, the
|
|
22
22
|
* only way to learn that a host was wrong, a credential missing or a bucket
|
|
23
23
|
* spelled differently was to run a load and read the failure — which happens on
|
|
24
|
-
* a schedule, hours after somebody typed it, and is attributed to
|
|
24
|
+
* a schedule, hours after somebody typed it, and is attributed to the pipeline
|
|
25
25
|
* rather than to the address it borrowed.
|
|
26
26
|
*/
|
|
27
27
|
export declare function ConnectionPanel({ canEdit }: ConnectionPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
28
28
|
/**
|
|
29
|
-
* The options a
|
|
29
|
+
* The options a source node offers for "read through".
|
|
30
30
|
*
|
|
31
|
-
* Exported because the
|
|
32
|
-
* one rule that must not be duplicated: only connections of the same
|
|
33
|
-
*
|
|
34
|
-
* anybody meant, and it would fail at run time with an error about
|
|
35
|
-
* bucket rather than about the mistake.
|
|
31
|
+
* Exported because the canvas's source inspector lives in another file and this
|
|
32
|
+
* list has one rule that must not be duplicated: only connections of the same
|
|
33
|
+
* kind. A source reading S3 through a database connection is not a
|
|
34
|
+
* configuration anybody meant, and it would fail at run time with an error about
|
|
35
|
+
* a missing bucket rather than about the mistake.
|
|
36
|
+
*
|
|
37
|
+
* The hint is `describeConnection`, which is why this is here and not beside the
|
|
38
|
+
* other source fields: the address is the thing that distinguishes two
|
|
39
|
+
* connections with similar names, and it is the connection that knows it.
|
|
36
40
|
*/
|
|
37
41
|
export declare function connectionOptionsFor(kind: ConnectorKind, connections: CatalogConnection[]): {
|
|
38
42
|
value: string;
|