@dudousxd/nestjs-catalog-react 0.18.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/CatalogManager.d.ts +23 -1
  2. package/dist/CatalogManager.js +76 -13
  3. package/dist/ConnectionPanel.js +15 -123
  4. package/dist/LoadedBySection.d.ts +39 -0
  5. package/dist/LoadedBySection.js +143 -0
  6. package/dist/WorkflowCanvas.d.ts +16 -0
  7. package/dist/WorkflowCanvas.js +1026 -78
  8. package/dist/connection-form.d.ts +241 -0
  9. package/dist/connection-form.js +235 -0
  10. package/dist/context.d.ts +78 -4
  11. package/dist/context.js +11 -0
  12. package/dist/index.d.ts +5 -1
  13. package/dist/index.js +23 -0
  14. package/dist/routes.d.ts +30 -0
  15. package/dist/routes.js +2 -0
  16. package/dist/schema-discovery.d.ts +17 -1
  17. package/dist/schema-discovery.js +3 -3
  18. package/dist/source-connection.d.ts +82 -0
  19. package/dist/source-connection.js +176 -0
  20. package/dist/source-fields.d.ts +15 -2
  21. package/dist/source-fields.js +15 -2
  22. package/dist/ui/combobox.d.ts +97 -0
  23. package/dist/ui/combobox.js +80 -0
  24. package/dist/workflow/edges.d.ts +110 -0
  25. package/dist/workflow/edges.js +112 -0
  26. package/dist/workflow/graph.d.ts +63 -2
  27. package/dist/workflow/graph.js +322 -43
  28. package/dist/workflow/index.d.ts +7 -1
  29. package/dist/workflow/index.js +10 -5
  30. package/dist/workflow/lifecycle.d.ts +0 -29
  31. package/dist/workflow/lifecycle.js +2 -35
  32. package/dist/workflow/model.d.ts +28 -3
  33. package/dist/workflow/model.js +12 -2
  34. package/dist/workflow/nodes.d.ts +4 -1
  35. package/dist/workflow/nodes.js +226 -11
  36. package/dist/workflow/templates.js +21 -0
  37. package/dist/workflow/validate.js +11 -0
  38. package/dist/workflow/wiring.d.ts +84 -0
  39. package/dist/workflow/wiring.js +254 -0
  40. package/package.json +8 -8
