@dudousxd/nestjs-catalog-react 0.22.0 → 0.24.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.
@@ -32,7 +32,7 @@ import { defaultLabel, describeFilterPredicate, flowingEdgeIds, layout, layoutIf
32
32
  import { HistoryControls, keepKnown, namesOf, nodeEditAction, reverted, snapshotOf, undone, useUndoShortcut, useUnsavedGuard, withEdit, } from './workflow/history';
33
33
  import { PublishControls, RunControls, SchedulePanel, ShrinkRefusalNote, WorkflowStatusBadge, } from './workflow/lifecycle';
34
34
  import { CanvasContextMenu, NodeActionsToolbar } from './workflow/menu';
35
- import { WORKFLOW_BRANCH_LABELS, WORKFLOW_FILTER_MAX_DEPTH, WORKFLOW_FILTER_MAX_VALUES, WORKFLOW_FILTER_OPERATORS, WORKFLOW_NODE_KINDS, callableWorkflowBlock, describeDurability, isWorkflowBranchLabel, isWorkflowFilterOperator, isWorkflowFilterPredicateKind, isWorkflowNodeKind, isWorkflowPredicateKind, newLocalId, nodeName, producedTypes, unreachableFilterPredicateKind, unreachableNodeKind, unreachablePredicateKind, workflowNarrowedTypes, } from './workflow/model';
35
+ import { WORKFLOW_BRANCH_LABELS, WORKFLOW_CALL_MODES, WORKFLOW_FILTER_MAX_DEPTH, WORKFLOW_FILTER_MAX_VALUES, WORKFLOW_FILTER_OPERATORS, WORKFLOW_NODE_KINDS, callableWorkflowBlock, describeDurability, isWorkflowBranchLabel, isWorkflowFilterOperator, isWorkflowFilterPredicateKind, isWorkflowNodeKind, isWorkflowPredicateKind, newLocalId, nodeName, producedTypes, unreachableFilterPredicateKind, unreachableNodeKind, unreachablePredicateKind, workflowCallMode, workflowNarrowedTypes, } from './workflow/model';
36
36
  import { WORKFLOW_NAME } from './workflow/name';
37
37
  import { WorkflowNodeProvider, workflowNodeTypes } from './workflow/nodes';
38
38
  import { freeSpot, placeNextTo } from './workflow/place';
@@ -2959,6 +2959,10 @@ function CallInspector({ node, canEdit, onChange, }) {
2959
2959
  // is the ONLY way this pair of fields can leave a node half-pinned, and the
2960
2960
  // person who just picked a name is the one who can finish it.
2961
2961
  const undecided = name.length > 0 && version.length === 0 && versionOptions.length > 0;
2962
+ // Core's reader, not a `?? 'envelope'` of this screen's own: a second copy of
2963
+ // the default is how the canvas and `workflowGraphHash` come to disagree, and
2964
+ // the symptom is unsaved changes reported on a graph nobody edited.
2965
+ const mode = workflowCallMode(node);
2962
2966
  // Two different silences, and telling somebody the wrong one is worse than
2963
2967
  // telling them nothing. An empty aggregate is a fact about the DEPLOYMENT and
2964
2968
  // the server's own sentence explains it; an empty aggregate is not what a
@@ -3028,12 +3032,57 @@ function CallInspector({ node, canEdit, onChange, }) {
3028
3032
  return;
3029
3033
  onChange({ ...node, callName: ref.name, callVersion: ref.version });
3030
3034
  };
3035
+ /**
3036
+ * Commit a wire format, refusing anything that is not one of the two.
3037
+ *
3038
+ * A `SelectField` hands back a bare string, and this is the graph being
3039
+ * written rather than a row being rendered: the same standing `chooseVersion`
3040
+ * takes about a blocked entry. An unrecognised value would be stored, refused
3041
+ * at the save boundary by `readCallMode`, and reported as being about a field
3042
+ * this screen wrote — so it is never written in the first place.
3043
+ */
3044
+ const chooseMode = (value) => {
3045
+ const next = WORKFLOW_CALL_MODES.find((candidate) => candidate === value);
3046
+ if (next === undefined)
3047
+ return;
3048
+ onChange({ ...node, callMode: next });
3049
+ };
3031
3050
  return (_jsxs("div", { className: "space-y-3", children: [_jsx(ComboboxField, { label: "Workflow", value: node.callName, onValueChange: (callName) => onChange({ ...node, callName }), onSelect: chooseName, options: nameOptions, placeholder: "billing.reconcile", disabled: !canEdit, emptyMessage: noNames, hint: _jsxs(_Fragment, { children: ["The name it is registered under in this deployment, exactly. Type to search what a live worker says it can execute right now, read at ", readTime(announced.data?.observedAt), " \u2014 a snapshot, not a registry, so a worker that stops beating drops off it within about half a minute and one too old to announce its registrations was never on it. Anything you type is accepted whether or not it is on the list; its body may be in another language, which is the point of calling it rather than writing it here."] }) }), _jsx(ComboboxField, { label: "Version", value: node.callVersion, onValueChange: (callVersion) => onChange({ ...node, callVersion }), onSelect: chooseVersion, options: versionOptions, placeholder: "1", disabled: !canEdit, emptyMessage: name.length === 0
3032
3051
  ? 'Name a workflow first, and the versions announced for it are listed here.'
3033
- : `No live worker announces a version of "${name}". Type the one you mean.`, hint: "Pinned, and part of what this graph is. Registered without a version, a workflow is version 1. Repointing this at another version is an edit to this graph, and shows up as one." }), undecided && (_jsxs("p", { className: cn('text-[11px] leading-relaxed', MUTED), children: ["The fleet announces more than one version of \u201C", name, "\u201D, so nothing here picked one for you. Until you do, this node names half of what it needs and the graph will not save."] })), chosen && (_jsxs("p", { className: cn('text-[11px] leading-relaxed', MUTED), children: ["This exact pin is announced right now: ", chosen.name, "@", chosen.version, chosen.group ? `, on group ${chosen.group}` : '', chosen.workers === 1 ? ' — by one worker, so it is a single point of failure.' : '.'] })), blocked.length > 0 && (_jsx("div", { className: cn('space-y-1 text-[11px] leading-relaxed', MUTED), children: blocked.map(({ ref, block }) => (_jsx("p", { children: block.message }, callableKey(ref)))) })), _jsx(TextAreaField, { label: "Parameters", value: text, onChange: pushConfig, rows: 5, mono: true, placeholder: "{}", disabled: !canEdit, hint: invalid
3052
+ : `No live worker announces a version of "${name}". Type the one you mean.`, hint: "Pinned, and part of what this graph is. Registered without a version, a workflow is version 1. Repointing this at another version is an edit to this graph, and shows up as one." }), undecided && (_jsxs("p", { className: cn('text-[11px] leading-relaxed', MUTED), children: ["The fleet announces more than one version of \u201C", name, "\u201D, so nothing here picked one for you. Until you do, this node names half of what it needs and the graph will not save."] })), chosen && (_jsxs("p", { className: cn('text-[11px] leading-relaxed', MUTED), children: ["This exact pin is announced right now: ", chosen.name, "@", chosen.version, chosen.group ? `, on group ${chosen.group}` : '', chosen.workers === 1 ? ' — by one worker, so it is a single point of failure.' : '.'] })), blocked.length > 0 && (_jsx("div", { className: cn('space-y-1 text-[11px] leading-relaxed', MUTED), children: blocked.map(({ ref, block }) => (_jsx("p", { children: block.message }, callableKey(ref)))) })), _jsx(SelectField, { label: "What it is sent", ariaLabel: "Whether the workflow is handed the catalog envelope or the parameters on their own", value: mode, onValueChange: chooseMode, options: WORKFLOW_CALL_MODES.map((value) => ({
3053
+ value,
3054
+ label: CALL_MODE_COPY[value].label,
3055
+ })), disabled: !canEdit }), _jsx("p", { className: cn('text-[11px] leading-relaxed', MUTED), children: CALL_MODE_COPY[mode].note }), _jsx(TextAreaField, { label: "Parameters", value: text, onChange: pushConfig, rows: 5, mono: true, placeholder: "{}", disabled: !canEdit, hint: invalid
3034
3056
  ? 'That is not valid JSON yet, so it has not been saved onto the node.'
3035
- : 'A JSON object, handed to the workflow as `input`. Beside it, under `catalog`, it also gets this run’s id and the staged rows of whatever feeds this node — handles, never the rows themselves. Not a place for a password: name an env var the callee already reads.' }), _jsx("p", { className: cn('text-[11px] leading-relaxed', MUTED), children: "This runs as a child of the load, with its own retries, and the load waits for it. If it fails, this node fails and nothing after it runs. Cancelling the load cancels it; letting the load time out does not, so a workflow you call should carry its own execution timeout." }), _jsxs("p", { className: cn('text-[11px] leading-relaxed', MUTED), children: ["Whether two loads calling it can overlap is decided by how ", _jsx("em", { children: "it" }), " was registered, not by this graph \u2014 and on the path a workflow in another language is reached by, that declaration may not be visible to the engine at all, so assume it can run alongside itself."] })] }));
3057
+ : CALL_MODE_COPY[mode].parameters }), _jsx("p", { className: cn('text-[11px] leading-relaxed', MUTED), children: "This runs as a child of the load, with its own retries, and the load waits for it. If it fails, this node fails and nothing after it runs. Cancelling the load cancels it; letting the load time out does not, so a workflow you call should carry its own execution timeout." }), _jsxs("p", { className: cn('text-[11px] leading-relaxed', MUTED), children: ["Whether two loads calling it can overlap is decided by how ", _jsx("em", { children: "it" }), " was registered, not by this graph \u2014 and on the path a workflow in another language is reached by, that declaration may not be visible to the engine at all, so assume it can run alongside itself."] })] }));
3036
3058
  }
