@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.
Files changed (52) hide show
  1. package/README.md +39 -13
  2. package/dist/ConnectionPanel.d.ts +11 -7
  3. package/dist/ConnectionPanel.js +65 -28
  4. package/dist/ObjectExplorer.js +424 -48
  5. package/dist/PipelineConsole.d.ts +23 -126
  6. package/dist/PipelineConsole.js +39 -551
  7. package/dist/QueryConsole.js +25 -17
  8. package/dist/SavedQueryPanel.js +1 -1
  9. package/dist/TransformEditor.js +12 -3
  10. package/dist/WorkflowCanvas.js +401 -29
  11. package/dist/bundler/index.d.ts +20 -0
  12. package/dist/bundler/index.js +20 -0
  13. package/dist/bundler/shiki-subset.d.ts +83 -0
  14. package/dist/bundler/shiki-subset.js +196 -0
  15. package/dist/context.d.ts +181 -38
  16. package/dist/context.js +44 -11
  17. package/dist/diff/RevisionDiff.d.ts +67 -4
  18. package/dist/diff/RevisionDiff.js +126 -91
  19. package/dist/index.d.ts +8 -5
  20. package/dist/index.js +56 -20
  21. package/dist/routes.d.ts +54 -13
  22. package/dist/routes.js +5 -4
  23. package/dist/schema-discovery.d.ts +216 -0
  24. package/dist/schema-discovery.js +225 -0
  25. package/dist/source-fields.d.ts +1 -12
  26. package/dist/source-fields.js +13 -16
  27. package/dist/ui/code-editor.d.ts +196 -8
  28. package/dist/ui/code-editor.js +184 -72
  29. package/dist/ui/code-languages.d.ts +80 -0
  30. package/dist/ui/code-languages.js +76 -0
  31. package/dist/ui/code-theme.d.ts +25 -0
  32. package/dist/ui/code-theme.js +26 -0
  33. package/dist/ui/dialog.d.ts +13 -1
  34. package/dist/ui/dialog.js +13 -2
  35. package/dist/workflow/graph.js +31 -9
  36. package/dist/workflow/index.d.ts +2 -0
  37. package/dist/workflow/index.js +7 -0
  38. package/dist/workflow/lifecycle.d.ts +164 -0
  39. package/dist/workflow/lifecycle.js +249 -0
  40. package/dist/workflow/model.d.ts +1 -1
  41. package/dist/workflow/nodes.js +10 -1
  42. package/dist/workflow/runs.d.ts +38 -0
  43. package/dist/workflow/runs.js +101 -0
  44. package/dist/workflow/shape.d.ts +169 -0
  45. package/dist/workflow/shape.js +249 -0
  46. package/dist/workflow/templates.d.ts +623 -0
  47. package/dist/workflow/templates.js +1092 -0
  48. package/dist/workflow/validate.d.ts +20 -1
  49. package/dist/workflow/validate.js +41 -3
  50. package/package.json +21 -17
  51. package/dist/diff/line-diff.d.ts +0 -124
  52. package/dist/diff/line-diff.js +0 -318
package/dist/index.js CHANGED
@@ -26,24 +26,34 @@ export { QueryConsole } from './QueryConsole';
26
26
  export { CatalogSearch } from './search-console';
27
27
  export { SavedQueryPanel } from './SavedQueryPanel';
28
28
  export { CATALOG_EVENT_META, eventMeta, TraceExplorer, useTraceSource, } from './TraceExplorer';
29
- // Getting data in: connections, connectors and the code that reshapes what they
30
- // fetch. These used to live in the consuming app, which meant any other host
31
- // installing this package got a console with no way to manage a load.
29
+ // Getting data in: the addresses a pipeline reads through and the code that
30
+ // reshapes what it fetches. These used to live in the consuming app, which meant
31
+ // any other host installing this package got a console with no way to manage a
32
+ // load.
33
+ //
34
+ // There is deliberately no connector screen here any more. A connector is what a
35
+ // published workflow runs as — nothing authors one — so authoring a pipeline is
36
+ // `WorkflowCanvas`, on the `/workflow` subpath, and this is the two shared
37
+ // objects it borrows.
32
38
  export { ConnectionPanel, connectionOptionsFor, describeConnection, } from './ConnectionPanel';