@@ -0,0 +1,241 @@
1
+ import type { CatalogConnection, ConnectionCheck, ConnectorKind } from '@dudousxd/nestjs-catalog/client';
2
+ import type { ReactNode } from 'react';
3
+ /**
4
+ * Describing where a *shared address* lives, in one place.
5
+ *
6
+ * The sibling of `source-fields.tsx`, and for the same reason. That module
7
+ * exists because two screens ask "where does this read from" and must ask it the
8
+ * same way; this one exists because two screens now ask "what is this connection"
9
+ * — the Connections console, and the source node's inspector on the canvas,
10
+ * which can create one without leaving the graph. Two forms would mean two
11
+ * answers to "what does an S3 connection need", and the one updated second would
12
+ * quietly be the one that is right.
13
+ *
14
+ * The split between the two modules is the split the model draws. A connection
15
+ * carries the address and the credential and nothing about any particular load;
16
+ * a source carries the query, the prefix, the path — the part that is specific to
17
+ * one read. Five pipelines reading one database used to hold five copies of its
18
+ * URL, and moving the database meant editing five rows nobody could find.
19
+ */
20
+ /**
21
+ * Every kind, and what a connection to one is — including the kinds where the
22
+ * answer is "nothing".
23
+ *
24
+ * A total record over {@link CONNECTOR_KINDS} rather than a hand-kept list of
25
+ * the three kinds that happen to be connectable today, and `satisfies` rather
26
+ * than an annotation so the keys stay literal: a sixth kind added to the
27
+ * exported constant fails this build with a missing property, instead of quietly
28
+ * arriving in a dropdown with no fields under it. That is the failure this shape
29
+ * is for — a form that renders nothing looks like a form somebody has not
30
+ * finished typing into.
31
+ *
32
+ * `file` and `inline` are refusals, and deliberately: a file's path and a set of
33
+ * pasted records belong to the load, not to a shared address. A connection there
34
+ * would be a name with nothing behind it, and — since a connection's whole worth
35
+ * is the button that finds out whether it answers — a "Test connection" that
36
+ * always passes is worse than no button, because it teaches people that a green
37
+ * tick means nothing. `ConnectionChecker.probe` says the same thing from the
38
+ * server's side.
39
+ */
40
+ declare const KINDS: {
41
+ http: {
42
+ connectable: true;
43
+ label: string;
44
+ Fields: typeof HttpFields;
45
+ configFrom: (draft: ConnectionDraft) => {
46
+ url: string;
47
+ } | {
48
+ url?: undefined;
49
+ };
50
+ isIncomplete: (draft: ConnectionDraft) => boolean;
51
+ };
52
+ sql: {
53
+ connectable: true;
54
+ label: string;
55
+ Fields: typeof SqlFields;
56
+ configFrom: (draft: ConnectionDraft) => {
57
+ url: string;
58
+ } | {
59
+ url?: undefined;
60
+ };
61
+ isIncomplete: (draft: ConnectionDraft) => boolean;
62
+ };
63
+ file: {
64
+ connectable: false;
65
+ because: string;
66
+ };
67
+ s3: {
68
+ connectable: true;
69
+ label: string;
70
+ Fields: typeof S3Fields;
71
+ configFrom: (draft: ConnectionDraft) => {
72
+ forcePathStyle?: boolean | undefined;
73
+ region?: string | undefined;
74
+ endpoint?: string | undefined;
75
+ bucket: string;
76
+ };
77
+ isIncomplete: (draft: ConnectionDraft) => boolean;
78
+ };
79
+ inline: {
80
+ connectable: false;
81
+ because: string;
82
+ };
83
+ };
84
+ /** A kind a connection can actually address, narrowed from the record above. */
85
+ export type ConnectableKind = {
86
+ [Kind in ConnectorKind]: (typeof KINDS)[Kind] extends {
87
+ connectable: true;
88
+ } ? Kind : never;
89
+ }[ConnectorKind];
90
+ /** What a connection to one kind is, or why it is not a thing. */
91
+ export type ConnectionKindSpec = ConnectableKindSpec | UnconnectableKindSpec;
92
+ export interface ConnectableKindSpec {
93
+ connectable: true;
94
+ /** How the kind reads in a picker. */
95
+ label: string;
96
+ /** The address fields this kind asks for, and no others. */
97
+ Fields: (props: {
98
+ draft: ConnectionDraft;
99
+ update: UpdateDraft;
100
+ }) => ReactNode;
101
+ /**
102
+ * Only the config fields this kind actually reads.
103
+ *
104
+ * Carrying the rest would leave a stale bucket on an HTTP connection, which
105
+ * reads as configuration somebody meant rather than as a leftover from a
106
+ * dropdown they changed.
107
+ */
108
+ configFrom(draft: ConnectionDraft): Record<string, unknown>;
109
+ /** Whether there is not yet enough here to save. */
110
+ isIncomplete(draft: ConnectionDraft): boolean;
111
+ }
112
+ export interface UnconnectableKindSpec {
113
+ connectable: false;
114
+ /** Said where the offer would otherwise be, rather than leaving a gap. */
115
+ because: string;
116
+ }
117
+ export declare const CONNECTION_KINDS: Record<ConnectorKind, ConnectionKindSpec>;
118
+ /**
119
+ * The kinds a connection can be, in the order the vocabulary declares them.
120
+ *
121
+ * Derived from the record and never written out, so it cannot fall behind it.
122
+ * A predicate rather than a cast: the value being narrowed is the same string
123
+ * the guard tests, which is the one shape of narrowing that is not a promise.
124
+ */
125
+ export declare const CONNECTABLE_KINDS: readonly ConnectableKind[];
126
+ /** A select hands back a string. Narrow it rather than promise it is a kind. */
127
+ export declare function toConnectableKind(value: string): ConnectableKind;
128
+ /** The kind dropdown, derived so a new connectable kind appears in it by existing. */
129
+ export declare const CONNECTION_KIND_OPTIONS: {
130
+ value: ConnectableKind;
131
+ label: string;
132
+ }[];
133
+ /**
134
+ * The spec for a kind that is definitely connectable.
135
+ *
136
+ * The narrowing every caller below would otherwise write inline. It throws
137
+ * rather than returning a fallback, because every call site has already asked
138
+ * {@link CONNECTION_KINDS} whether this kind is connectable — reaching here with
139
+ * one that is not means those two questions disagree, and a silent fallback to
140
+ * HTTP would save an S3 connection as an HTTP one.
141
+ */
142
+ export declare function connectableSpec(kind: ConnectableKind): ConnectableKindSpec;
143
+ /** Read a string out of a stored config without believing it is one. */
144
+ export declare function configString(config: Record<string, unknown>, key: string): string;
145
+ /** Everything the form edits, before it is split into a name and a config. */
146
+ export interface ConnectionDraft {
147
+ name: string;
148
+ description: string;
149
+ url: string;
150
+ bucket: string;
151
+ endpoint: string;
152
+ region: string;
153
+ forcePathStyle: boolean;
154
+ secretEnvVar: string;
155
+ }
156
+ /** A patch onto the draft, so each field can name only what it changes. */
157
+ export type UpdateDraft = (patch: Partial<ConnectionDraft>) => void;
158
+ /** A blank draft, or one filled from the connection being edited. */
159
+ export declare function connectionDraftFrom(connection?: CatalogConnection): ConnectionDraft;
160
+ /** The stored config for one kind, and nothing else. */
161
+ export declare function connectionConfigFor(kind: ConnectableKind, draft: ConnectionDraft): Record<string, unknown>;
162
+ /** Whether there is not yet enough here to save. A name, plus whatever the kind needs. */
163
+ export declare function connectionIsIncomplete(kind: ConnectableKind, draft: ConnectionDraft): boolean;
164
+ /**
165
+ * The config key holding a URL whose password is the redaction placeholder, if
166
+ * there is one.
167
+ *
168
+ * The one thing a form that offers a paste box owes the redaction. `GET
169
+ * pipeline/connections` answers with the password replaced by
170
+ * {@link REDACTED_SECRET}, and the server puts the real one back when a caller
171
+ * posts the placeholder against a connection it can look up. **A create has no
172
+ * such row**, so the same string arrives with nothing to restore it from and is
173
+ * stored verbatim: a connection whose password is the word "REDACTED", which
174
+ * saves cleanly and fails at the first scheduled load as an authentication
175
+ * error against a password nobody typed.
176
+ *
177
+ * Parsed with WHATWG `URL` rather than matched as a substring, exactly as the
178
+ * server's redaction is, so `postgres:` and `mysql:` yield a real `password`
179
+ * instead of being swept into an opaque path — and so a host genuinely called
180
+ * `redacted.internal` is not accused of anything.
181
+ */
182
+ export declare function redactedCredentialIn(config: Record<string, unknown>): string | undefined;
183
+ /** A base URL, and the token sent against it. */
184
+ declare function HttpFields({ draft, update }: {
185
+ draft: ConnectionDraft;
186
+ update: UpdateDraft;
187
+ }): import("react/jsx-runtime").JSX.Element;
188
+ /**
189
+ * The connection string, and nothing beside it.
190
+ *
191
+ * This was two fields — an inline URL and the name of an environment variable
192
+ * holding one — presented side by side with a paragraph explaining when each
193
+ * applied. Two doors for one decision, and only one of them worked for a
194
+ * database with a password, which is every database anybody connects to. The
195
+ * question it produced was "what is this second field", which is the form
196
+ * asking the reader to understand its implementation.
197
+ *
198
+ * One field now. Whether the URL may REST in the catalog's own table is the
199
+ * store's decision (`allowInlineCredentials`) and not something to ask on a
200
+ * form — and it is a decision about the deployment, not about this connection.
201
+ * The server refuses and says why if the answer is no, which is a better place
202
+ * to learn it than a hint nobody reads until afterwards.
203
+ *
204
+ * `secretEnvVar` still exists on the model and is still what a hardened
205
+ * deployment should use; it is not on this screen. A host that wants it back
206
+ * has the field on the record.
207
+ */
208
+ declare function SqlFields({ draft, update }: {
209
+ draft: ConnectionDraft;
210
+ update: UpdateDraft;
211
+ }): import("react/jsx-runtime").JSX.Element;
212
+ /** A bucket, plus everything needed to address a non-AWS one. */
213
+ declare function S3Fields({ draft, update }: {
214
+ draft: ConnectionDraft;
215
+ update: UpdateDraft;
216
+ }): import("react/jsx-runtime").JSX.Element;
217
+ /**
218
+ * What a check that just ran found, in the checker's own words.
219
+ *
220
+ * A server version, a bucket and whether anything is under the prefix, an HTTP
221
+ * status. That sentence is the whole product of the button; "OK" would prove
222
+ * only that something is listening on a port.
223
+ *
224
+ * Shared by the console's card and by the inline form on the canvas, and the
225
+ * `error` line is why that matters: the checker redacts the password, the query
226
+ * string and the fragment out of a failure and keeps the host and the user,
227
+ * because which host refused and as whom is the entire value of a failed check.
228
+ * A second renderer would eventually print `detail` alone, and the difference
229
+ * between "reachable but refused" and "unreachable" — which send an operator to
230
+ * completely different places — would be the thing it dropped.
231
+ */
232
+ export declare function ConnectionCheckResult({ result }: {
233
+ result: ConnectionCheck;
234
+ }): import("react/jsx-runtime").JSX.Element;
235
+ /** The address fields for whichever kind is selected, and only those. */
236
+ export declare function ConnectionKindFields({ kind, draft, update, }: {
237
+ kind: ConnectableKind;
238
+ draft: ConnectionDraft;
239
+ update: UpdateDraft;
240
+ }): import("react/jsx-runtime").JSX.Element;
241
+ export {};
@@ -0,0 +1,235 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { CONNECTOR_KINDS, REDACTED_SECRET } from '@dudousxd/nestjs-catalog/client';
3
+ import { CircleCheck, CircleX } from 'lucide-react';
4
+ import { cn } from './cn';
5
+ import { FieldGroup, TextField } from './ui/field';
6
+ import { Switch } from './ui/switch';
7
+ /**
8
+ * Describing where a *shared address* lives, in one place.
9
+ *
10
+ * The sibling of `source-fields.tsx`, and for the same reason. That module
11
+ * exists because two screens ask "where does this read from" and must ask it the
12
+ * same way; this one exists because two screens now ask "what is this connection"
13
+ * — the Connections console, and the source node's inspector on the canvas,
14
+ * which can create one without leaving the graph. Two forms would mean two
15
+ * answers to "what does an S3 connection need", and the one updated second would
16
+ * quietly be the one that is right.
17
+ *
18
+ * The split between the two modules is the split the model draws. A connection
19
+ * carries the address and the credential and nothing about any particular load;
20
+ * a source carries the query, the prefix, the path — the part that is specific to
21
+ * one read. Five pipelines reading one database used to hold five copies of its
22
+ * URL, and moving the database meant editing five rows nobody could find.
23
+ */
24
+ /**
25
+ * Every kind, and what a connection to one is — including the kinds where the
26
+ * answer is "nothing".
27
+ *
28
+ * A total record over {@link CONNECTOR_KINDS} rather than a hand-kept list of
29
+ * the three kinds that happen to be connectable today, and `satisfies` rather
30
+ * than an annotation so the keys stay literal: a sixth kind added to the
31
+ * exported constant fails this build with a missing property, instead of quietly
32
+ * arriving in a dropdown with no fields under it. That is the failure this shape
33
+ * is for — a form that renders nothing looks like a form somebody has not
34
+ * finished typing into.
35
+ *
36
+ * `file` and `inline` are refusals, and deliberately: a file's path and a set of
37
+ * pasted records belong to the load, not to a shared address. A connection there
38
+ * would be a name with nothing behind it, and — since a connection's whole worth
39
+ * is the button that finds out whether it answers — a "Test connection" that
40
+ * always passes is worse than no button, because it teaches people that a green
41
+ * tick means nothing. `ConnectionChecker.probe` says the same thing from the
42
+ * server's side.
43
+ */
44
+ const KINDS = {
45
+ http: {
46
+ connectable: true,
47
+ label: 'HTTP — a JSON endpoint',
48
+ Fields: HttpFields,
49
+ configFrom: (draft) => (draft.url ? { url: draft.url } : {}),
50
+ isIncomplete: (draft) => draft.url.trim().length === 0,
51
+ },
52
+ sql: {
53
+ connectable: true,
54
+ label: 'SQL — a database',
55
+ Fields: SqlFields,
56
+ configFrom: (draft) => (draft.url ? { url: draft.url } : {}),
57
+ // Either address will do and neither is more correct: the variable is the
58
+ // right answer in a deployment, the inline URL is the one that gets somebody
59
+ // running locally in a minute.
60
+ isIncomplete: (draft) => draft.url.trim().length === 0 && draft.secretEnvVar.trim().length === 0,
61
+ },
62
+ file: {
63
+ connectable: false,
64
+ because: 'A file source carries its own path, and a path belongs to the load rather than to an address several loads share.',
65
+ },
66
+ s3: {
67
+ connectable: true,
68
+ label: 'S3 — a bucket, or anything S3-compatible',
69
+ Fields: S3Fields,
70
+ configFrom: (draft) => ({
71
+ bucket: draft.bucket,
72
+ ...(draft.endpoint ? { endpoint: draft.endpoint } : {}),
73
+ ...(draft.region ? { region: draft.region } : {}),
74
+ ...(draft.forcePathStyle ? { forcePathStyle: true } : {}),
75
+ }),
76
+ isIncomplete: (draft) => draft.bucket.trim().length === 0,
77
+ },
78
+ inline: {
79
+ connectable: false,
80
+ because: 'Inline records are pasted into the source itself. There is no address to share.',
81
+ },
82
+ };
83
+ export const CONNECTION_KINDS = KINDS;
84
+ /**
85
+ * The kinds a connection can be, in the order the vocabulary declares them.
86
+ *
87
+ * Derived from the record and never written out, so it cannot fall behind it.
88
+ * A predicate rather than a cast: the value being narrowed is the same string
89
+ * the guard tests, which is the one shape of narrowing that is not a promise.
90
+ */
91
+ export const CONNECTABLE_KINDS = CONNECTOR_KINDS.filter((kind) => CONNECTION_KINDS[kind].connectable);
92
+ /** A select hands back a string. Narrow it rather than promise it is a kind. */
93
+ export function toConnectableKind(value) {
94
+ return CONNECTABLE_KINDS.find((kind) => kind === value) ?? 'http';
95
+ }
96
+ /** The kind dropdown, derived so a new connectable kind appears in it by existing. */
97
+ export const CONNECTION_KIND_OPTIONS = CONNECTABLE_KINDS.map((kind) => ({
98
+ value: kind,
99
+ label: connectableSpec(kind).label,
100
+ }));
101
+ /**
102
+ * The spec for a kind that is definitely connectable.
103
+ *
104
+ * The narrowing every caller below would otherwise write inline. It throws
105
+ * rather than returning a fallback, because every call site has already asked
106
+ * {@link CONNECTION_KINDS} whether this kind is connectable — reaching here with
107
+ * one that is not means those two questions disagree, and a silent fallback to
108
+ * HTTP would save an S3 connection as an HTTP one.
109
+ */
110
+ export function connectableSpec(kind) {
111
+ const spec = CONNECTION_KINDS[kind];
112
+ if (!spec.connectable) {
113
+ throw new Error(`"${kind}" is in CONNECTABLE_KINDS but its spec says it is not connectable.`);
114
+ }
115
+ return spec;
116
+ }
117
+ /** Read a string out of a stored config without believing it is one. */
118
+ export function configString(config, key) {
119
+ const value = config[key];
120
+ return typeof value === 'string' ? value : '';
121
+ }
122
+ /** A blank draft, or one filled from the connection being edited. */
123
+ export function connectionDraftFrom(connection) {
124
+ const config = connection?.config ?? {};
125
+ return {
126
+ name: connection?.name ?? '',
127
+ description: connection?.description ?? '',
128
+ url: configString(config, 'url'),
129
+ bucket: configString(config, 'bucket'),
130
+ endpoint: configString(config, 'endpoint'),
131
+ region: configString(config, 'region'),
132
+ forcePathStyle: config.forcePathStyle === true,
133
+ secretEnvVar: connection?.secretEnvVar ?? '',
134
+ };
135
+ }
136
+ /** The stored config for one kind, and nothing else. */
137
+ export function connectionConfigFor(kind, draft) {
138
+ return connectableSpec(kind).configFrom(draft);
139
+ }
140
+ /** Whether there is not yet enough here to save. A name, plus whatever the kind needs. */
141
+ export function connectionIsIncomplete(kind, draft) {
142
+ if (draft.name.trim().length === 0)
143
+ return true;
144
+ return connectableSpec(kind).isIncomplete(draft);
145
+ }
146
+ /**
147
+ * The config key holding a URL whose password is the redaction placeholder, if
148
+ * there is one.
149
+ *
150
+ * The one thing a form that offers a paste box owes the redaction. `GET
151
+ * pipeline/connections` answers with the password replaced by
152
+ * {@link REDACTED_SECRET}, and the server puts the real one back when a caller
153
+ * posts the placeholder against a connection it can look up. **A create has no
154
+ * such row**, so the same string arrives with nothing to restore it from and is
155
+ * stored verbatim: a connection whose password is the word "REDACTED", which
156
+ * saves cleanly and fails at the first scheduled load as an authentication
157
+ * error against a password nobody typed.
158
+ *
159
+ * Parsed with WHATWG `URL` rather than matched as a substring, exactly as the
160
+ * server's redaction is, so `postgres:` and `mysql:` yield a real `password`
161
+ * instead of being swept into an opaque path — and so a host genuinely called
162
+ * `redacted.internal` is not accused of anything.
163
+ */
164
+ export function redactedCredentialIn(config) {
165
+ for (const [key, value] of Object.entries(config)) {
166
+ if (typeof value !== 'string')
167
+ continue;
168
+ let url;
169
+ try {
170
+ url = new URL(value);
171
+ }
172
+ catch {
173
+ continue;
174
+ }
175
+ if (url.password === REDACTED_SECRET)
176
+ return key;
177
+ }
178
+ return undefined;
179
+ }
180
+ /** A base URL, and the token sent against it. */
181
+ function HttpFields({ draft, update }) {
182
+ 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" })] }));
183
+ }
184
+ /**
185
+ * The connection string, and nothing beside it.
186
+ *
187
+ * This was two fields — an inline URL and the name of an environment variable
188
+ * holding one — presented side by side with a paragraph explaining when each
189
+ * applied. Two doors for one decision, and only one of them worked for a
190
+ * database with a password, which is every database anybody connects to. The
191
+ * question it produced was "what is this second field", which is the form
192
+ * asking the reader to understand its implementation.
193
+ *
194
+ * One field now. Whether the URL may REST in the catalog's own table is the
195
+ * store's decision (`allowInlineCredentials`) and not something to ask on a
196
+ * form — and it is a decision about the deployment, not about this connection.
197
+ * The server refuses and says why if the answer is no, which is a better place
198
+ * to learn it than a hint nobody reads until afterwards.
199
+ *
200
+ * `secretEnvVar` still exists on the model and is still what a hardened
201
+ * deployment should use; it is not on this screen. A host that wants it back
202
+ * has the field on the record.
203
+ */
204
+ function SqlFields({ draft, update }) {
205
+ return (_jsx(FieldGroup, { title: "Address", hint: "The connection string, as your database gives it to you. It is served back redacted, so the password never travels in a response \u2014 but it does rest in this catalog's own table, and a deployment can refuse that.", children: _jsx(TextField, { label: "Connection URL", value: draft.url, onChange: (url) => update({ url }), placeholder: "mysql://user:pass@host:3306/database" }) }));
206
+ }
207
+ /** A bucket, plus everything needed to address a non-AWS one. */
208
+ function S3Fields({ draft, update }) {
209
+ return (_jsxs(FieldGroup, { title: "Bucket", children: [_jsxs("div", { className: "grid gap-3 sm:grid-cols-2", children: [_jsx(TextField, { label: "Bucket", value: draft.bucket, onChange: (bucket) => update({ bucket }), placeholder: "fleet-drops" }), _jsx(TextField, { label: "Region", value: draft.region, onChange: (region) => update({ region }), placeholder: "Blank uses the environment's" }), _jsx(TextField, { label: "Endpoint", value: draft.endpoint, onChange: (endpoint) => update({ endpoint }), placeholder: "MinIO, e.g. http://localhost:9000" }), _jsx(TextField, { label: "Env var holding accessKeyId:secretAccessKey", value: draft.secretEnvVar, onChange: (secretEnvVar) => update({ secretEnvVar }), placeholder: "Optional", hint: "Leave blank anywhere the pod has its own role \u2014 those credentials rotate, and a static pair named here would not." })] }), _jsx(Switch, { checked: draft.forcePathStyle, onCheckedChange: (forcePathStyle) => update({ forcePathStyle }), label: "Path-style addressing", hint: "MinIO needs it; AWS does not." })] }));
210
+ }
211
+ /**
212
+ * What a check that just ran found, in the checker's own words.
213
+ *
214
+ * A server version, a bucket and whether anything is under the prefix, an HTTP
215
+ * status. That sentence is the whole product of the button; "OK" would prove
216
+ * only that something is listening on a port.
217
+ *
218
+ * Shared by the console's card and by the inline form on the canvas, and the
219
+ * `error` line is why that matters: the checker redacts the password, the query
220
+ * string and the fragment out of a failure and keeps the host and the user,
221
+ * because which host refused and as whom is the entire value of a failed check.
222
+ * A second renderer would eventually print `detail` alone, and the difference
223
+ * between "reachable but refused" and "unreachable" — which send an operator to
224
+ * completely different places — would be the thing it dropped.
225
+ */
226
+ export function ConnectionCheckResult({ result }) {
227
+ return (_jsx("div", { className: cn('mt-3 rounded-md border px-3 py-2 text-[11px]', result.ok
228
+ ? 'border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-900 dark:bg-emerald-950/40 dark:text-emerald-300'
229
+ : 'border-red-200 bg-red-50 text-red-700 dark:border-red-900 dark:bg-red-950/40 dark:text-red-300'), children: _jsxs("div", { className: "flex items-start gap-2", children: [result.ok ? (_jsx(CircleCheck, { size: 13, "aria-hidden": true, className: "mt-px shrink-0" })) : (_jsx(CircleX, { size: 13, "aria-hidden": true, className: "mt-px shrink-0" })), _jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "font-medium", children: result.ok ? 'Reached it.' : 'Could not reach it.' }), _jsx("div", { className: "mt-0.5 font-mono leading-relaxed", children: result.detail }), result.error && (_jsx("div", { className: "mt-1 font-mono leading-relaxed opacity-80", children: result.error })), _jsxs("div", { className: "mt-1 font-mono text-[10px] opacity-70", children: [result.elapsedMs, " ms"] })] })] }) }));
230
+ }
231
+ /** The address fields for whichever kind is selected, and only those. */
232
+ export function ConnectionKindFields({ kind, draft, update, }) {
233
+ const { Fields } = connectableSpec(kind);
234
+ return _jsx(Fields, { draft: draft, update: update });
235
+ }
package/dist/context.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { CatalogAuditEvent, CatalogConnection, CatalogConnector, CatalogObjectPage, CatalogQueryRelation, CatalogQueryResult, CatalogRevision, CatalogSearchResult, CatalogSnapshot, CatalogTraceList, CatalogTransform, ConnectionCheck, ConnectorRun, Dashboard, DashboardCard, DeleteReconciliation, LoadExpectation, LoadExpectationInput, ObjectQueryParams, PropertyPatch, ResolvedLoadExpectation, RowCountBound, SaveQueryInput, SavedQuery, SnapshotRef, StoredLoadExpectation, TraceQuery, TransformLanguage, TransformResult, TypePatch } from '@dudousxd/nestjs-catalog/client';
1
+ import type { CallableWorkflowRef, CatalogAuditEvent, CatalogConnection, CatalogConnector, CatalogObjectPage, CatalogQueryRelation, CatalogQueryResult, CatalogRevision, CatalogSearchResult, CatalogSnapshot, CatalogTraceList, CatalogTransform, ConnectionCheck, ConnectorRun, Dashboard, DashboardCard, DeleteReconciliation, LoadExpectation, LoadExpectationInput, ObjectQueryParams, PropertyPatch, ResolvedLoadExpectation, RowCountBound, SaveQueryInput, SavedQuery, SnapshotRef, StoredLoadExpectation, TraceQuery, TransformLanguage, TransformResult, TypePatch } from '@dudousxd/nestjs-catalog/client';
2
2
  import { type ReactNode } from 'react';
