@dudousxd/nestjs-catalog-react 0.22.0 → 0.23.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.
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(),
@@ -18,7 +18,7 @@
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';
21
+ export type { CallableWorkflowBlock, CallableWorkflowDisagreement, CallableWorkflowRef, CatalogWorkflow, CatalogWorkflowRelease, 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
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';
23
23
  import { type WorkflowBranchLabel, type WorkflowNode, type WorkflowSkipReason } from '@dudousxd/nestjs-catalog/client';
24
24
  /**
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.23.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.19.0"
114
114
  },
115
115
  "dependencies": {
116
116
  "clsx": "2.1.1",