@dudousxd/nestjs-catalog-react 0.16.0 → 0.18.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/ConnectionPanel.d.ts +11 -7
- package/dist/ConnectionPanel.js +65 -28
- package/dist/ObjectExplorer.js +424 -48
- package/dist/PipelineConsole.d.ts +23 -126
- package/dist/PipelineConsole.js +39 -551
- package/dist/QueryConsole.js +25 -17
- package/dist/SavedQueryPanel.js +1 -1
- package/dist/TransformEditor.js +12 -3
- package/dist/WorkflowCanvas.js +401 -29
- package/dist/bundler/index.d.ts +20 -0
- package/dist/bundler/index.js +20 -0
- package/dist/bundler/shiki-subset.d.ts +83 -0
- package/dist/bundler/shiki-subset.js +196 -0
- package/dist/context.d.ts +181 -38
- package/dist/context.js +44 -11
- package/dist/diff/RevisionDiff.d.ts +67 -4
- package/dist/diff/RevisionDiff.js +126 -91
- package/dist/index.d.ts +8 -5
- package/dist/index.js +56 -20
- package/dist/routes.d.ts +54 -13
- package/dist/routes.js +5 -4
- package/dist/schema-discovery.d.ts +216 -0
- package/dist/schema-discovery.js +225 -0
- package/dist/source-fields.d.ts +1 -12
- package/dist/source-fields.js +13 -16
- package/dist/ui/code-editor.d.ts +196 -8
- package/dist/ui/code-editor.js +184 -72
- package/dist/ui/code-languages.d.ts +80 -0
- package/dist/ui/code-languages.js +76 -0
- package/dist/ui/code-theme.d.ts +25 -0
- package/dist/ui/code-theme.js +26 -0
- package/dist/ui/dialog.d.ts +13 -1
- package/dist/ui/dialog.js +13 -2
- package/dist/workflow/graph.js +31 -9
- package/dist/workflow/index.d.ts +2 -0
- package/dist/workflow/index.js +7 -0
- package/dist/workflow/lifecycle.d.ts +164 -0
- package/dist/workflow/lifecycle.js +249 -0
- package/dist/workflow/model.d.ts +1 -1
- package/dist/workflow/nodes.js +10 -1
- 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 +1092 -0
- package/dist/workflow/validate.d.ts +20 -1
- package/dist/workflow/validate.js +41 -3
- package/package.json +21 -17
- package/dist/diff/line-diff.d.ts +0 -124
- package/dist/diff/line-diff.js +0 -318
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
|
|
@@ -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;
|
package/dist/ConnectionPanel.js
CHANGED
|
@@ -3,19 +3,21 @@ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
|
3
3
|
import { CircleCheck, CircleX, KeyRound, Loader2, Pencil, Plug, Plus, Trash2, Waypoints, } from 'lucide-react';
|
|
4
4
|
import { useState } from 'react';
|
|
5
5
|
import { cn } from './cn';
|
|
6
|
-
import { catalogQueryKeys, useCatalogClient } from './context';
|
|
6
|
+
import { catalogQueryKeys, useCatalogClient, } from './context';
|
|
7
7
|
import { ConfirmDialog } from './ui/dialog';
|
|
8
8
|
import { FieldGroup, TextField } from './ui/field';
|
|
9
9
|
import { SelectField } from './ui/select';
|
|
10
10
|
import { Switch } from './ui/switch';
|
|
11
11
|
import { Tooltip } from './ui/tooltip';
|
|
12
|
+
import { nodeName } from './workflow/model';
|
|
13
|
+
import { WORKFLOW_NAME } from './workflow/name';
|
|
12
14
|
const MUTED = 'text-zinc-400 dark:text-zinc-500';
|
|
13
15
|
const RULE = 'border-zinc-200 dark:border-zinc-800';
|
|
14
16
|
const PANEL = 'bg-white dark:bg-zinc-900';
|
|
15
17
|
/**
|
|
16
18
|
* The kinds worth naming once and reusing.
|
|
17
19
|
*
|
|
18
|
-
* Deliberately three of the five a
|
|
20
|
+
* Deliberately three of the five kinds a source node can be, and the two that are
|
|
19
21
|
* missing are missing for the same reason the checker refuses to probe them: a
|
|
20
22
|
* file's path and a set of pasted records belong to the load, not to a shared
|
|
21
23
|
* address. A connection there would be a name with no address behind it, and a
|
|
@@ -63,13 +65,38 @@ export function describeConnection(connection) {
|
|
|
63
65
|
}
|
|
64
66
|
return text(config, 'url') || 'no URL configured';
|
|
65
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Which pipelines read through a connection, derived from the graphs on screen.
|
|
70
|
+
*
|
|
71
|
+
* A hint, and the server's `connectionWorkflows` is the authority — it also
|
|
72
|
+
* folds in a source that names a connector in `config.connectorId` and inherits
|
|
73
|
+
* the connection from it, which nothing this console writes produces but an
|
|
74
|
+
* upgraded deployment can still hold. So this is what the card shows and the
|
|
75
|
+
* server's answer is what a refusal prints; the two can only disagree by this
|
|
76
|
+
* one under-reporting, which is why the delete dialog asks rather than deciding.
|
|
77
|
+
*/
|
|
78
|
+
function usersOf(workflows, connectionId) {
|
|
79
|
+
const uses = [];
|
|
80
|
+
for (const workflow of workflows) {
|
|
81
|
+
const node = workflow.nodes.find((candidate) => candidate.kind === 'source' && candidate.connectionId === connectionId);
|
|
82
|
+
if (!node)
|
|
83
|
+
continue;
|
|
84
|
+
uses.push({
|
|
85
|
+
id: workflow.id,
|
|
86
|
+
name: workflow.name,
|
|
87
|
+
status: workflow.status,
|
|
88
|
+
through: `"${nodeName(node)}"`,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
return uses;
|
|
92
|
+
}
|
|
66
93
|
/**
|
|
67
94
|
* Named, reusable sources — and a button that finds out whether they answer.
|
|
68
95
|
*
|
|
69
96
|
* The reason this screen is worth having at all is the test. Before it, the
|
|
70
97
|
* only way to learn that a host was wrong, a credential missing or a bucket
|
|
71
98
|
* spelled differently was to run a load and read the failure — which happens on
|
|
72
|
-
* a schedule, hours after somebody typed it, and is attributed to
|
|
99
|
+
* a schedule, hours after somebody typed it, and is attributed to the pipeline
|
|
73
100
|
* rather than to the address it borrowed.
|
|
74
101
|
*/
|
|
75
102
|
export function ConnectionPanel({ canEdit = true }) {
|
|
@@ -81,16 +108,21 @@ export function ConnectionPanel({ canEdit = true }) {
|
|
|
81
108
|
queryFn: () => client.listConnections(),
|
|
82
109
|
});
|
|
83
110
|
// One request for every card's "used by", rather than one per card. The
|
|
84
|
-
//
|
|
85
|
-
//
|
|
86
|
-
//
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
111
|
+
// pipelines list is loaded by the canvas anyway, so this is usually a cache
|
|
112
|
+
// hit, and a per-card fetch would put N requests behind a screen whose whole
|
|
113
|
+
// job is to be quick to glance at.
|
|
114
|
+
//
|
|
115
|
+
// Workflows and not connectors, because that is what a reader recognises and
|
|
116
|
+
// what a refusal has to name. There is also nothing else left to ask: a
|
|
117
|
+
// connector's `connectionId` describes what a graph's source node already
|
|
118
|
+
// says, and the graph is the thing somebody would go and change.
|
|
119
|
+
const { data: workflows = [] } = useQuery({
|
|
120
|
+
queryKey: catalogQueryKeys.workflows,
|
|
121
|
+
queryFn: () => client.listWorkflows(),
|
|
90
122
|
});
|
|
91
123
|
const invalidate = () => {
|
|
92
124
|
queryClient.invalidateQueries({ queryKey: catalogQueryKeys.connections });
|
|
93
|
-
queryClient.invalidateQueries({ queryKey: catalogQueryKeys.
|
|
125
|
+
queryClient.invalidateQueries({ queryKey: catalogQueryKeys.workflows });
|
|
94
126
|
};
|
|
95
127
|
if (editing) {
|
|
96
128
|
return (_jsx(ConnectionForm, { connection: editing === 'new' ? undefined : editing, onClose: () => setEditing(null), onSaved: () => {
|
|
@@ -98,7 +130,7 @@ export function ConnectionPanel({ canEdit = true }) {
|
|
|
98
130
|
invalidate();
|
|
99
131
|
} }));
|
|
100
132
|
}
|
|
101
|
-
return (_jsxs("div", { className: "mt-6 space-y-3", children: [canEdit && (_jsxs("button", { type: "button", onClick: () => setEditing('new'), className: cn('flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs', RULE, 'hover:bg-zinc-50 dark:hover:bg-zinc-800'), children: [_jsx(Plus, { size: 12 }), "New connection"] })), isPending && (_jsx("p", { className: cn('rounded-lg border border-dashed px-4 py-12 text-center text-sm', RULE, MUTED), children: "Reading connections\u2026" })), isError && (_jsx("p", { className: "rounded-lg border border-red-200 bg-red-50 px-4 py-8 text-center text-sm text-red-700 dark:border-red-900 dark:bg-red-950/40 dark:text-red-300", children: "Could not read the connections. This is not the same as having none \u2014 nothing here is safe to act on until it loads." })), !isPending && !isError && connections.length === 0 && (_jsx("p", { className: cn('rounded-lg border border-dashed px-4 py-12 text-center text-sm', RULE, MUTED), children: "No connections yet. A
|
|
133
|
+
return (_jsxs("div", { className: "mt-6 space-y-3", children: [canEdit && (_jsxs("button", { type: "button", onClick: () => setEditing('new'), className: cn('flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs', RULE, 'hover:bg-zinc-50 dark:hover:bg-zinc-800'), children: [_jsx(Plus, { size: 12 }), "New connection"] })), isPending && (_jsx("p", { className: cn('rounded-lg border border-dashed px-4 py-12 text-center text-sm', RULE, MUTED), children: "Reading connections\u2026" })), isError && (_jsx("p", { className: "rounded-lg border border-red-200 bg-red-50 px-4 py-8 text-center text-sm text-red-700 dark:border-red-900 dark:bg-red-950/40 dark:text-red-300", children: "Could not read the connections. This is not the same as having none \u2014 nothing here is safe to act on until it loads." })), !isPending && !isError && connections.length === 0 && (_jsx("p", { className: cn('rounded-lg border border-dashed px-4 py-12 text-center text-sm', RULE, MUTED), children: "No connections yet. A source node can still carry its own address \u2014 a connection is worth making when more than one of them shares it." })), connections.map((connection) => (_jsx(ConnectionCard, { connection: connection, users: usersOf(workflows, connection.id), canEdit: canEdit, onEdit: () => setEditing(connection), onChanged: invalidate }, connection.id)))] }));
|
|
102
134
|
}
|
|
103
135
|
/**
|
|
104
136
|
* Who this connection is: name, kind, who reads through it, what it addresses.
|
|
@@ -107,7 +139,7 @@ export function ConnectionPanel({ canEdit = true }) {
|
|
|
107
139
|
* property worth showing, so it is shown rather than described in a doc.
|
|
108
140
|
*/
|
|
109
141
|
function ConnectionIdentity({ connection, users, }) {
|
|
110
|
-
return (_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((
|
|
142
|
+
return (_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((use) => use.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] }) }))] }));
|
|
111
143
|
}
|
|
112
144
|
/**
|
|
113
145
|
* What the last check found, from the stored fields.
|
|
@@ -142,7 +174,7 @@ function LiveCheckResult({ result }) {
|
|
|
142
174
|
*/
|
|
143
175
|
function deleteRefusalMessage(blockedBy, error) {
|
|
144
176
|
if (blockedBy && blockedBy.length > 0) {
|
|
145
|
-
return (_jsxs(_Fragment, { children: ["Refused: still read through by
|
|
177
|
+
return (_jsxs(_Fragment, { children: ["Refused: still read through by", ' ', blockedBy.map((use) => `${use.name} (${use.through})`).join(', '), ". Point", ' ', blockedBy.length === 1 ? 'it' : 'them', " elsewhere first."] }));
|
|
146
178
|
}
|
|
147
179
|
if (error && !blockedBy) {
|
|
148
180
|
return error instanceof Error ? error.message : 'Could not delete it.';
|
|
@@ -157,15 +189,15 @@ function deleteRefusalMessage(blockedBy, error) {
|
|
|
157
189
|
*/
|
|
158
190
|
function ConnectionCardActions({ connection, users, canEdit, testing, onTest, onEdit, onAskDelete, }) {
|
|
159
191
|
return (_jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [_jsxs("button", { type: "button", onClick: onTest, disabled: testing, 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: [testing ? _jsx(Loader2, { size: 12, className: "animate-spin" }) : _jsx(Plug, { size: 12 }), testing ? '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
|
|
160
|
-
? `${users.length}
|
|
192
|
+
? `${users.length} ${users.length === 1 ? WORKFLOW_NAME.singular : WORKFLOW_NAME.plural} read through this. Deleting it is refused while that is true.`
|
|
161
193
|
: `Delete ${connection.name}`, children: _jsx("button", { type: "button", onClick: onAskDelete, "aria-label": `Delete ${connection.name}`, className: cn('rounded-sm p-1.5 hover:text-red-600', MUTED), children: _jsx(Trash2, { size: 12 }) }) })] }))] }));
|
|
162
194
|
}
|
|
163
195
|
/** What deleting would actually cost, named readers and all, before it is tried. */
|
|
164
196
|
function deleteConsequence(users) {
|
|
165
197
|
if (users.length === 0) {
|
|
166
|
-
return 'Nothing reads through it.
|
|
198
|
+
return 'Nothing reads through it. Anything that used to is unaffected; only this address and the name of its credential variable go.';
|
|
167
199
|
}
|
|
168
|
-
return (_jsxs(_Fragment, { children: [users.length, "
|
|
200
|
+
return (_jsxs(_Fragment, { children: [users.length, " ", users.length === 1 ? WORKFLOW_NAME.singular : WORKFLOW_NAME.plural, " read through this connection \u2014 ", users.map((use) => use.name).join(', '), ". Deleting it would leave", ' ', users.length === 1 ? 'it' : 'them', " without an address, and that is discovered on the next scheduled run rather than now. The server refuses while this is true."] }));
|
|
169
201
|
}
|
|
170
202
|
function ConnectionCard({ connection, users, canEdit, onEdit, onChanged, }) {
|
|
171
203
|
const client = useCatalogClient();
|
|
@@ -182,11 +214,12 @@ function ConnectionCard({ connection, users, canEdit, onEdit, onChanged, }) {
|
|
|
182
214
|
mutationFn: async () => {
|
|
183
215
|
const result = await client.deleteConnection(connection.id);
|
|
184
216
|
if (!result.deleted) {
|
|
185
|
-
// The store refuses while
|
|
217
|
+
// The store refuses while anything still reads through it. Asking who
|
|
186
218
|
// they are is the difference between "it would not delete" and a
|
|
187
|
-
// sentence somebody can act on — and it is the server's answer,
|
|
188
|
-
//
|
|
189
|
-
|
|
219
|
+
// sentence somebody can act on — and it is the server's answer, which
|
|
220
|
+
// sees a source reaching this connection through an inherited connector
|
|
221
|
+
// as well as one naming it outright. The card's own count does not.
|
|
222
|
+
setBlockedBy(await client.connectionWorkflows(connection.id));
|
|
190
223
|
throw new Error('Still in use.');
|
|
191
224
|
}
|
|
192
225
|
return result;
|
|
@@ -243,7 +276,7 @@ function connectionIsIncomplete(kind, draft) {
|
|
|
243
276
|
}
|
|
244
277
|
/** A base URL, and the token sent against it. */
|
|
245
278
|
function HttpFields({ draft, update }) {
|
|
246
|
-
return (_jsxs(_Fragment, { children: [_jsx(TextField, { label: "URL", value: draft.url, onChange: (url) => update({ url }), placeholder: "https://api.example.mil/v1", hint: "The base
|
|
279
|
+
return (_jsxs(_Fragment, { children: [_jsx(TextField, { label: "URL", value: draft.url, onChange: (url) => update({ url }), placeholder: "https://api.example.mil/v1", hint: "The base every source reading through this will hang its path off." }), _jsx(TextField, { label: "Credential env var", value: draft.secretEnvVar, onChange: (secretEnvVar) => update({ secretEnvVar }), placeholder: "Optional \u2014 sent as a bearer token" })] }));
|
|
247
280
|
}
|
|
248
281
|
/**
|
|
249
282
|
* The connection string, and nothing beside it.
|
|
@@ -285,7 +318,7 @@ function ConnectionKindFields({ kind, draft, update, }) {
|
|
|
285
318
|
*
|
|
286
319
|
* The form carries the address and the credential variable and nothing about
|
|
287
320
|
* any particular load — no query, no prefix, no path. That split is the whole
|
|
288
|
-
* point of the concept: five
|
|
321
|
+
* point of the concept: five pipelines reading one database used to hold five
|
|
289
322
|
* copies of its URL, and moving the database meant editing five rows nobody
|
|
290
323
|
* could find.
|
|
291
324
|
*/
|
|
@@ -325,13 +358,17 @@ function ConnectionForm({ connection, onClose, onSaved, }) {
|
|
|
325
358
|
}, children: [_jsxs("div", { className: "grid gap-3 sm:grid-cols-3", children: [_jsx(TextField, { label: "Name", value: draft.name, onChange: (name) => update({ name }), placeholder: "Fleet warehouse" }), _jsx(TextField, { label: "Description", value: draft.description, onChange: (description) => update({ description }), placeholder: "What lives behind it (optional)" }), _jsx(SelectField, { label: "Kind", ariaLabel: "Connection kind", value: kind, onValueChange: (value) => setKind(toConnectableKind(value)), options: KIND_OPTIONS })] }), _jsx(ConnectionKindFields, { kind: kind, draft: draft, update: update }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("button", { type: "submit", disabled: save.isPending || incomplete, className: "rounded-md bg-zinc-950 px-3 py-1.5 text-xs text-zinc-50 disabled:opacity-40 dark:bg-zinc-100 dark:text-zinc-950", children: save.isPending ? 'Saving…' : connection ? 'Save changes' : 'Save connection' }), _jsx("button", { type: "button", onClick: onClose, className: cn('rounded-md px-3 py-1.5 text-xs', MUTED), children: "Cancel" }), _jsx("span", { className: cn('text-[11px]', MUTED), children: "Saving does not reach it. Test the connection from its card." })] }), save.error && (_jsx("p", { className: "text-[11px] text-red-600", children: save.error instanceof Error ? save.error.message : 'Could not save.' }))] }));
|
|
326
359
|
}
|
|
327
360
|
/**
|
|
328
|
-
* The options a
|
|
361
|
+
* The options a source node offers for "read through".
|
|
362
|
+
*
|
|
363
|
+
* Exported because the canvas's source inspector lives in another file and this
|
|
364
|
+
* list has one rule that must not be duplicated: only connections of the same
|
|
365
|
+
* kind. A source reading S3 through a database connection is not a
|
|
366
|
+
* configuration anybody meant, and it would fail at run time with an error about
|
|
367
|
+
* a missing bucket rather than about the mistake.
|
|
329
368
|
*
|
|
330
|
-
*
|
|
331
|
-
*
|
|
332
|
-
*
|
|
333
|
-
* anybody meant, and it would fail at run time with an error about a missing
|
|
334
|
-
* bucket rather than about the mistake.
|
|
369
|
+
* The hint is `describeConnection`, which is why this is here and not beside the
|
|
370
|
+
* other source fields: the address is the thing that distinguishes two
|
|
371
|
+
* connections with similar names, and it is the connection that knows it.
|
|
335
372
|
*/
|
|
336
373
|
export function connectionOptionsFor(kind, connections) {
|
|
337
374
|
return connections
|