3
3
  import type { EmbeddedChartPayload, EmbeddedDashboardPayload } from './embed/payload';
4
4
  import { type PeopleQuery } from './routes';
@@ -77,6 +77,37 @@ export interface PipelineCapabilities {
77
77
  */
78
78
  durable?: WorkflowDurability;
79
79
  }
80
+ /**
81
+ * What a call node could be pointed at, and whether the question was answerable.
82
+ *
83
+ * Mirrored here for the reason {@link PipelineCapabilities} is: naming the
84
+ * server's own declaration would mean importing
85
+ * `@dudousxd/nestjs-catalog-pipeline`, a package built for a Node process with
86
+ * database drivers behind optional imports. `CallableWorkflowRef` itself is
87
+ * re-exported from `@dudousxd/nestjs-catalog/client` and is NOT copied — the
88
+ * entries are the contract, and a second copy of those would drift.
89
+ *
90
+ * `supported` is the field that stops the list being misread, and it exists
91
+ * because an empty list means two opposite things. With `supported: true` it
92
+ * says the fleet announces nothing — every callable workflow is unregistered or
93
+ * its workers are down. With `supported: false` it says nobody could be asked:
94
+ * this deployment has no durable engine, or the engine could not read the
95
+ * announcements. A screen that rendered "no workflows found" over both would be
96
+ * asserting the first when it was told the second, which is the shape of claim
97
+ * this codebase keeps having to take back out.
98
+ */
99
+ export interface CallableWorkflowList {
100
+ supported: boolean;
101
+ workflows: CallableWorkflowRef[];
102
+ /**
103
+ * When the fleet was asked, ISO-8601. Rendered, because this is a snapshot
104
+ * with a resolution of about one worker heartbeat and showing it without a
105
+ * time would present a moment as a standing fact.
106
+ */
107
+ observedAt: string;
108
+ /** Why, in a full sentence. Rendered verbatim under the picker. */
109
+ detail: string;
110
+ }
80
111
  /**
81
112
  * What a load has to be true of before it becomes the data everybody reads.
82
113
  *
@@ -434,6 +465,16 @@ export interface CatalogClient {
434
465
  * not the other.
435
466
  */