39
+ export { PipelineConsole, } from './PipelineConsole';
33
40
  // The schema-discovery seam, whole.
34
41
  //
35
- // `PipelineConsoleProps['schemaDiscovery']` is a bridge the HOST implements —
36
- // this package cannot ask a connector for its columns, only render the answer —
37
- // and every one of these was reachable from that prop's type and from nowhere
38
- // else. So the only way to write the bridge with its signature spelled out was
39
- // to name it through an indexed access on a component's props, or to deep-import
40
- // a file inside `dist/`. Both are the caller paying for a list that fell behind.
42
+ // `SchemaDiscoveryBridge` is a bridge a HOST may implement — this package cannot
43
+ // ask a source for its columns, only render the answer — and every one of these
44
+ // was once reachable only through an indexed access on a component's props, or
45
+ // by deep-importing a file inside `dist/`. Both are the caller paying for a list
46
+ // that fell behind.
41
47
  //
42
48
  // `initialChoices` and `proposalFrom` come with them because they are the rules
43
49
  // that decide whether a schema somebody ticked is one the publish route will
44
50
  // accept — pure and deliberately outside the panel, per their own docblocks, and
45
51
  // worth nothing there if the only way to run them is to render it.
46
- export { initialChoices, PipelineConsole, proposalFrom, } from './PipelineConsole';
52
+ //
53
+ // `SchemaDiscoveryPanel` is exported for the same reason it stopped living
54
+ // inside a screen: the canvas mounts it from behind the `/workflow` subpath, and
55
+ // a host assembling its own source inspector should be able to do the same.
56
+ export { initialChoices, narrowDiscovery, proposalFrom, SchemaDiscoveryPanel, } from './schema-discovery';
47
57
  export { TransformEditor } from './TransformEditor';
48
58
  // Why one load came out different from the last one.
49
59
  //
@@ -53,12 +63,13 @@ export { TransformEditor } from './TransformEditor';
53
63
  // comparison somewhere else: beside its own deploy log, in an approval flow, or
54
64
  // on a page this package does not ship.
55
65
  //
56
- // `diffLines` and `foldUnchanged` are pure and come with it deliberately. They
57
- // are the whole of the algorithm, they take no dependency and reach no network,
58
- // and a host that wants to render a comparison its own way should not have to
59
- // choose between this package's markup and writing an LCS.
66
+ // `diffLines` and `foldUnchanged` used to be exported alongside it, on the
67
+ // argument that a host wanting to render its own comparison should not have to
68
+ // choose between this package's markup and writing an LCS. They are gone: the
69
+ // diff is `@pierre/diffs` now, which is a peer dependency a host already has
70
+ // installed, and re-exporting a weaker second differ from here would be handing
71
+ // out an answer that can disagree with the one this screen shows.
60
72
  export { DiffBody, RevisionHistory, RevisionHistoryButton, RevisionHistorySheet, } from './diff/RevisionDiff';
61
- export { DIFF_CONTEXT_LINES, DIFF_MAX_CELLS, DIFF_MIN_FOLD, diffLines, foldUnchanged, } from './diff/line-diff';
62
73
  export { AccessConsole } from './AccessConsole';
63
74
  // The authored graph: sources wired through transforms into sinks.
64
75
  //
@@ -83,11 +94,27 @@ export { AccessConsole } from './AccessConsole';
83
94
  // and it belongs to the package that executes them. See `workflow/model.ts`.
84
95
  export { describeDurability, isWorkflowNodeKind, newLocalId, nodeName, producedTypes, WORKFLOW_NODE_ID_PATTERN, WORKFLOW_NODE_KINDS, } from './workflow/model';
85
96
  export { WORKFLOW_NAME } from './workflow/name';