3059
+ /**
3060
+ * What each wire format is called on the screen, and what choosing it means.
3061
+ *
3062
+ * A record over every mode rather than a hand-written options array, for the
3063
+ * reason {@link NODE_KIND_IS_REUSABLE} is one in core: a third format added to
3064
+ * `WORKFLOW_CALL_MODES` without an entry here is a type error in this file
3065
+ * naming the copy it has not been given, rather than a mode the runner can send
3066
+ * and this inspector silently never offers. That is the add-node row that
3067
+ * shipped the `filter` node with no way to create it, and it is not being
3068
+ * repeated one field down.
3069
+ *
3070
+ * `unreachableCallMode` is not the guard here because a lookup table can be
3071
+ * exhaustive at compile time, which is stronger — there is no branch to fall
3072
+ * off the end of.
3073
+ */
3074
+ const CALL_MODE_COPY = {
3075
+ envelope: {
3076
+ label: 'Envelope — written for this catalog',
3077
+ note: 'The workflow is handed an envelope: the parameters under `input`, and beside them, under `catalog`, this run’s id and the staged rows of whatever feeds this node — handles, never the rows themselves. It can stage rows back for the next node, and it has to have been written for this catalog to read any of it.',
3078
+ parameters: 'A JSON object, handed to the workflow as `input`. Beside it, under `catalog`, it also gets this run’s id and the staged rows of whatever feeds this node — handles, never the rows themselves. Not a place for a password: name an env var the callee already reads.',
3079
+ },
3080
+ plain: {
3081
+ label: 'Plain — the parameters on their own',
3082
+ note: 'The parameters go across on their own, exactly as typed, with nothing of this catalog added — so a workflow that has never heard of this catalog can be called without being changed. It is told no run id and no node id, so it has nowhere to write rows back to: this node always passes on none, whatever the workflow returns, and the graph will not save if you wire anything downstream of it. Run it for its effect, and let a source produce what gets committed.',
3083
+ parameters: 'A JSON object, and the whole of what the workflow receives — its keys are the keys it reads. Not a place for a password: name an env var the callee already reads.',
3084
+ },
3085
+ };
3037
3086
  /**
3038
3087
  * What identifies one announced entry among the others.
3039
3088
  *
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, WorkflowDurability, WorkflowInput, WorkflowRun } from './workflow/model';
5
+ import type { CatalogWorkflow, CatalogWorkflowRelease, WorkflowDurability, WorkflowInput, WorkflowRun } from './workflow/model';
6
6
  /**
7
7
  * How these screens talk to the server.
8
8
  *
@@ -251,6 +251,31 @@ export interface WorkflowRunOptions {
251
251
  * acknowledgement and gave no reason, which is refused.
252
252
  */
