@dudousxd/nestjs-catalog-react 0.28.0 → 0.29.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.
@@ -2133,6 +2133,9 @@ function Canvas({ title = WORKFLOW_NAME.titlePlural, eyebrow = 'Ingestion', intr
2133
2133
  useUndoShortcut({ enabled: canEdit, onUndo: undo, onSay: setAnnouncement });
2134
2134
  useUnsavedGuard(draft.dirty);
2135
2135
  const durability = describeDurability(capabilities?.durable);
2136
+ // Threaded to the source inspector rather than read there, so the one query
2137
+ // for `capabilities` serves both the canvas banner and the disk picker.
2138
+ const storage = capabilities?.storage;
2136
2139
  // Asked about EVERY problem, not about `live`. This is the guarantee: a graph
2137
2140
  // that would silently do nothing is coloured as unsaveable from the moment it
2138
2141
  // becomes one, whether or not the node responsible is still being worked on.
@@ -2333,7 +2336,7 @@ function Canvas({ title = WORKFLOW_NAME.titlePlural, eyebrow = 'Ingestion', intr
2333
2336
  }, onDisconnect: disconnect, onOpenMenu: openMenuFor, wiring: wiring, wiringRefusal: wiringRefusal, nodeMenu: _jsx(NodeActionsToolbar, { node: menu.anchor, canEdit: canEdit, open: menu.open, sections: toolbarSections, deleteHint: deleteHint(menu.anchor, draft, stored), onOpenChange: menu.onOpenChange, onHoverChange: menu.onHoverChange, onDelete: () => {
2334
2337
  dropNodes(idsOf(menu.anchor));
2335
2338
  menu.reset();
2336
- } }), fitPadding: fitPadding }), _jsx(CanvasContextMenu, { opening: contextMenu, sections: contextSections, label: contextLabel, onClose: forgetMenu }), workflows.isSuccess && workflows.data.length === 0 && _jsx(NothingDrawnYet, {}), _jsx("output", { "aria-live": "polite", className: "sr-only", children: announcement }), _jsx(NodeInspector, { node: inspectingNode, draft: draft, transforms: transforms, connections: connections, typeOptions: typeOptions, canEdit: canEdit, modelHref: modelHref, problems: problemsOf(problemsFor, inspectingNode), pending: problemsOf(pendingFor, inspectingNode), discovery: discovery, discoverable: { ...discoveryTarget(draft), onSave: saveNow, saving: save.isPending }, onDiscovered: rememberShape, onClose: () => setInspecting(null), onChange: (next) => {
2339
+ } }), fitPadding: fitPadding }), _jsx(CanvasContextMenu, { opening: contextMenu, sections: contextSections, label: contextLabel, onClose: forgetMenu }), workflows.isSuccess && workflows.data.length === 0 && _jsx(NothingDrawnYet, {}), _jsx("output", { "aria-live": "polite", className: "sr-only", children: announcement }), _jsx(NodeInspector, { node: inspectingNode, draft: draft, transforms: transforms, connections: connections, storage: storage, typeOptions: typeOptions, canEdit: canEdit, modelHref: modelHref, problems: problemsOf(problemsFor, inspectingNode), pending: problemsOf(pendingFor, inspectingNode), discovery: discovery, discoverable: { ...discoveryTarget(draft), onSave: saveNow, saving: save.isPending }, onDiscovered: rememberShape, onClose: () => setInspecting(null), onChange: (next) => {
2337
2340
  // Editing any field is the clearest statement there is that somebody
2338
2341
  // is working on this node rather than looking at one they just made.
2339
2342
  markStarted(next.id);
@@ -3754,7 +3757,7 @@ function parseConfigText(text) {
3754
3757
  * a kind added without a branch here shows up as a node with a name and nothing
3755
3758
  * to configure, which is visible on the screen rather than silent.
3756
3759
  */
3757
- function KindInspector({ node, graph, transforms, connections, typeOptions, canEdit, modelHref, discovery, discoverable, onDiscovered, onChange, onEditCode, onCreateTransform, creatingTransform, createTransformError, }) {
3760
+ function KindInspector({ node, graph, transforms, connections, storage, typeOptions, canEdit, modelHref, discovery, discoverable, onDiscovered, onChange, onEditCode, onCreateTransform, creatingTransform, createTransformError, }) {
3758
3761
  if (node.kind === 'transform') {
3759
3762
  return (_jsx(TransformInspector, { node: node, transforms: transforms, canEdit: canEdit, creating: creatingTransform, createError: createTransformError, onChange: onChange, onEditCode: onEditCode, onCreate: onCreateTransform }));
3760
3763
  }
@@ -3763,7 +3766,7 @@ function KindInspector({ node, graph, transforms, connections, typeOptions, canE
3763
3766
  // Keyed so the text fields reset when a different source is opened.
3764
3767
  // Without it the draft state would survive the swap and one node's URL
3765
3768
  // would appear inside another.
3766
- , { node: node, connections: connections, canEdit: canEdit, discovery: discovery, discoverable: discoverable, onDiscovered: onDiscovered, onChange: onChange }, node.id));
3769
+ , { node: node, connections: connections, storage: storage, canEdit: canEdit, discovery: discovery, discoverable: discoverable, onDiscovered: onDiscovered, onChange: onChange }, node.id));
3767
3770
  }
3768
3771
  if (node.kind === 'call') {
3769
3772
  // Keyed for the same reason the source inspector is: the parameter box
@@ -3797,7 +3800,7 @@ function KindInspector({ node, graph, transforms, connections, typeOptions, canE
3797
3800
  // with a name and nothing to configure". It no longer can.
3798
3801
  return unreachableNodeKind(node, 'KindInspector');
3799
3802
  }
3800
- function NodeInspector({ node, draft, transforms, connections, typeOptions, canEdit, modelHref, problems, pending, discovery, discoverable, onDiscovered, onClose, onChange, onConnect, onConnectToNew, onDisconnect, onBranch, onDelete, onEditCode, onCreateTransform, creatingTransform, createTransformError, }) {
3803
+ function NodeInspector({ node, draft, transforms, connections, storage, typeOptions, canEdit, modelHref, problems, pending, discovery, discoverable, onDiscovered, onClose, onChange, onConnect, onConnectToNew, onDisconnect, onBranch, onDelete, onEditCode, onCreateTransform, creatingTransform, createTransformError, }) {
3801
3804
  const [pendingTarget, setPendingTarget] = useState('');
3802
3805
  const label = (id) => {
3803
3806
  const found = draft.nodes.find((n) => n.id === id);
@@ -3838,7 +3841,7 @@ function NodeInspector({ node, draft, transforms, connections, typeOptions, canE
3838
3841
  return (_jsx(Sheet, { open: node !== null, onOpenChange: (open) => {
3839
3842
  if (!open)
3840
3843
  onClose();
3841
- }, title: node ? nodeName(node) : '', description: node ? `${node.kind} node` : undefined, children: node && (_jsxs("div", { className: "space-y-4", children: [problems.length > 0 && (_jsx("ul", { className: "space-y-1.5 rounded-md border border-red-200 bg-red-50 p-2 dark:border-red-900 dark:bg-red-950/40", children: problems.map((problem) => (_jsx("li", { className: "text-[11px] leading-relaxed text-red-700 dark:text-red-300", children: problem.message }, problem.code))) })), pending.length > 0 && (_jsxs("div", { className: cn('rounded-md border p-2', RULE), children: [_jsx("p", { className: cn('font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: "Still to do" }), _jsx("ul", { className: "mt-1 space-y-0.5", children: pending.map((problem) => (_jsx("li", { className: "text-[11px] leading-relaxed", children: todoFor(problem) }, problem.code))) })] })), _jsx(TextField, { label: "Name", value: node.name, onChange: (name) => onChange({ ...node, name }), placeholder: node.kind, disabled: !canEdit, hint: "What it is called on the canvas and in the wiring list. Renaming it does not change what the graph does, so it does not bump the version." }), _jsx(KindInspector, { node: node, graph: draft, transforms: transforms, connections: connections, typeOptions: typeOptions, canEdit: canEdit, modelHref: modelHref, discovery: discovery, discoverable: discoverable, onDiscovered: onDiscovered, onChange: onChange, onEditCode: onEditCode, onCreateTransform: onCreateTransform, creatingTransform: creatingTransform, createTransformError: createTransformError }), _jsx(WiringList, { title: "Fed by", edges: incoming, otherEnd: (edge) => label(edge.from), describeRemoval: (name) => `Stop ${name} feeding this node`, canEdit: canEdit, onDisconnect: onDisconnect, children: incoming.length > 1 && (_jsx("p", { className: cn('mt-1 text-[11px] leading-relaxed', MUTED), children: "Inputs arrive in this order, and the order is part of what the graph produces \u2014 a transform joining two feeds sees them exactly like this." })) }), _jsxs(WiringList, { title: "Feeds", edges: outgoing, otherEnd: (edge) => label(edge.to), describeRemoval: (name) => `Stop this node feeding ${name}`, canEdit: canEdit, onDisconnect: onDisconnect,
3844
+ }, title: node ? nodeName(node) : '', description: node ? `${node.kind} node` : undefined, children: node && (_jsxs("div", { className: "space-y-4", children: [problems.length > 0 && (_jsx("ul", { className: "space-y-1.5 rounded-md border border-red-200 bg-red-50 p-2 dark:border-red-900 dark:bg-red-950/40", children: problems.map((problem) => (_jsx("li", { className: "text-[11px] leading-relaxed text-red-700 dark:text-red-300", children: problem.message }, problem.code))) })), pending.length > 0 && (_jsxs("div", { className: cn('rounded-md border p-2', RULE), children: [_jsx("p", { className: cn('font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: "Still to do" }), _jsx("ul", { className: "mt-1 space-y-0.5", children: pending.map((problem) => (_jsx("li", { className: "text-[11px] leading-relaxed", children: todoFor(problem) }, problem.code))) })] })), _jsx(TextField, { label: "Name", value: node.name, onChange: (name) => onChange({ ...node, name }), placeholder: node.kind, disabled: !canEdit, hint: "What it is called on the canvas and in the wiring list. Renaming it does not change what the graph does, so it does not bump the version." }), _jsx(KindInspector, { node: node, graph: draft, transforms: transforms, connections: connections, storage: storage, typeOptions: typeOptions, canEdit: canEdit, modelHref: modelHref, discovery: discovery, discoverable: discoverable, onDiscovered: onDiscovered, onChange: onChange, onEditCode: onEditCode, onCreateTransform: onCreateTransform, creatingTransform: creatingTransform, createTransformError: createTransformError }), _jsx(WiringList, { title: "Fed by", edges: incoming, otherEnd: (edge) => label(edge.from), describeRemoval: (name) => `Stop ${name} feeding this node`, canEdit: canEdit, onDisconnect: onDisconnect, children: incoming.length > 1 && (_jsx("p", { className: cn('mt-1 text-[11px] leading-relaxed', MUTED), children: "Inputs arrive in this order, and the order is part of what the graph produces \u2014 a transform joining two feeds sees them exactly like this." })) }), _jsxs(WiringList, { title: "Feeds", edges: outgoing, otherEnd: (edge) => label(edge.to), describeRemoval: (name) => `Stop this node feeding ${name}`, canEdit: canEdit, onDisconnect: onDisconnect,
3842
3845
  // Only a gate's wires have a side to be on. `validateWorkflow`
3843
3846
  // refuses a label on any other wire, so offering the control there
3844
3847
  // would be offering a change the server will not take.
@@ -3869,7 +3872,7 @@ function NodeInspector({ node, draft, transforms, connections, typeOptions, canE
3869
3872
  * rather than read back out of the node. Re-deriving them from the stored config
3870
3873
  * would make a half-typed number disappear the moment it stopped parsing.
3871
3874
  */
3872
- function SourceInspector({ node, connections, canEdit, discovery, discoverable, onDiscovered, onChange, }) {
3875
+ function SourceInspector({ node, connections, storage, canEdit, discovery, discoverable, onDiscovered, onChange, }) {
3873
3876
  const [source, setSource] = useState(() => sourceDraftFrom(node.config));
3874
3877
  const kind = toConnectorKind(node.sourceKind ?? 'http');
3875
3878
  const options = connectionOptionsFor(kind, connections);
@@ -3919,5 +3922,5 @@ function SourceInspector({ node, connections, canEdit, discovery, discoverable,
3919
3922
  ? 'No connections of this kind yet. One is worth making when a second source needs the same address.'
3920
3923
  : viaConnection
3921
3924
  ? 'The connection supplies the address and the credential. What stays below is only what is specific to this load.'
3922
- : undefined }), _jsx(SourceConnectionCreator, { kind: kind, canEdit: canEdit, hasOptions: options.length > 0, onCreated: (connection) => push(source, { connectionId: connection.id }) })] })), _jsx(SourceFields, { kind: kind, draft: source, onChange: update, viaConnection: viaConnection, disabled: !canEdit }), _jsx(ReadModeFields, { kind: kind, mode: mode, onModeChange: (next) => push(source, { mode: next }), draft: source, onChange: update, disabled: !canEdit }), incremental && (_jsx("p", { className: cn('text-[11px] leading-relaxed', MUTED), children: "A watermark is kept per node, so two sources in the same graph reading incrementally do not overwrite each other's position." })), _jsx(SchemaDiscoveryPanel, { workflowId: discoverable.workflowId ?? '', nodeId: node.id, bridge: discovery, onDiscovered: onDiscovered, onSave: discoverable.onSave, saving: discoverable.saving, ...(discoverable.workflowId === undefined ? { disabledReason: discoverable.because } : {}) })] }));
3925
+ : undefined }), _jsx(SourceConnectionCreator, { kind: kind, canEdit: canEdit, hasOptions: options.length > 0, onCreated: (connection) => push(source, { connectionId: connection.id }) })] })), _jsx(SourceFields, { kind: kind, draft: source, onChange: update, viaConnection: viaConnection, disabled: !canEdit, storage: storage }), _jsx(ReadModeFields, { kind: kind, mode: mode, onModeChange: (next) => push(source, { mode: next }), draft: source, onChange: update, disabled: !canEdit }), incremental && (_jsx("p", { className: cn('text-[11px] leading-relaxed', MUTED), children: "A watermark is kept per node, so two sources in the same graph reading incrementally do not overwrite each other's position." })), _jsx(SchemaDiscoveryPanel, { workflowId: discoverable.workflowId ?? '', nodeId: node.id, bridge: discovery, onDiscovered: onDiscovered, onSave: discoverable.onSave, saving: discoverable.saving, ...(discoverable.workflowId === undefined ? { disabledReason: discoverable.because } : {}) })] }));
3923
3926
  }
package/dist/context.d.ts CHANGED
@@ -2,7 +2,7 @@ import type { CallableWorkflowRef, CatalogAuditEvent, CatalogConnection, Catalog
2
2
  import { type ReactNode } from 'react';
3
3
  import type { EmbeddedChartPayload, EmbeddedDashboardPayload } from './embed/payload';
4
4
  import { type PeopleQuery } from './routes';
5
- import type { CatalogWorkflow, CatalogWorkflowRelease, WorkflowDurability, WorkflowInput, WorkflowRun } from './workflow/model';
5
+ import type { CatalogWorkflow, CatalogWorkflowRelease, StorageAvailability, WorkflowDurability, WorkflowInput, WorkflowRun } from './workflow/model';
6
6
  /**
7
7
  * How these screens talk to the server.
8
8
  *
@@ -76,6 +76,17 @@ export interface PipelineCapabilities {
76
76
  * engine — is the exact promise this project keeps having to remove.
77
77
  */
78
78
  durable?: WorkflowDurability;
79
+ /**
80
+ * Whether a connector here may name a media disk instead of carrying its own
81
+ * bucket and credential.
82
+ *
83
+ * Optional for the same reason `durable` is, and absent is the same third
84
+ * answer: a server older than this field has not been asked. The console must
85
+ * not render "no disks" over it — the two look identical to somebody who has
86
+ * never seen the field, and the first invites them to go and configure a disk
87
+ * that will never appear.
88
+ */
89
+ storage?: StorageAvailability;
79
90
  }
80
91
  /**
81
92
  * What a call node could be pointed at, and whether the question was answerable.
package/dist/index.d.ts CHANGED
@@ -24,7 +24,7 @@ export { type ColumnChoice, type ConnectorSchemaDiscovery, type DiscoveredColumn
24
24
  export { TransformEditor, type TransformEditorProps } from './TransformEditor';
25
25
  export { DiffBody, RevisionHistory, type RevisionHistoryProps, RevisionHistoryButton, RevisionHistorySheet, type RevisionHistorySheetProps, type RevisionSubject, type RevisionSubjectKind, } from './diff/RevisionDiff';
26
26
  export { AccessConsole, type AccessConsoleProps } from './AccessConsole';
27
- export { type CallableWorkflowRef, type CatalogWorkflow, describeDurability, type DurabilityCopy, isWorkflowNodeKind, newLocalId, nodeName, producedTypes, WORKFLOW_NODE_ID_PATTERN, WORKFLOW_NODE_KINDS, type WorkflowCallNode, type WorkflowDurability, type WorkflowEdge, type WorkflowGraph, type WorkflowInput, type WorkflowNode, type WorkflowNodeKind, type WorkflowRun, type WorkflowRunNode, type WorkflowSinkNode, type WorkflowSourceNode, type WorkflowTransformNode, } from './workflow/model';
27
+ export { type CallableWorkflowRef, type CatalogWorkflow, describeDurability, describeStorage, type DurabilityCopy, isWorkflowNodeKind, newLocalId, nodeName, producedTypes, type StorageAvailability, type StorageCopy, WORKFLOW_NODE_ID_PATTERN, WORKFLOW_NODE_KINDS, type WorkflowCallNode, type WorkflowDurability, type WorkflowEdge, type WorkflowGraph, type WorkflowInput, type WorkflowNode, type WorkflowNodeKind, type WorkflowRun, type WorkflowRunNode, type WorkflowSinkNode, type WorkflowSourceNode, type WorkflowTransformNode, } from './workflow/model';
28
28
  export { WORKFLOW_NAME } from './workflow/name';
29
29
  export { checkShapes, type ShapeKnowledge, type SourceColumn, type SourceShape, type TargetProperty, type TargetShape, } from './workflow/shape';
30
30
  export { canConnect, type ConnectionVerdict, edgeId, hasBlockingProblem, problemsByNode, type ValidateOptions, validateWorkflow, type WorkflowDraft, type WorkflowProblem, type WorkflowProblemCode, type WorkflowProblemLevel, wouldCycle, } from './workflow/validate';
package/dist/index.js CHANGED
@@ -114,7 +114,7 @@ export { AccessConsole } from './AccessConsole';
114
114
  // Most of what follows is re-exported from `@dudousxd/nestjs-catalog/client`
115
115
  // rather than declared here — a node, an edge and a graph have one definition,
116
116
  // and it belongs to the package that executes them. See `workflow/model.ts`.
117
- export { describeDurability, isWorkflowNodeKind, newLocalId, nodeName, producedTypes, WORKFLOW_NODE_ID_PATTERN, WORKFLOW_NODE_KINDS, } from './workflow/model';
117
+ export { describeDurability, describeStorage, isWorkflowNodeKind, newLocalId, nodeName, producedTypes, WORKFLOW_NODE_ID_PATTERN, WORKFLOW_NODE_KINDS, } from './workflow/model';
118
118
  export { WORKFLOW_NAME } from './workflow/name';
119
119
  // Whether what a source reads fits the type its sink writes.
120
120
  //
@@ -1,5 +1,6 @@
1
1
  import type { ConnectorKind } from '@dudousxd/nestjs-catalog/client';
2
2
  import { type ConnectableKind } from './connection-form';
3
+ import { type StorageAvailability } from './workflow/model';
3
4
  /** A select hands back a string. Narrow it rather than promise it is a kind. */
4
5
  export declare function toConnectorKind(value: string): ConnectorKind;
5
6
  /** The sources that can be asked what changed. The rest always read it all. */
@@ -62,6 +63,8 @@ export interface SourceDraft {
62
63
  format: string;
63
64
  records: string;
64
65
  bucket: string;
66
+ /** A named media disk, which stands in for the bucket AND the credential. */
67
+ disk: string;
65
68
  prefix: string;
66
69
  suffix: string;
67
70
  endpoint: string;
@@ -100,19 +103,19 @@ export interface SourceConfigOptions {
100
103
  * stale url on a SQL source, which reads as configuration somebody meant.
101
104
  */
102
105
  export declare function sourceConfigFrom(kind: ConnectorKind, draft: SourceDraft, { viaConnection, incremental }: SourceConfigOptions): Record<string, unknown>;
103
- /**
104
- * The address fields for one kind.
105
- *
106
- * Rendered by both the connector form and the workflow source inspector, which
107
- * is the entire point of this module: the two screens configure the same thing
108
- * and there is exactly one description of what that thing needs.
109
- */
110
- export declare function SourceFields({ kind, draft, onChange, viaConnection, disabled, }: {
106
+ export declare function SourceFields({ kind, draft, onChange, viaConnection, disabled, storage, }: {
111
107
  kind: ConnectorKind;
112
108
  draft: SourceDraft;
113
109
  onChange: (draft: SourceDraft) => void;
114
110
  viaConnection: boolean;
115
111
  disabled?: boolean;
112
+ /**
113
+ * What this deployment says about naming a media disk.
114
+ *
115
+ * Optional, and absent is a third answer rather than "no" — see
116
+ * {@link describeStorage}, which is what renders it.
117
+ */
118
+ storage?: StorageAvailability;
116
119
  }): import("react/jsx-runtime").JSX.Element;
117
120
  /** Full or incremental, with the per-kind explanation of what that means. */
118
121
  export declare function ReadModeFields({ kind, mode, onModeChange, draft, onChange, disabled, }: {
@@ -5,6 +5,7 @@ import { CONNECTION_KINDS } from './connection-form';
5
5
  import { FieldGroup, TextAreaField, TextField } from './ui/field';
6
6
  import { SelectField } from './ui/select';
7
7
  import { Switch } from './ui/switch';
8
+ import { describeStorage } from './workflow/model';
8
9
  /**
9
10
  * Describing where records are read from, in one place.
10
11
  *
@@ -108,6 +109,7 @@ export function sourceDraftFrom(config) {
108
109
  format: text('format'),
109
110
  records: Array.isArray(records) && records.length > 0 ? JSON.stringify(records, null, 2) : '',
110
111
  bucket: text('bucket'),
112
+ disk: text('disk'),
111
113
  prefix: text('prefix'),
112
114
  suffix: text('suffix'),
113
115
  endpoint: text('endpoint'),
@@ -163,17 +165,30 @@ function fileConfig(draft) {
163
165
  ...(draft.format ? { format: draft.format } : {}),
164
166
  };
165
167
  }
168
+ /**
169
+ * Where the objects are, which is one of three answers and never two.
170
+ *
171
+ * A connection supplies it, or a disk does, or the fields below do. They are
172
+ * mutually exclusive on purpose: writing a bucket beside a disk would store two
173
+ * answers to one question and leave whoever reads it back to guess which won.
174
+ */
175
+ function s3Address(draft, viaConnection) {
176
+ if (viaConnection)
177
+ return {};
178
+ // A disk carries the bucket, the endpoint, the region AND the credential.
179
+ if (draft.disk)
180
+ return { disk: draft.disk };
181
+ return {
182
+ bucket: draft.bucket,
183
+ ...(draft.endpoint ? { endpoint: draft.endpoint } : {}),
184
+ ...(draft.region ? { region: draft.region } : {}),
185
+ ...(draft.forcePathStyle ? { forcePathStyle: true } : {}),
186
+ };
187
+ }
166
188
  /** Bucket and addressing, which a connection can supply, then the per-load narrowing. */
167
189
  function s3Config(draft, viaConnection) {
168
190
  return {
169
- ...(viaConnection
170
- ? {}
171
- : {
172
- bucket: draft.bucket,
173
- ...(draft.endpoint ? { endpoint: draft.endpoint } : {}),
174
- ...(draft.region ? { region: draft.region } : {}),
175
- ...(draft.forcePathStyle ? { forcePathStyle: true } : {}),
176
- }),
191
+ ...s3Address(draft, viaConnection),
177
192
  ...(draft.prefix ? { prefix: draft.prefix } : {}),
178
193
  ...(draft.suffix ? { suffix: draft.suffix } : {}),
179
194
  ...(draft.format ? { format: draft.format } : {}),
@@ -230,7 +245,15 @@ export function sourceConfigFrom(kind, draft, { viaConnection, incremental }) {
230
245
  * is the entire point of this module: the two screens configure the same thing
231
246
  * and there is exactly one description of what that thing needs.
232
247
  */
233
- export function SourceFields({ kind, draft, onChange, viaConnection, disabled, }) {
248
+ /**
249
+ * The blank option's value, which cannot be the empty string.
250
+ *
251
+ * A select whose option value is `''` is indistinguishable from an unset select
252
+ * to the underlying primitive, so the "no disk" choice carries a sentinel and is
253
+ * mapped back to `''` on the way into the draft.
254
+ */
255
+ const NO_DISK = '__no_disk__';
256
+ export function SourceFields({ kind, draft, onChange, viaConnection, disabled, storage, }) {
234
257
  const set = (patch) => onChange({ ...draft, ...patch });
235
258
  if (kind === 'http') {
236
259
  return (_jsxs("div", { className: "grid gap-3 sm:grid-cols-2", children: [!viaConnection && (_jsx(TextField, { label: "URL", value: draft.url, onChange: (url) => set({ url }), placeholder: "https://\u2026", disabled: disabled })), _jsx(TextField, { label: "Path to the array", value: draft.path, onChange: (path) => set({ path }), placeholder: "e.g. data", disabled: disabled })] }));
@@ -242,7 +265,16 @@ export function SourceFields({ kind, draft, onChange, viaConnection, disabled, }
242
265
  return (_jsxs("div", { className: "grid gap-3 sm:grid-cols-2", children: [_jsx(TextField, { label: "File path or URL", value: draft.path, onChange: (path) => set({ path }), placeholder: "/data/drop.csv or https://\u2026", disabled: disabled }), _jsx(SelectField, { label: "Format", ariaLabel: "Format", value: draft.format, onValueChange: (format) => set({ format }), options: FORMAT_OPTIONS, disabled: disabled })] }));
243
266
  }
244
267
  if (kind === 's3') {
245
- return (_jsxs("div", { className: "space-y-3", children: [!viaConnection && (_jsxs("div", { className: "grid gap-3 sm:grid-cols-2", children: [_jsx(TextField, { label: "Bucket", value: draft.bucket, onChange: (bucket) => set({ bucket }), placeholder: "fleet-drops", disabled: disabled }), _jsx(TextField, { label: "Region", value: draft.region, onChange: (region) => set({ region }), placeholder: "Blank uses the environment's", disabled: disabled }), _jsx(TextField, { label: "Endpoint", value: draft.endpoint, onChange: (endpoint) => set({ endpoint }), placeholder: "MinIO, e.g. http://localhost:9000", disabled: disabled })] })), _jsxs("div", { className: "grid gap-3 sm:grid-cols-3", children: [_jsx(TextField, { label: "Prefix", value: draft.prefix, onChange: (prefix) => set({ prefix }), placeholder: "drops/mvr/", disabled: disabled }), _jsx(TextField, { label: "Only keys ending in", value: draft.suffix, onChange: (suffix) => set({ suffix }), placeholder: ".csv", disabled: disabled }), _jsx(TextField, { label: "Max objects per run", value: draft.maxObjectsPerRun, onChange: (maxObjectsPerRun) => set({ maxObjectsPerRun }), inputMode: "numeric", disabled: disabled })] }), _jsx(SelectField, { label: "Format", ariaLabel: "Format", value: draft.format, onValueChange: (format) => set({ format }), options: KEY_FORMAT_OPTIONS, disabled: disabled }), !viaConnection && (_jsx(Switch, { checked: draft.forcePathStyle, onCheckedChange: (forcePathStyle) => set({ forcePathStyle }), label: "Path-style addressing", hint: "MinIO needs it; AWS does not." }))] }));
268
+ const disks = describeStorage(storage);
269
+ const named = draft.disk.trim().length > 0;
270
+ return (_jsxs("div", { className: "space-y-3", children: [!viaConnection && (_jsx("div", { className: "space-y-2", children: storage?.available && storage.disks.length > 0 ? (_jsx(SelectField, { label: "Read through a disk", ariaLabel: "Media disk", value: draft.disk || NO_DISK, onValueChange: (value) => set({ disk: value === NO_DISK ? '' : value }), options: [
271
+ {
272
+ value: NO_DISK,
273
+ label: 'Configure the bucket here',
274
+ hint: 'This source alone',
275
+ },
276
+ ...storage.disks.map((name) => ({ value: name, label: name })),
277
+ ], disabled: disabled, hint: disks.detail })) : (_jsx("p", { className: "text-xs text-zinc-500 dark:text-zinc-400", "data-testid": "source-storage-detail", children: disks.detail })) })), !viaConnection && !named && (_jsxs("div", { className: "grid gap-3 sm:grid-cols-2", children: [_jsx(TextField, { label: "Bucket", value: draft.bucket, onChange: (bucket) => set({ bucket }), placeholder: "fleet-drops", disabled: disabled }), _jsx(TextField, { label: "Region", value: draft.region, onChange: (region) => set({ region }), placeholder: "Blank uses the environment's", disabled: disabled }), _jsx(TextField, { label: "Endpoint", value: draft.endpoint, onChange: (endpoint) => set({ endpoint }), placeholder: "MinIO, e.g. http://localhost:9000", disabled: disabled })] })), _jsxs("div", { className: "grid gap-3 sm:grid-cols-3", children: [_jsx(TextField, { label: "Prefix", value: draft.prefix, onChange: (prefix) => set({ prefix }), placeholder: "drops/mvr/", disabled: disabled }), _jsx(TextField, { label: "Only keys ending in", value: draft.suffix, onChange: (suffix) => set({ suffix }), placeholder: ".csv", disabled: disabled }), _jsx(TextField, { label: "Max objects per run", value: draft.maxObjectsPerRun, onChange: (maxObjectsPerRun) => set({ maxObjectsPerRun }), inputMode: "numeric", disabled: disabled })] }), _jsx(SelectField, { label: "Format", ariaLabel: "Format", value: draft.format, onValueChange: (format) => set({ format }), options: KEY_FORMAT_OPTIONS, disabled: disabled }), !viaConnection && (_jsx(Switch, { checked: draft.forcePathStyle, onCheckedChange: (forcePathStyle) => set({ forcePathStyle }), label: "Path-style addressing", hint: "MinIO needs it; AWS does not." }))] }));
246
278
  }
247
279
  const parsed = parseRecords(draft.records);
248
280
  return (_jsx(TextAreaField, { label: "Records", value: draft.records, onChange: (records) => set({ records }), placeholder: '[{ "tag": "AF93E00073" }]', mono: true, rows: 5, disabled: disabled, hint: parsed.ok ? undefined : (_jsx("span", { className: "text-red-600 dark:text-red-400", children: parsed.message })) }));
@@ -68,6 +68,36 @@ export interface DurabilityCopy {
68
68
  detail: string;
69
69
  }
70
70
  export declare function describeDurability(durability: WorkflowDurability | undefined): DurabilityCopy;
71
+ /**
72
+ * Whether a connector here may name a media disk.
73
+ *
74
+ * The same three-state shape {@link WorkflowDurability} has, for the same
75
+ * reason: the field being absent means a server that predates it, which is not
76
+ * the same as a server that says no.
77
+ */
78
+ export interface StorageAvailability {
79
+ available: boolean;
80
+ disks: string[];
81
+ detail: string;
82
+ }
83
+ /** The three answers, as prose the screen can render without branching twice. */
84
+ export interface StorageCopy {
85
+ state: 'disks' | 'none' | 'unknown';
86
+ label: string;
87
+ detail: string;
88
+ }
89
+ /**
90
+ * What to tell somebody authoring an object-store source.
91
+ *
92
+ * The `none` case is the one that matters, and it is written to say what is
93
+ * LOST rather than what is missing. "Media is not available" would be true and
94
+ * useless: nobody would notice the absence of a feature they have never used.
95
+ * What they will do instead is mint a second copy of a credential the host has
96
+ * already got, under a name of the catalog's own, and add that name to the
97
+ * secret allow-list — and the second copy is the one that outlives its
98
+ * rotation. Saying so is the whole point of rendering this at all.
99
+ */
100
+ export declare function describeStorage(storage: StorageAvailability | undefined): StorageCopy;
71
101
  /**
72
102
  * The outcome of running a graph, node by node.
73
103
  *
@@ -64,6 +64,45 @@ export function describeDurability(durability) {
64
64
  detail: 'No durable engine is available here, so the whole graph runs inline in one process. A failure at node seven re-runs the graph from node one, and nothing between nodes is checkpointed.',
65
65
  };
66
66
  }
67
+ /**
68
+ * What to tell somebody authoring an object-store source.
69
+ *
70
+ * The `none` case is the one that matters, and it is written to say what is
71
+ * LOST rather than what is missing. "Media is not available" would be true and
72
+ * useless: nobody would notice the absence of a feature they have never used.
73
+ * What they will do instead is mint a second copy of a credential the host has
74
+ * already got, under a name of the catalog's own, and add that name to the
75
+ * secret allow-list — and the second copy is the one that outlives its
76
+ * rotation. Saying so is the whole point of rendering this at all.
77
+ */
78
+ export function describeStorage(storage) {
79
+ if (!storage) {
80
+ return {
81
+ state: 'unknown',
82
+ label: 'disks: not reported',
83
+ detail: 'This deployment did not say whether media disks are wired up, so this screen cannot offer them. Give the connector a bucket and a credential of its own. Treating silence as "there are no disks" would send somebody looking for a picker that is not missing, only unreported.',
84
+ };
85
+ }
86
+ if (storage.available && storage.disks.length > 0) {
87
+ return {
88
+ state: 'disks',
89
+ label: `disks: ${storage.disks.length}`,
90
+ detail: `This connector can name a disk instead of carrying its own bucket, endpoint and credential: ${storage.disks.join(', ')}. The disk already holds all four, configured once by the host and rotated in one place.`,
91
+ };
92
+ }
93
+ if (storage.available) {
94
+ return {
95
+ state: 'none',
96
+ label: 'disks: none configured',
97
+ detail: 'Media is mounted here but has no disks configured, so there is nothing to name yet. Give the connector a bucket and a credential of its own, or configure a disk on the host and it becomes selectable here.',
98
+ };
99
+ }
100
+ return {
101
+ state: 'none',
102
+ label: 'disks: off',
103
+ detail: 'No media storage manager resolved here, so this connector cannot name a disk. It still reads an object store — but it has to carry its own bucket, endpoint and region, and its own environment variable holding "accessKeyId:secretAccessKey", which is a second copy of a credential this deployment would otherwise have configured once on a disk.',
104
+ };
105
+ }
67
106
  /**
68
107
  * A stable id for a node the person just drew.
69
108
  *
@@ -22,6 +22,12 @@ export const SOURCE_KINDS = {
22
22
  label: 'an object store',
23
23
  required: ['bucket'],
24
24
  optional: [
25
+ // A named media disk, which stands in for `bucket`, `region`, `endpoint`
26
+ // AND the credential — the host configured all four once, and a connector
27
+ // that names a disk inherits them instead of restating them. Optional
28
+ // rather than an alternative `required` set because a deployment with no
29
+ // media has no disks to name, and `bucket` is still the answer there.
30
+ 'disk',
25
31
  'prefix',
26
32
  'suffix',
27
33
  'format',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dudousxd/nestjs-catalog-react",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "description": "Ready-made React screens for @dudousxd/nestjs-catalog — a model manager and a generic object explorer you can drop into your own app shell.",
5
5
  "license": "MIT",
6
6
  "author": "Davide Carvalho",
@@ -110,7 +110,7 @@
110
110
  "tailwind-merge": "3.4.1",
111
111
  "tiptap-markdown": "0.9.0",
112
112
  "typescript": "5.9.3",
113
- "@dudousxd/nestjs-catalog": "0.24.0"
113
+ "@dudousxd/nestjs-catalog": "0.25.0"
114
114
  },
115
115
  "dependencies": {
116
116
  "clsx": "2.1.1",