86
- // Core's rules, run in the browser, plus the two questions core cannot answer:
87
- // whether a connection is legal mid-drag, and whether a node names a transform
88
- // that still exists. Exported so a host can run the same checks before it offers
89
- // a save — never so it can skip the server's, which is the authority.
97
+ // Whether what a source reads fits the type its sink writes.
98
+ //
99
+ // The canvas answers this for itself now — it holds what `discoverSourceSchema`
100
+ // returned for each source node and compares it against the snapshot it already
101
+ // reads, so there is no prop and nothing for a host to wire. These are exported
102
+ // because the comparison is pure and a host may well want it somewhere else: a
103
+ // pre-flight before a scheduled run, say. `ConnectorSchemaDiscovery` above is
104
+ // already a `SourceShape`, so that caller has one for free.
105
+ export { checkShapes, } from './workflow/shape';
106
+ // Core's rules, run in the browser, plus the questions core cannot answer:
107
+ // whether a connection is legal mid-drag, whether a node names a transform that
108
+ // still exists, and whether a source supplies the columns its sink writes.
109
+ // Exported so a host can run the same checks before it offers a save — never so
110
+ // it can skip the server's, which is the authority.
90
111
  export { canConnect, edgeId, hasBlockingProblem, problemsByNode, validateWorkflow, wouldCycle, } from './workflow/validate';
112
+ // The prefilled graphs, on this entry point rather than on `/workflow` because
113
+ // they import no React Flow: a template produces nodes, edges, transform bodies
114
+ // and expectation payloads, and a host should be able to build one — or check
115
+ // what it would decide — without installing a canvas to do it. Whether a screen
116
+ // then draws the result is the canvas's business, not the template's.
117
+ export { attachTransformIds, buildWorkflowTemplate, enrichWithLookup, fanOutTypes, FILE_DROP_KINDS, joinSources, loadFileDrop, periodicFullReload, planIsRunnable, planToWorkflowInput, refuseUnusableColumnNames, RELOAD_CADENCE_IDS, RELOAD_CADENCES, replicateTable, SOURCE_KINDS, withinMsFor, WORKFLOW_TEMPLATE_IDS, WORKFLOW_TEMPLATES, } from './workflow/templates';
91
118
  export { CatalogProvider, catalogQueryKeys, useCatalogClient, } from './context';
92
119
  // The paths behind the pipeline and access screens, exported so a host can
93
120
  // mount those endpoints wherever it likes and tell the provider where they are.
@@ -108,7 +135,16 @@ export { FieldGroup, TextAreaField, TextField } from './ui/field';
108
135
  export { Select, SelectField } from './ui/select';
109
136
  export { Switch } from './ui/switch';
110
137
  export { Sheet } from './ui/sheet';
111
- export { CodeEditor } from './ui/code-editor';
138
+ // `codeEditorRoot` and `codeEditorText` come with it because the editor renders
139
+ // into a shadow root: without them a host cannot assert on its own screen, and
140
+ // every consumer would rediscover the tag name by reading our source.
141
+ export { CodeEditor, codeEditorRoot, codeEditorText, } from './ui/code-editor';
142
+ // The grammars and themes the editor above can be given, which is a shorter list
143
+ // than Shiki's and is the reason `dist/spa` is not nine tenths grammar files. A
144
+ // host reads `CatalogCodeLanguage` off `CodeEditorProps` anyway; it is named here
145
+ // so the set can be asserted against, and so the build plugin that enforces it —
146
+ // `@dudousxd/nestjs-catalog-react/bundler` — has something to point at.
147
+ export { CATALOG_CODE_LANGUAGES, CATALOG_CODE_THEMES, TRANSFORM_HIGHLIGHTED_AS, } from './ui/code-languages';
112
148
  export { RichTextField, RichTextView, } from './ui/rich-text-field';
113
149
  export { Button } from './ui/button';
114
150
  export { Tabs, TabsList, TabsPanel, TabsTab } from './ui/tabs';