253
253
  expectShrink?: string;
254
+ /**
255
+ * Run a particular released version rather than the one this graph is set to.
256
+ *
257
+ * Absent — the ordinary case — runs whatever the graph is set to run: its live
258
+ * version if it has one, its latest save otherwise. Present is how a newly
259
+ * released version gets tried **without becoming what the cron executes**,
260
+ * which is the half of this feature that makes the other half safe: if the
261
+ * only way to run a new version were to deploy it, nobody would release
262
+ * anything they had not already decided to ship.
263
+ *
264
+ * Naming a version here does not move the live pointer. Deploying is
265
+ * `setWorkflowLiveVersion`, and the two are deliberately different calls.
266
+ */
267
+ version?: number;
268
+ }
269
+ export interface WorkflowReleaseInput {
270
+ /**
271
+ * Whatever the releaser wants to say about this version.
272
+ *
273
+ * Optional, and usually empty. It is stored on the release rather than derived
274
+ * from anything, because the one question a rollback has to answer six months
275
+ * later — "what was wrong with v8?" — has no other place to be written down:
276
+ * the graph diff says what changed and never says why.
277
+ */
278
+ notes?: string;
254
279
  }
255
280
  export interface WorkflowScheduleInput {
256
281
  /** Cron-ish, interpreted by whatever schedules it. Empty means manual only. */
@@ -796,6 +821,37 @@ export interface CatalogClient {
796
821
  * watching schedules while parsing nothing.
797
822
  */
798
823
  scheduleWorkflow(id: string, input: WorkflowScheduleInput): Promise<ScheduledWorkflow>;
824
+ /**
825
+ * Every released version of this graph, newest first.
826
+ *
827
+ * What a version picker is built on, and what a rollback is chosen from: the
828
+ * entry above the live one is what you came back from. Each carries the graph
829
+ * as it was, so a screen can draw an old version rather than only name it.
830
+ */
831
+ listWorkflowReleases(id: string): Promise<CatalogWorkflowRelease[]>;
832
+ /**
833
+ * Freeze this graph as it currently stands. **Deploys nothing.**
834
+ *
835
+ * Answers with the release, and with the *existing* one if this version was
836
+ * already released — the graph has not changed, so a second release would
837
+ * record an event that did not happen. A screen may therefore treat this as
838
+ * idempotent and does not need to disable its own button to be correct.
839
+ */
840
+ releaseWorkflow(id: string, input?: WorkflowReleaseInput): Promise<CatalogWorkflowRelease>;
841
+ /**
842
+ * Choose which released version this graph runs. **This is the deploy.**
843
+ *
844
+ * The same call is going live, rolling back and un-pinning: a smaller number
845
+ * is the rollback, and `null` takes the graph back to running its latest save.
846
+ * There is no separate rollback call because there is no separate mechanism —
847
+ * the older graph is still stored, so repointing is the whole of it.
848
+ *
849
+ * A screen that offers this should show both numbers. `liveWorkflowVersion`
850
+ * from `@dudousxd/nestjs-catalog/client` is the shared answer to "which one
851
+ * runs now", so a console does not reimplement the rule and end up disagreeing
852
+ * with the scheduler about what is deployed.
853
+ */
854
+ setWorkflowLiveVersion(id: string, version: number | null): Promise<CatalogWorkflow>;
799
855
  /**
800
856
  * What the system behind one source node looks like right now. Writes nothing.
801
857
  *
package/dist/context.js CHANGED
@@ -112,7 +112,28 @@ export function CatalogProvider({ transport, pipelineBasePath = DEFAULT_PIPELINE
112
112
  ...(options && 'expectShrink' in options && options.expectShrink !== undefined
113
113
  ? { expectShrink: options.expectShrink }
114
114
  : {}),
115
+ ...(options?.version === undefined ? {} : { version: options.version }),
115
116
  }),
117
+ listWorkflowReleases: (id) => transport.get(pipeline.workflowReleases(id)),
118
+ releaseWorkflow: (id, input) => transport.post(pipeline.workflowReleases(id), {
119
+ // Conditionally, for the reason `runWorkflow` spreads its two: the
120
+ // server distinguishes a body with no `notes` from one carrying an
121
+ // empty string, and a transport that serialised `undefined` would
122
+ // flatten the two.
123
+ ...(input?.notes === undefined ? {} : { notes: input.notes }),
124
+ }),
125
+ setWorkflowLiveVersion: (id, version) => {
126
+ if (!transport.put) {
127
+ throw new Error('This transport cannot PUT, so it cannot set a live version. Implement `put` on the ' +
128
+ 'transport you passed to CatalogProvider — going live sets a pointer to a value ' +
129
+ 'rather than appending anything, which is why the route is a PUT and not a POST.');
130
+ }
131
+ // `version` is sent even when it is null, and that is the contract
132
+ // rather than an oversight: the server refuses a body with no `version`
133
+ // key, because reading an omitted field as "un-pin" would deploy the
134
+ // most dangerous of the three operations by default.
135
+ return transport.put(pipeline.workflowLive(id), { version });
136
+ },
116
137
  scheduleWorkflow: (id, input) => {
117
138
  if (!transport.put) {
118
139
  throw new Error('This transport cannot PUT, so it cannot set a schedule. Implement `put` on the ' +
package/dist/index.d.ts CHANGED
@@ -29,7 +29,7 @@ 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';
31
31
  export { attachTransformIds, buildWorkflowTemplate, type EnrichOptions, enrichWithLookup, fanOutTypes, type FanOutOptions, type FanOutTarget, FILE_DROP_KINDS, type FileDropOptions, joinSources, type JoinOptions, loadFileDrop, type PeriodicFullReloadOptions, periodicFullReload, planIsRunnable, planToWorkflowInput, refuseUnusableColumnNames, RELOAD_CADENCE_IDS, RELOAD_CADENCES, type ReloadCadence, replicateTable, type ReplicateTableOptions, SOURCE_KINDS, type TemplateDeclaration, type TemplateExpectation, type TemplateOutcome, type TemplatePlan, type TemplateRefusal, type TemplateRefusalCode, type TemplateRequest, type TemplateSchedule, type TemplateTransformRequest, withinMsFor, WORKFLOW_TEMPLATE_IDS, WORKFLOW_TEMPLATES, type WorkflowTemplateId, type WorkflowTemplateMeta, } from './workflow/templates';
32
- export { type CatalogClient, type CatalogIdentity, type CatalogRevision, type CatalogPeoplePage, type CatalogPersonRole, type CatalogPersonSummary, type CatalogPrincipalSummary, CatalogProvider, type CatalogProviderProps, type CatalogTransport, type ConnectionInput, type ConnectionUse, catalogQueryKeys, type DeleteReconciliation, type LoadExpectation, type LoadExpectationInput, type ResolvedLoadExpectation, type RowCountBound, type StoredLoadExpectation, type PersonInput, type PersonUpsertResult, type PipelineCapabilities, type CallableWorkflowList, type ScheduledWorkflow, type TransformInput, type ListedReusableNode, type ReusableNodeInput, type ReusableNodeUsage, type SavedNodeAsReusable, type WorkflowRunOptions, type WorkflowScheduleInput, useCatalogClient, } from './context';
32
+ export { type CatalogClient, type CatalogIdentity, type CatalogRevision, type CatalogPeoplePage, type CatalogPersonRole, type CatalogPersonSummary, type CatalogPrincipalSummary, CatalogProvider, type CatalogProviderProps, type CatalogTransport, type ConnectionInput, type ConnectionUse, catalogQueryKeys, type DeleteReconciliation, type LoadExpectation, type LoadExpectationInput, type ResolvedLoadExpectation, type RowCountBound, type StoredLoadExpectation, type PersonInput, type PersonUpsertResult, type PipelineCapabilities, type CallableWorkflowList, type ScheduledWorkflow, type TransformInput, type ListedReusableNode, type ReusableNodeInput, type ReusableNodeUsage, type SavedNodeAsReusable, type WorkflowReleaseInput, type WorkflowRunOptions, type WorkflowScheduleInput, useCatalogClient, } from './context';
33
33
  export { type AccessRoutes, accessRoutes, DEFAULT_ACCESS_BASE_PATH, DEFAULT_PIPELINE_BASE_PATH, DEFAULT_PUBLISH_BASE_PATH, embedRoutes, type PeopleQuery, type PipelineRoutes, pipelineRoutes, } from './routes';
34
34
  export { ConfirmDialog } from './ui/dialog';
35
35
  export { FieldGroup, TextAreaField, TextField } from './ui/field';
package/dist/routes.d.ts CHANGED
@@ -241,6 +241,36 @@ export interface PipelineRoutes {
241
241
  * silently revert.
242
242
  */
243
243
  workflowSchedule(id: string): string;
244
+ /**
245
+ * Frozen versions of this graph. GET lists them newest first, POST mints one.
246
+ *
247
+ * A sub-resource of the graph rather than a top-level listing, because a
248
+ * release has no identity away from the workflow it is a release of — the same
249
+ * reasoning `transformRevisions` follows one object over.
250
+ *
251
+ * **Pressing POST deploys nothing.** It writes an immutable copy of the graph
252
+ * as it currently stands and answers with it; what runs is unchanged until
253
+ * somebody presses {@link PipelineRoutes.workflowLive}. The two are separate
254
+ * routes because they are separate decisions, and a screen that offered them
255
+ * as one button would rebuild the coupling this pair exists to break.
256
+ */
257
+ workflowReleases(id: string): string;
258
+ /**
259
+ * Which released version this graph actually runs. **This is the deploy.**
260
+ *
261
+ * `PUT` a `{ version }` to go live, and the same `PUT` with a smaller number
262
+ * is the rollback — there is no separate rollback route because there is no
263
+ * separate mechanism, the older graph is still stored. `{ version: null }`
264
+ * takes the graph back to running whatever its latest save holds, which is
265
+ * where every graph starts and is the one call here that makes editing mean
266
+ * deploying again.
267
+ *
268
+ * A screen built on this needs both numbers to say anything useful: the live
269
+ * version and the head. `liveWorkflowVersion` from `@dudousxd/nestjs-catalog/client`
270
+ * is the shared answer to "which one runs", so a console does not compute it
271
+ * with its own `??` and end up disagreeing with the scheduler.
272
+ */
273
+ workflowLive(id: string): string;
244
274
  /**
245
275
  * What the system behind one source node looks like right now. Writes nothing.
246
276
  *
package/dist/routes.js CHANGED
@@ -154,6 +154,8 @@ export function pipelineRoutes(basePath = DEFAULT_PIPELINE_BASE_PATH) {
154
154
  unpublishWorkflow: (id) => `${base}/workflows/${encodeURIComponent(id)}/unpublish`,
155
155
  runWorkflow: (id) => `${base}/workflows/${encodeURIComponent(id)}/run`,
156
156
  workflowSchedule: (id) => `${base}/workflows/${encodeURIComponent(id)}/schedule`,
157
+ workflowReleases: (id) => `${base}/workflows/${encodeURIComponent(id)}/releases`,
158
+ workflowLive: (id) => `${base}/workflows/${encodeURIComponent(id)}/live`,
157
159
  discoverSourceSchema: (id, nodeId) => `${base}/workflows/${encodeURIComponent(id)}/nodes/${encodeURIComponent(nodeId)}/discover`,
158
160
  saveNodeAsReusable: (id, nodeId) => `${base}/workflows/${encodeURIComponent(id)}/nodes/${encodeURIComponent(nodeId)}/save-as-reusable`,
159
161
  loadExpectations: () => expectations.expectations(),
@@ -22,10 +22,29 @@ export declare const KIND_OPTIONS: {
22
22
  value: string;
23
23
  label: string;
24
24
  }[];
25
+ /**
26
+ * The formats, with the leading "work it out" option.
27
+ *
28
+ * Derived from `SOURCE_FORMATS` rather than written out beside it, so the order
29
+ * and the membership are the library's and not a copy of them.
30
+ */
25
31
  export declare const FORMAT_OPTIONS: {
26
32
  value: string;
27
33
  label: string;
28
34
  }[];
35
+ /**
36
+ * The same options for a bucket, whose blank option reads differently because
37
+ * an S3 connector guesses per key rather than once.
38
+ *
39
+ * A function over the named formats rather than `FORMAT_OPTIONS.slice(1)`, which
40
+ * is what this replaced: the slice encoded "the first entry is the blank one" as
41
+ * a number, and a format inserted at the front of the list would have dropped
42
+ * itself from this picker and nothing else.
43
+ */
44
+ export declare const KEY_FORMAT_OPTIONS: {
45
+ value: string;
46
+ label: string;
47
+ }[];
29
48
  /** The value the connection picker uses for "do not use one". */
30
49
  export declare const INLINE_CONNECTION = "";
31
50
  /**
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { CONNECTOR_KINDS } from '@dudousxd/nestjs-catalog/client';
2
+ import { CONNECTOR_KINDS, SOURCE_FORMATS } from '@dudousxd/nestjs-catalog/client';
3
3
  import { cn } from './cn';
4
4
  import { CONNECTION_KINDS } from './connection-form';
5
5
  import { FieldGroup, TextAreaField, TextField } from './ui/field';
@@ -49,15 +49,47 @@ export function usesConnection(kind) {
49
49
  export const KIND_OPTIONS = [
50
50
  { value: 'http', label: 'HTTP — a JSON endpoint' },
51
51
  { value: 'sql', label: 'SQL — a database query' },
52
- { value: 'file', label: 'File — CSV, NDJSON or JSON' },
52
+ { value: 'file', label: 'File — CSV, NDJSON, JSON or Excel' },
53
53
  { value: 's3', label: 'S3 — a bucket prefix' },
54
54
  { value: 'inline', label: 'Inline — records pasted below' },
55
55
  ];
56
+ /**
57
+ * How each format is labelled, and the reason this is a map rather than a list.
58
+ *
59
+ * `satisfies Record<SourceFormat, string>` is the whole point: a format added to
60
+ * the library's list leaves this object missing a property and the build stops
61
+ * here, rather than the console quietly offering three of four formats. It is
62
+ * the same argument {@link toConnectorKind} makes about kinds — the parser and
63
+ * the picker are meant to move together.
64
+ */
65
+ const FORMAT_LABELS = {
66
+ csv: 'CSV',
67
+ ndjson: 'NDJSON',
68
+ json: 'JSON',
69
+ xlsx: 'Excel workbook (.xlsx)',
70
+ };
71
+ /**
72
+ * The formats, with the leading "work it out" option.
73
+ *
74
+ * Derived from `SOURCE_FORMATS` rather than written out beside it, so the order
75
+ * and the membership are the library's and not a copy of them.
76
+ */
56
77
  export const FORMAT_OPTIONS = [
57
78
  { value: '', label: 'Format from the extension' },
58
- { value: 'csv', label: 'CSV' },
59
- { value: 'ndjson', label: 'NDJSON' },
60
- { value: 'json', label: 'JSON' },
79
+ ...SOURCE_FORMATS.map((format) => ({ value: format, label: FORMAT_LABELS[format] })),
80
+ ];
81
+ /**
82
+ * The same options for a bucket, whose blank option reads differently because
83
+ * an S3 connector guesses per key rather than once.
84
+ *
85
+ * A function over the named formats rather than `FORMAT_OPTIONS.slice(1)`, which
86
+ * is what this replaced: the slice encoded "the first entry is the blank one" as
87
+ * a number, and a format inserted at the front of the list would have dropped
88
+ * itself from this picker and nothing else.
89
+ */
90
+ export const KEY_FORMAT_OPTIONS = [
91
+ { value: '', label: 'Format from each key' },
92
+ ...SOURCE_FORMATS.map((format) => ({ value: format, label: FORMAT_LABELS[format] })),
61
93
  ];
62
94
  /** The value the connection picker uses for "do not use one". */
63
95
  export const INLINE_CONNECTION = '';
@@ -209,7 +241,7 @@ export function SourceFields({ kind, draft, onChange, viaConnection, disabled, }
209
241
  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 })] }));
