@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.
Files changed (54) hide show
  1. package/README.md +39 -13
  2. package/dist/CatalogManager.d.ts +23 -1
  3. package/dist/CatalogManager.js +76 -13
  4. package/dist/ConnectionPanel.d.ts +11 -7
  5. package/dist/ConnectionPanel.js +78 -149
  6. package/dist/LoadedBySection.d.ts +39 -0
  7. package/dist/LoadedBySection.js +143 -0
  8. package/dist/PipelineConsole.d.ts +23 -126
  9. package/dist/PipelineConsole.js +39 -551
  10. package/dist/WorkflowCanvas.d.ts +16 -0
  11. package/dist/WorkflowCanvas.js +1064 -64
  12. package/dist/connection-form.d.ts +241 -0
  13. package/dist/connection-form.js +235 -0
  14. package/dist/context.d.ts +236 -38
  15. package/dist/context.js +46 -11
  16. package/dist/index.d.ts +10 -3
  17. package/dist/index.js +63 -14
  18. package/dist/routes.d.ts +84 -13
  19. package/dist/routes.js +7 -4
  20. package/dist/schema-discovery.d.ts +232 -0
  21. package/dist/schema-discovery.js +225 -0
  22. package/dist/source-connection.d.ts +82 -0
  23. package/dist/source-connection.js +176 -0
  24. package/dist/source-fields.d.ts +16 -14
  25. package/dist/source-fields.js +28 -18
  26. package/dist/ui/code-editor.d.ts +44 -2
  27. package/dist/ui/code-editor.js +10 -2
  28. package/dist/ui/combobox.d.ts +97 -0
  29. package/dist/ui/combobox.js +80 -0
  30. package/dist/ui/dialog.d.ts +13 -1
  31. package/dist/ui/dialog.js +13 -2
  32. package/dist/workflow/edges.d.ts +110 -0
  33. package/dist/workflow/edges.js +112 -0
  34. package/dist/workflow/graph.d.ts +39 -1
  35. package/dist/workflow/graph.js +212 -52
  36. package/dist/workflow/index.d.ts +8 -0
  37. package/dist/workflow/index.js +12 -0
  38. package/dist/workflow/lifecycle.d.ts +135 -0
  39. package/dist/workflow/lifecycle.js +216 -0
  40. package/dist/workflow/model.d.ts +17 -3
  41. package/dist/workflow/model.js +7 -2
  42. package/dist/workflow/nodes.d.ts +4 -1
  43. package/dist/workflow/nodes.js +198 -10
  44. package/dist/workflow/runs.d.ts +38 -0
  45. package/dist/workflow/runs.js +101 -0
  46. package/dist/workflow/shape.d.ts +169 -0
  47. package/dist/workflow/shape.js +249 -0
  48. package/dist/workflow/templates.d.ts +623 -0
  49. package/dist/workflow/templates.js +1102 -0
  50. package/dist/workflow/validate.d.ts +20 -1
  51. package/dist/workflow/validate.js +52 -3
  52. package/dist/workflow/wiring.d.ts +84 -0
  53. package/dist/workflow/wiring.js +254 -0
  54. package/package.json +9 -9
@@ -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
+ }