436
467
  pipelineCapabilities(): Promise<PipelineCapabilities>;
468
+ /**
469
+ * Every workflow the live fleet announces it can execute — what a call node's
470
+ * picker offers.
471
+ *
472
+ * A separate call from {@link pipelineCapabilities} rather than a field on it,
473
+ * because the two have opposite lifetimes. Capabilities cannot change without
474
+ * a redeploy, so the canvas caches them forever. This is a snapshot of live
475
+ * workers with a resolution of about one heartbeat, so it must not be.
476
+ */
477
+ listCallableWorkflows(): Promise<CallableWorkflowList>;
437
478
  listConnections(): Promise<CatalogConnection[]>;
438
479
  saveConnection(input: ConnectionInput): Promise<CatalogConnection>;
439
480
  /**
@@ -444,6 +485,29 @@ export interface CatalogClient {
444
485
  * system it names.
445
486
  */
446
487
  checkConnection(id: string): Promise<ConnectionCheck>;
488
+ /**
489
+ * Reach an address that has not been stored, and record nothing.
490
+ *
491
+ * The reason this exists rather than a form telling somebody to save first:
492
+ * the field most likely to be wrong is the one that cannot be verified by
493
+ * reading it, and the way you would otherwise find out is a load failing on a
494
+ * schedule hours later. A connection saved to discover a typo is a row
495
+ * somebody then has to remember to delete.
496
+ *
497
+ * Asks for `catalog:write` where {@link CatalogClient.checkConnection} asks
498
+ * only for `catalog:read`, and a host wiring its own transport should know
499
+ * why: this reaches an address supplied in the request, so under the softer
500
+ * scope it is the server connecting wherever a reader of the catalog points
501
+ * it. It grants no reach a `catalog:write` holder did not already have — they
502
+ * could save, check and delete — but it leaves no rows behind, so the server
503
+ * writes what it did to its log instead.
504
+ *
505
+ * `id` on the input is what makes an EDIT testable: the server puts the stored
506
+ * credential back where the caller was only ever shown a redaction of it. A
507
+ * create sends no id, and nothing is restored — the address reached is exactly
508
+ * the one that was typed.
509
+ */
510
+ checkUnsavedConnection(input: ConnectionInput): Promise<ConnectionCheck>;
447
511
  /**
448
512
  * Which pipelines read through it. Named, so a refusal can say which.
449
513
  *
@@ -473,9 +537,10 @@ export interface CatalogClient {
473
537
  *
474
538
  * This read stays because it answers what a graph cannot answer about itself:
475
539
  * which id the run history and the incremental watermark are keyed on, and —
476
- * on a deployment upgraded rather than built fresh — which rows have not been
477
- * adopted into a workflow yet. `CatalogConnector.workflowId` is what joins one
478
- * to the graph that runs it.
540
+ * on a deployment upgraded rather than built fresh — which rows belong to no
541
+ * graph at all. Nothing turns those into workflows; they keep loading on the
542
+ * path they were already on, and this read is the only place they are visible.
543
+ * `CatalogConnector.workflowId` is what joins one to the graph that runs it.
479
544
  */