210
242
  }
211
243
  if (kind === 's3') {
212
- 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: [{ value: '', label: 'Format from each key' }, ...FORMAT_OPTIONS.slice(1)], disabled: disabled }), !viaConnection && (_jsx(Switch, { checked: draft.forcePathStyle, onCheckedChange: (forcePathStyle) => set({ forcePathStyle }), label: "Path-style addressing", hint: "MinIO needs it; AWS does not." }))] }));
244
+ 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." }))] }));
213
245
  }
214
246
  const parsed = parseRecords(draft.records);
215
247
  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 })) }));
@@ -1,6 +1,6 @@
1
1
  import { WORKFLOW_NODE_HEIGHT, WORKFLOW_NODE_WIDTH, workflowColumnX, workflowRowY, workflowRunOrder, } from '@dudousxd/nestjs-catalog/client';
2
2
  import { MarkerType } from '@xyflow/react';
3
- import { nodeName, unreachableFilterPredicateKind, unreachableNodeKind, unreachablePredicateKind, } from './model';
3
+ import { nodeName, unreachableFilterPredicateKind, unreachableNodeKind, unreachablePredicateKind, workflowCallMode, } from './model';
4
4
  import { edgeId } from './validate';
5
5
  /**
6
6
  * Turning the stored graph into what React Flow draws, and back.
@@ -221,7 +221,12 @@ function callSubtitle(node) {
221
221
  const version = typeof node.callVersion === 'string' ? node.callVersion.trim() : '';
222
222
  if (name.length === 0)
223
223
  return 'no workflow chosen';
224
- return version.length > 0 ? `${name}@${version}` : `${name} · no version pinned`;
224
+ const pinned = version.length > 0 ? `${name}@${version}` : `${name} · no version pinned`;
225
+ // The plain mode is on the face of the node for the reason the version is:
226
+ // it is the half that decides what the node can *do*, and a plain call that
227
+ // reads like an ordinary one is a box somebody wires into a sink and then
228
+ // wonders why the graph will not save.
229
+ return workflowCallMode(node) === 'plain' ? `${pinned} · plain` : pinned;
225
230
  }
226
231
  /**
227
232
  * The sentence a screen reader reads when a node takes focus.
@@ -18,8 +18,8 @@
18
18
  * executes it, it belongs to core; if only this screen has an opinion about it,
19
19
  * it belongs here.
20
20
  */