package/dist/routes.d.ts CHANGED
@@ -99,22 +99,29 @@ export interface PipelineRoutes {
99
99
  connections(): string;
100
100
  connection(id: string): string;
101
101
  checkConnection(id: string): string;
102
- /** Which connectors read through a connection. Named, so a refusal can say. */
103
- connectionConnectors(id: string): string;
104
- connectors(): string;
105
- connector(id: string): string;
106
- runConnector(id: string): string;
107
102
  /**
108
- * What the source behind a connector looks like right now.
103
+ * Which pipelines read through a connection. Named, so a refusal can say.
104
+ *
105
+ * `.../connectors` before, and the rename is the question actually being
106
+ * asked rather than a tidy-up: an operator presses this before deleting a
107
+ * connection, and what they need is the list of things that would break —
108
+ * which is a list of workflows, because a workflow is the only thing anybody
109
+ * authors and a connector's name is an implementation detail of one.
110
+ */
111
+ connectionWorkflows(id: string): string;
112
+ /**
113
+ * The internal records, read-only.
114
+ *
115
+ * **The one connector path left, and it is a `GET`.** There is no `POST`, no
116
+ * `DELETE` and no `.../run`: a connector is what a published workflow runs
117
+ * as, minted by `workflows/:id/publish` and removed with the graph. A builder
118
+ * for a route that creates one would be this package advertising a second way
119
+ * to author a pipeline, which is the thing that was removed.
109
120
  *
110
- * A read that writes nothing: it runs the connector's own configured query
111
- * with no rows asked for, and reports the columns. Here rather than on a
112
- * generic "describe this database" route because the connector is what
113
- * already holds the address, the credential reference and the statement —
114
- * a route taking those as arguments would be a way to point the server at
115
- * any database at all.
121
+ * It stays because it answers what a graph cannot answer about itself — which
122
+ * id the run history and the incremental watermark are keyed on.
116
123
  */
117
- discoverConnectorSchema(id: string): string;
124
+ connectors(): string;
118
125
  runs(): string;
119
126
  transforms(): string;
120
127
  transform(id: string): string;
@@ -146,7 +153,41 @@ export interface PipelineRoutes {
146
153
  */
147
154
  workflows(): string;
148
155
  workflow(id: string): string;
156
+ /**
157
+ * Declare a graph finished, which is also what mints the connector it runs
158
+ * as. Its own path rather than a field on the save, because publishing is a
159
+ * claim that gets checked and a check that fails owes an explanation.
160
+ */
161
+ publishWorkflow(id: string): string;
162
+ /** Back to draft. The connector keeps its id and its history, and stops. */
163
+ unpublishWorkflow(id: string): string;
164
+ /**
165
+ * Run it now. **The only run path there is** — `connectors/:id/run` is gone,
166
+ * and what it carried that this did not is `expectShrink`, which moved onto
167
+ * this one's body rather than being lost with it.
168
+ */
149
169
  runWorkflow(id: string): string;
170
+ /**
171
+ * When this graph runs, and whether it runs at all.
172
+ *
173
+ * A `PUT` of its own rather than fields on the save: a canvas autosaves, and
174
+ * a cron folded into every save a drag passes through is one a stale tab can
175
+ * silently revert.
176
+ */
177
+ workflowSchedule(id: string): string;
178
+ /**
179
+ * What the system behind one source node looks like right now. Writes nothing.
180
+ *
181
+ * `connectors/:id/discover` before. It had to move rather than be dropped —
182
+ * discovery is how a type gets its shape, and a sink cannot commit into a
183
+ * type that does not exist — and it deliberately answers on a **draft**:
184
+ * requiring a published graph would require publishing a graph whose target
185
+ * type cannot be created until it is published.
186
+ *
187
+ * Per node, not per graph, because a graph may have several sources and only
188
+ * a source has a shape to report.
189
+ */
190
+ discoverSourceSchema(id: string, nodeId: string): string;
150
191
  /**
151
192
  * Every per-type load expectation an operator has stored.
152
193
  *
package/dist/routes.js CHANGED
@@ -135,11 +135,8 @@ export function pipelineRoutes(basePath = DEFAULT_PIPELINE_BASE_PATH) {
135
135
  connections: () => `${base}/connections`,
136
136
  connection: (id) => `${base}/connections/${encodeURIComponent(id)}`,
137
137
  checkConnection: (id) => `${base}/connections/${encodeURIComponent(id)}/check`,
138
- connectionConnectors: (id) => `${base}/connections/${encodeURIComponent(id)}/connectors`,
138
+ connectionWorkflows: (id) => `${base}/connections/${encodeURIComponent(id)}/workflows`,
139
139
  connectors: () => `${base}/connectors`,
140
- connector: (id) => `${base}/connectors/${encodeURIComponent(id)}`,
141
- runConnector: (id) => `${base}/connectors/${encodeURIComponent(id)}/run`,
142
- discoverConnectorSchema: (id) => `${base}/connectors/${encodeURIComponent(id)}/discover`,
143
140
  runs: () => `${base}/runs`,
144
141
  transforms: () => `${base}/transforms`,
145
142
  transform: (id) => `${base}/transforms/${encodeURIComponent(id)}`,
@@ -147,7 +144,11 @@ export function pipelineRoutes(basePath = DEFAULT_PIPELINE_BASE_PATH) {
147
144
  tryTransform: () => `${base}/transforms/try`,
148
145
  workflows: () => `${base}/workflows`,
149
146
  workflow: (id) => `${base}/workflows/${encodeURIComponent(id)}`,
147
+ publishWorkflow: (id) => `${base}/workflows/${encodeURIComponent(id)}/publish`,
148
+ unpublishWorkflow: (id) => `${base}/workflows/${encodeURIComponent(id)}/unpublish`,
150
149
  runWorkflow: (id) => `${base}/workflows/${encodeURIComponent(id)}/run`,
150
+ workflowSchedule: (id) => `${base}/workflows/${encodeURIComponent(id)}/schedule`,
151
+ discoverSourceSchema: (id, nodeId) => `${base}/workflows/${encodeURIComponent(id)}/nodes/${encodeURIComponent(nodeId)}/discover`,
151
152
  loadExpectations: () => expectations.expectations(),
152
153
  loadExpectation: (typeName) => expectations.expectation(typeName),
153
154
  };
@@ -0,0 +1,216 @@
1
+ /**
2
+ * Asking a source what its columns are, and turning the answer into a type.
3
+ *
4
+ * ITS OWN MODULE, AND WHY
5
+ * -----------------------
6
+ * All of this used to live inside `PipelineConsole`, reached from a connector
7
+ * editor, because a connector was the thing that held an address and a query.
8
+ * It is not any more: a source node on a graph is, and the route moved with it —
9
+ * `POST connectors/:id/discover` became
10
+ * `POST workflows/:id/nodes/:nodeId/discover`. The panel therefore has to be
11
+ * mountable from the canvas, and the canvas lives behind its own entry point
12
+ * because it imports `@xyflow/react`. Left where it was, either the canvas would
13
+ * import a screen it has nothing else to do with, or there would be two copies
14
+ * of the rules that decide whether a schema somebody ticked is publishable.
15
+ *
16
+ * Nothing here imports React Flow, so both entry points can reach it.
17
+ *
18
+ * WHAT THIS SCREEN IS FOR
19
+ * -----------------------
20
+ * One thing: never letting a guess become a type. Discovery reports columns it
21
+ * could not type, and the job here is to keep those visibly out of the proposal
22
+ * until a person says what they are. A wrong type becomes a wrong column in a
23
+ * lake nobody re-checks, and everything downstream reads it as fact rather than
24
+ * as the guess it was.
25
+ */
26
+ import type { ScalarType } from '@dudousxd/nestjs-catalog/client';
27
+ /**
28
+ * How this console reaches discovery and publication.
29
+ *
30
+ * A bridge rather than two more calls made inline, because a host embedding
31
+ * these screens may route either through its own gateway — and because
32
+ * `createType` is genuinely optional: the publish route needs `catalog:write`
33
+ * and per-type ownership, and a host that has deliberately not given its console
34
+ * that has to be able to say so without the screen pretending the button is
35
+ * merely broken.
36
+ *
37
+ * `discover` takes a workflow and a node, not a connector. See
38
+ * {@link CatalogClient.discoverSourceSchema} for why the pair replaced the
39
+ * single id, and why it answers on a draft.
40
+ */
41
+ export interface SchemaDiscoveryBridge {
42
+ discover(workflowId: string, nodeId: string): Promise<ConnectorSchemaDiscovery>;
43
+ /**
44
+ * Create the type from what a person confirmed. Absent is a supported state —
45
+ * the panel does everything up to the confirmation and then prints the exact
46
+ * request it would have sent.
47
+ */
48
+ createType?(draft: DiscoveredTypeDraft): Promise<unknown>;
49
+ }
50
+ /**
51
+ * What `POST pipeline/workflows/:id/nodes/:nodeId/discover` answers, mirrored
52
+ * for the browser.
53
+ *
54
+ * Mirrored rather than imported, exactly as `PipelineCapabilities` is in
55
+ * `context.tsx`: the authority is `schema-discovery.ts` in
56
+ * `@dudousxd/nestjs-catalog-pipeline`, which is a NestJS package with a
57
+ * `node:fs` import in its dependency graph and has no business in a browser
58
+ * bundle. The two are kept honest by being the documented response of one route,
59
+ * and by this screen treating every field it renders as something the server may
60
+ * not have sent.
61
+ *
62
+ * Named after the connector still, matching the server's own name for it, and
63
+ * the FIELDS are what changed: `connectorId`/`connectorName` became
64
+ * `workflowId`/`nodeId`/`nodeName`/`kind`. A connector's own kind and config
65
+ * stopped being read the moment it gained a `workflowId`, and every connector
66
+ * has one now — so a connector id here would have named a row whose
67
+ * configuration has nothing to do with the columns underneath it. A graph can
68
+ * also have several sources, which the old pair could not express at all.
69
+ */
70
+ export interface DiscoveredColumn {
71
+ /**
72
+ * The column as the source spells it, which is also the property name. The
73
+ * server explains at length why it is not tidied: the store matches records to
74
+ * properties by property NAME, so a renamed property is a column that loads
75
+ * null on every run and reports success.
76
+ */
77
+ name: string;
78
+ /** `null` means discovery reached no conclusion — which is not a type. */
79
+ type: ScalarType | null;
80
+ confidence: 'reported' | 'inferred' | 'unknown';
81
+ sourceType: string;
82
+ /** `null` where the source did not say. Postgres never does. */
83
+ nullable: boolean | null;
84
+ note?: string;
85
+ }
86
+ export interface SchemaDrift {
87
+ added: string[];
88
+ removed: string[];
89
+ retyped: Array<{
90
+ property: string;
91
+ was: ScalarType;
92
+ now: ScalarType;
93
+ }>;
94
+ }
95
+ export interface ConnectorSchemaDiscovery {
96
+ /** The graph this node belongs to, so a report can be traced back to it. */
97
+ workflowId: string;
98
+ nodeId: string;
99
+ nodeName: string;
100
+ /** What kind of system the node reads from, as the server resolved it. */
101
+ kind: string;
102
+ /**
103
+ * The type the graph's sink commits — the graph's, not the node's, because a
104
+ * source node has none. Empty on a draft with no sink drawn yet, which reads
105
+ * back as `typeExists: false` and is the honest answer: there is nothing for
106
+ * the columns to have drifted from.
107
+ */
108
+ targetType: string;
109
+ typeExists: boolean;
110
+ basis: 'driver' | 'sample';
111
+ sampled: number;
112
+ caveat: string;
113
+ columns: DiscoveredColumn[];
114
+ drift: SchemaDrift | null;
115
+ }
116
+ /**
117
+ * The discovery response, checked rather than assumed.
118
+ *
119
+ * The client returns `unknown` because this package must not import
120
+ * `@dudousxd/nestjs-catalog-pipeline` — it would drag database drivers behind
121
+ * optional imports into a browser bundle — so the shape above is a mirror of a
122
+ * contract held somewhere else. A mirror can fall behind: a console talking to
123
+ * an older server gets a body with no `columns`, and rendering it would throw
124
+ * somewhere deep in the table with a message about `undefined.map`.
125
+ *
126
+ * Checked at the seam, once, so the failure names itself. Only the fields this
127
+ * screen would crash without — validating every column here would be
128
+ * re-implementing the server's own shape in a place that cannot be kept honest.
129
+ */
130
+ export declare function narrowDiscovery(answer: unknown): ConnectorSchemaDiscovery;
131
+ /** The subset of a published type this screen is able to state. */
132
+ export interface DiscoveredTypeDraft {
133
+ name: string;
134
+ properties: Array<{
135
+ name: string;
136
+ columnName: string;
137
+ type: ScalarType;
138
+ nullable: boolean;
139
+ }>;
140
+ }
141
+ /** What a person decided about one discovered column. */
142
+ export interface ColumnChoice {
143
+ include: boolean;
144
+ /** Empty means nothing has been chosen yet — see {@link initialChoices}. */
145
+ type: ScalarType | '';
146
+ }
147
+ /**
148
+ * Where the checkboxes start, and why the untyped ones start off.
149
+ *
150
+ * A column discovery could type is proposed; a column it could not is present,
151
+ * visible, and **excluded** until somebody says what it is. Pre-selecting it
152
+ * with a plausible default is the failure that matters — a wrong type becomes a
153
+ * wrong column in a lake nobody re-checks, and everything downstream reads it
154
+ * as fact rather than as the guess it was.
155
+ *
156
+ * Keyed by position rather than by name on purpose: `SELECT a.id, b.id` gives
157
+ * two columns called `id`, and a map would silently merge their choices.
158
+ */
159
+ export declare function initialChoices(columns: DiscoveredColumn[]): ColumnChoice[];
160
+ /**
161
+ * The type this would create, and everything standing in the way of creating it.
162
+ *
163
+ * Pure, and separate from the panel, because these are the rules that decide
164
+ * whether a schema somebody approved is one the publish route will accept — and
165
+ * rules that live inside a component are rules only a rendered DOM can check.
166
+ *
167
+ * `columnName` is sent as well as `name`, and they are the same string. The
168
+ * publish service maps `columnName` to `sourceColumn` and `name` to the property
169
+ * itself, and the store reads records by property name; sending them equal is
170
+ * what makes a load match. See the server's `DiscoveredColumn.name`.
171
+ */
172
+ export declare function proposalFrom(discovery: ConnectorSchemaDiscovery, choices: ColumnChoice[]): {
173
+ draft: DiscoveredTypeDraft;
174
+ problems: string[];
175
+ };
176
+ /**
177
+ * What the source looks like, offered to the person who has to name it.
178
+ *
179
+ * Only for a source node on a SAVED graph, and deliberately not only on a
180
+ * published one. Discovery reads the stored node, so there is nothing to read
181
+ * from a canvas nobody has saved — but requiring a published graph would be
182
+ * circular: a sink cannot commit into a type that does not exist, so the type
183
+ * has to be creatable before the graph is declared finished. `disabledReason`
184
+ * is how the caller states which of those two it is; a panel that simply hid
185
+ * itself would leave somebody hunting for a button that used to be there.
186
+ *
187
+ * The screen's job is to make the difference between what was *reported* and
188
+ * what was *inferred* impossible to miss, because that difference is the whole
189
+ * value of the report. A driver describing a `NUMERIC` column is the database
190
+ * speaking; forty records that all happened to hold a string is a sample, and
191
+ * the forty-first is where somebody finds out.
192
+ */
193
+ export declare function SchemaDiscoveryPanel({ workflowId, nodeId, bridge, disabledReason, onDiscovered, }: {
194
+ workflowId: string;
195
+ nodeId: string;
196
+ bridge: SchemaDiscoveryBridge;
197
+ /** Why the button cannot be pressed, said out loud. Absent means it can. */
198
+ disabledReason?: string;
199
+ /**
200
+ * Told to whoever mounted this, because the answer outlives the panel.
201
+ *
202
+ * This component holds the report in state, and the canvas unmounts it the
203
+ * moment the inspector closes — so the columns a person just read would be
204
+ * gone by the time they looked at the problems rail, which is the one place
205
+ * the same answer has anything else to say. The canvas keeps them per node
206
+ * and hands them to `validateWorkflow`; see `workflow/shape.ts`.
207
+ *
208
+ * A callback rather than a query the canvas fires itself, because discovery
209
+ * is a **read of a live source** behind a `POST`: opening a graph with four
210
+ * source nodes must not open four database connections nobody asked for. The
211
+ * shape check is therefore answered exactly where somebody asked the
212
+ * question, and stays silent everywhere else — which is what that module is
213
+ * written around.
214
+ */
215
+ onDiscovered?: (nodeId: string, discovery: ConnectorSchemaDiscovery) => void;
216
+ }): import("react/jsx-runtime").JSX.Element;