480
545
  listConnectors(): Promise<CatalogConnector[]>;
481
546
  /**
@@ -711,6 +776,15 @@ export declare const catalogQueryKeys: {
711
776
  */
712
777
  pipeline: readonly ["nestjs-catalog", "pipeline"];
713
778
  capabilities: readonly ["nestjs-catalog", "pipeline", "capabilities"];
779
+ /**
780
+ * What the live fleet announces it can execute.
781
+ *
782
+ * Its own key rather than a slice of `capabilities`, because the two are
783
+ * cached on opposite terms — `capabilities` is stale-forever and this is stale
784
+ * in about a heartbeat — and one key cannot hold two staleTimes. A host
785
+ * invalidating the whole `pipeline` prefix still reaches both.
786
+ */
787
+ callableWorkflows: readonly ["nestjs-catalog", "pipeline", "callable-workflows"];
714
788
  connections: readonly ["nestjs-catalog", "pipeline", "connections"];
715
789
  connectors: readonly ["nestjs-catalog", "pipeline", "connectors"];
716
790
  transforms: readonly ["nestjs-catalog", "pipeline", "transforms"];
package/dist/context.js CHANGED
@@ -52,9 +52,11 @@ export function CatalogProvider({ transport, pipelineBasePath = DEFAULT_PIPELINE
52
52
  listEvents: (query) => transport.get(catalogRoutes.events(), { ...query }),
53
53
  listTraces: (query) => transport.get(catalogRoutes.traces(), { ...query }),
54
54
  pipelineCapabilities: () => transport.get(pipeline.capabilities()),
55
+ listCallableWorkflows: () => transport.get(pipeline.callableWorkflows()),
55
56
  listConnections: () => transport.get(pipeline.connections()),
56
57
  saveConnection: (input) => transport.post(pipeline.connections(), input),
57
58
  checkConnection: (id) => transport.post(pipeline.checkConnection(id), {}),
59
+ checkUnsavedConnection: (input) => transport.post(pipeline.checkUnsavedConnection(), input),
58
60
  connectionWorkflows: (id) => transport.get(pipeline.connectionWorkflows(id)),
59
61
  deleteConnection: (id) => transport.delete(pipeline.connection(id)),
60
62
  listConnectors: () => transport.get(pipeline.connectors()),
@@ -167,6 +169,15 @@ export const catalogQueryKeys = {
167
169
  */
168
170
  pipeline: ['nestjs-catalog', 'pipeline'],
169
171
  capabilities: ['nestjs-catalog', 'pipeline', 'capabilities'],
172
+ /**
173
+ * What the live fleet announces it can execute.
174
+ *
175
+ * Its own key rather than a slice of `capabilities`, because the two are
176
+ * cached on opposite terms — `capabilities` is stale-forever and this is stale
177
+ * in about a heartbeat — and one key cannot hold two staleTimes. A host
178
+ * invalidating the whole `pipeline` prefix still reaches both.
179
+ */
180
+ callableWorkflows: ['nestjs-catalog', 'pipeline', 'callable-workflows'],
170
181
  connections: ['nestjs-catalog', 'pipeline', 'connections'],
171
182
  connectors: ['nestjs-catalog', 'pipeline', 'connectors'],
172
183
  transforms: ['nestjs-catalog', 'pipeline', 'transforms'],
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export { CatalogManager, type CatalogManagerProps } from './CatalogManager';
2
2
  export { CoverageLedger } from './CoverageLedger';
3
3
  export { EditableField } from './EditableField';
4
4
  export { DELETE_STRATEGIES, LoadExpectationSection, type LoadExpectationSectionProps, } from './LoadExpectationSection';
5
+ export { LoadedBySection, type LoadedBySectionProps, loadersOf, } from './LoadedBySection';
5
6
  export { cn } from './cn';
6
7
  export { ObjectExplorer, type ObjectExplorerProps } from './ObjectExplorer';
7
8
  export { DashboardBoard } from './DashboardBoard';
@@ -16,6 +17,8 @@ export { CatalogSearch, type CatalogSearchProps } from './search-console';
16
17
  export { SavedQueryPanel } from './SavedQueryPanel';
17
18
  export { CATALOG_EVENT_META, type CatalogTraceSource, eventMeta, TraceExplorer, useTraceSource, } from './TraceExplorer';
18
19
  export { ConnectionPanel, type ConnectionPanelProps, connectionOptionsFor, describeConnection, } from './ConnectionPanel';
20
+ export { CONNECTABLE_KINDS, CONNECTION_KIND_OPTIONS, CONNECTION_KINDS, type ConnectableKind, type ConnectableKindSpec, ConnectionCheckResult, type ConnectionDraft, ConnectionKindFields, type ConnectionKindSpec, type UnconnectableKindSpec, type UpdateDraft, connectableSpec, connectionConfigFor, connectionDraftFrom, connectionIsIncomplete, redactedCredentialIn, toConnectableKind, } from './connection-form';
21
+ export { SourceConnectionCreator } from './source-connection';
19
22
  export { PipelineConsole, type PipelineConsoleProps, } from './PipelineConsole';
20
23
  export { type ColumnChoice, type ConnectorSchemaDiscovery, type DiscoveredColumn, type DiscoveredTypeDraft, initialChoices, narrowDiscovery, proposalFrom, type SchemaDiscoveryBridge, SchemaDiscoveryPanel, type SchemaDrift, } from './schema-discovery';
21
24
  export { TransformEditor, type TransformEditorProps } from './TransformEditor';
@@ -26,11 +29,12 @@ export { WORKFLOW_NAME } from './workflow/name';
26
29
  export { checkShapes, type ShapeKnowledge, type SourceColumn, type SourceShape, type TargetProperty, type TargetShape, } from './workflow/shape';
27
30
  export { canConnect, type ConnectionVerdict, edgeId, hasBlockingProblem, problemsByNode, type ValidateOptions, validateWorkflow, type WorkflowDraft, type WorkflowProblem, type WorkflowProblemCode, type WorkflowProblemLevel, wouldCycle, } from './workflow/validate';
28
31
  export { attachTransformIds, buildWorkflowTemplate, type EnrichOptions, enrichWithLookup, fanOutTypes, type FanOutOptions, type FanOutTarget, FILE_DROP_KINDS, type FileDropOptions, joinSources, type JoinOptions, loadFileDrop, type PeriodicFullReloadOptions, periodicFullReload, planIsRunnable, planToWorkflowInput, refuseUnusableColumnNames, RELOAD_CADENCE_IDS, RELOAD_CADENCES, type ReloadCadence, replicateTable, type ReplicateTableOptions, SOURCE_KINDS, type TemplateDeclaration, type TemplateExpectation, type TemplateOutcome, type TemplatePlan, type TemplateRefusal, type TemplateRefusalCode, type TemplateRequest, type TemplateSchedule, type TemplateTransformRequest, withinMsFor, WORKFLOW_TEMPLATE_IDS, WORKFLOW_TEMPLATES, type WorkflowTemplateId, type WorkflowTemplateMeta, } from './workflow/templates';
29
- export { type CatalogClient, type CatalogIdentity, type CatalogRevision, type CatalogPeoplePage, type CatalogPersonRole, type CatalogPersonSummary, type CatalogPrincipalSummary, CatalogProvider, type CatalogProviderProps, type CatalogTransport, type ConnectionInput, type ConnectionUse, catalogQueryKeys, type DeleteReconciliation, type LoadExpectation, type LoadExpectationInput, type ResolvedLoadExpectation, type RowCountBound, type StoredLoadExpectation, type PersonInput, type PersonUpsertResult, type PipelineCapabilities, type ScheduledWorkflow, type TransformInput, type WorkflowRunOptions, type WorkflowScheduleInput, useCatalogClient, } from './context';
32
+ export { type CatalogClient, type CatalogIdentity, type CatalogRevision, type CatalogPeoplePage, type CatalogPersonRole, type CatalogPersonSummary, type CatalogPrincipalSummary, CatalogProvider, type CatalogProviderProps, type CatalogTransport, type ConnectionInput, type ConnectionUse, catalogQueryKeys, type DeleteReconciliation, type LoadExpectation, type LoadExpectationInput, type ResolvedLoadExpectation, type RowCountBound, type StoredLoadExpectation, type PersonInput, type PersonUpsertResult, type PipelineCapabilities, type CallableWorkflowList, type ScheduledWorkflow, type TransformInput, type WorkflowRunOptions, type WorkflowScheduleInput, useCatalogClient, } from './context';
30
33
  export { type AccessRoutes, accessRoutes, DEFAULT_ACCESS_BASE_PATH, DEFAULT_PIPELINE_BASE_PATH, DEFAULT_PUBLISH_BASE_PATH, embedRoutes, type PeopleQuery, type PipelineRoutes, pipelineRoutes, } from './routes';
31
34
  export { ConfirmDialog } from './ui/dialog';
32
35
  export { FieldGroup, TextAreaField, TextField } from './ui/field';
33
36
  export { Select, SelectField, type SelectOption } from './ui/select';
37
+ export { Combobox, ComboboxField, type ComboOption, type ComboboxProps } from './ui/combobox';
34
38
  export { Switch } from './ui/switch';
35
39
  export { Sheet } from './ui/sheet';
36
40
  export { CodeEditor, type CodeEditorHandle, type CodeEditorProps, codeEditorRoot, codeEditorText, } from './ui/code-editor';