21
- export type { CallableWorkflowBlock, CallableWorkflowDisagreement, CallableWorkflowRef, CatalogWorkflow, WorkflowBranchLabel, WorkflowEdge, WorkflowCallNode, WorkflowEnvPredicate, WorkflowFilterAll, WorkflowFilterAny, WorkflowFilterComparison, WorkflowFilterGroup, WorkflowFilterNode, WorkflowFilterOneOf, WorkflowFilterOperator, WorkflowFilterPredicate, WorkflowFilterPredicateKind, WorkflowFilterPresence, WorkflowFilterValue, WorkflowGraph, WorkflowIfNode, WorkflowIfPredicate, WorkflowNode, WorkflowNodeKind, WorkflowPredicateKind, WorkflowRowCountPredicate, WorkflowSinkNode, WorkflowSkipReason, WorkflowSourceNode, WorkflowTransformNode, } from '@dudousxd/nestjs-catalog/client';
22
- export { callableWorkflowBlock, isWorkflowBranchLabel, isWorkflowFilterOperator, isWorkflowFilterPredicate, isWorkflowFilterPredicateKind, isWorkflowFilterValue, isWorkflowNodeKind, isWorkflowPredicateKind, unreachableFilterOperator, unreachableFilterPredicateKind, unreachableNodeKind, unreachablePredicateKind, workflowNarrowedTypes, WORKFLOW_BRANCH_LABELS, WORKFLOW_FILTER_COLUMN_PATTERN, WORKFLOW_FILTER_MAX_DEPTH, WORKFLOW_FILTER_MAX_VALUES, WORKFLOW_FILTER_OPERATORS, WORKFLOW_FILTER_PREDICATE_KINDS, WORKFLOW_PREDICATE_KINDS, WORKFLOW_NODE_ID_PATTERN, WORKFLOW_NODE_KINDS, } from '@dudousxd/nestjs-catalog/client';
21
+ export type { CallableWorkflowBlock, CallableWorkflowDisagreement, CallableWorkflowRef, CatalogWorkflow, CatalogWorkflowRelease, WorkflowBranchLabel, WorkflowEdge, WorkflowCallMode, WorkflowCallNode, WorkflowEnvPredicate, WorkflowFilterAll, WorkflowFilterAny, WorkflowFilterComparison, WorkflowFilterGroup, WorkflowFilterNode, WorkflowFilterOneOf, WorkflowFilterOperator, WorkflowFilterPredicate, WorkflowFilterPredicateKind, WorkflowFilterPresence, WorkflowFilterValue, WorkflowGraph, WorkflowIfNode, WorkflowIfPredicate, WorkflowNode, WorkflowNodeKind, WorkflowPredicateKind, WorkflowRowCountPredicate, WorkflowSinkNode, WorkflowSkipReason, WorkflowSourceNode, WorkflowTransformNode, } from '@dudousxd/nestjs-catalog/client';
22
+ export { callableWorkflowBlock, isWorkflowBranchLabel, isWorkflowFilterOperator, isWorkflowFilterPredicate, isWorkflowFilterPredicateKind, isWorkflowFilterValue, isWorkflowNodeKind, isWorkflowPredicateKind, WORKFLOW_CALL_MODES, unreachableCallMode, workflowCallMode, unreachableFilterOperator, unreachableFilterPredicateKind, unreachableNodeKind, unreachablePredicateKind, workflowNarrowedTypes, WORKFLOW_BRANCH_LABELS, WORKFLOW_FILTER_COLUMN_PATTERN, WORKFLOW_FILTER_MAX_DEPTH, WORKFLOW_FILTER_MAX_VALUES, WORKFLOW_FILTER_OPERATORS, WORKFLOW_FILTER_PREDICATE_KINDS, WORKFLOW_PREDICATE_KINDS, WORKFLOW_NODE_ID_PATTERN, WORKFLOW_NODE_KINDS, } from '@dudousxd/nestjs-catalog/client';
23
23
  import { type WorkflowBranchLabel, type WorkflowNode, type WorkflowSkipReason } from '@dudousxd/nestjs-catalog/client';
24
24
  /**
25
25
  * What a caller may set.
@@ -23,7 +23,14 @@ export {
23
23
  // not a copy: the picker greys an entry out and the server reasons about the
24
24
  // same list, and two copies of that rule is a picker that eventually offers
25
25
  // something the rest of the system will not accept.
26
- callableWorkflowBlock, isWorkflowBranchLabel, isWorkflowFilterOperator, isWorkflowFilterPredicate, isWorkflowFilterPredicateKind, isWorkflowFilterValue, isWorkflowNodeKind, isWorkflowPredicateKind, unreachableFilterOperator, unreachableFilterPredicateKind, unreachableNodeKind, unreachablePredicateKind,
26
+ callableWorkflowBlock, isWorkflowBranchLabel, isWorkflowFilterOperator, isWorkflowFilterPredicate, isWorkflowFilterPredicateKind, isWorkflowFilterValue, isWorkflowNodeKind, isWorkflowPredicateKind,
27
+ // The two wire formats a call node can be authored in, plus the reader that
28
+ // applies the default. Core's, not a copy, for the reason every rule here is:
29
+ // an inspector offering a mode the runner cannot build a payload for is a
30
+ // graph somebody saves and a child run that fails, and a screen carrying its
31
+ // own `?? 'envelope'` would eventually disagree with `workflowGraphHash` and
32
+ // show unsaved changes on a graph nobody edited.
33
+ WORKFLOW_CALL_MODES, unreachableCallMode, workflowCallMode, unreachableFilterOperator, unreachableFilterPredicateKind, unreachableNodeKind, unreachablePredicateKind,
27
34
  // Core's, not a copy, for the reason every other rule here is core's: the
28
35
  // inspector has to offer exactly the acknowledgements `validateWorkflow`
29
36
  // requires, and a screen that worked out its own list would offer a set the
@@ -15,13 +15,22 @@ export const SOURCE_KINDS = {
15
15
  file: {
16
16
  label: 'a file',
17
17
  required: ['path'],
18
- optional: ['format', 'jsonPath', 'delimiter'],
18
+ optional: ['format', 'jsonPath', 'delimiter', 'sheet', 'maxBytes'],
19
19
  keysRecordsBySourceName: true,
20
20
  },
21
21
  s3: {
22
22
  label: 'an object store',
23
23
  required: ['bucket'],
24
- optional: ['prefix', 'suffix', 'format', 'delimiter', 'region', 'maxObjectsPerRun'],
24
+ optional: [
25
+ 'prefix',
26
+ 'suffix',
27
+ 'format',
28
+ 'delimiter',
29
+ 'sheet',
30
+ 'maxBytes',
31
+ 'region',
32
+ 'maxObjectsPerRun',
33
+ ],
25
34
  keysRecordsBySourceName: true,
26
35
  },
27
36
  inline: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dudousxd/nestjs-catalog-react",
3
- "version": "0.22.0",
3
+ "version": "0.24.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.18.0"
113
+ "@dudousxd/nestjs-catalog": "0.20.0"
114
114
  },
115
115
  "dependencies": {
116
116
  "clsx": "2.1.1",