@dudousxd/nestjs-catalog-react 0.19.0 → 0.21.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/TraceExplorer.d.ts +11 -1
- package/dist/TraceExplorer.js +64 -3
- package/dist/WorkflowCanvas.js +1082 -73
- package/dist/context.d.ts +132 -1
- package/dist/context.js +18 -0
- package/dist/index.d.ts +1 -1
- package/dist/routes.d.ts +48 -0
- package/dist/routes.js +5 -0
- package/dist/workflow/graph.js +21 -1
- package/dist/workflow/history.d.ts +291 -0
- package/dist/workflow/history.js +343 -0
- package/package.json +8 -8
package/dist/context.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CallableWorkflowRef, CatalogAuditEvent, CatalogConnection, CatalogConnector, CatalogObjectPage, CatalogQueryRelation, CatalogQueryResult, CatalogRevision, CatalogSearchResult, CatalogSnapshot, CatalogTraceList, CatalogTransform, ConnectionCheck, ConnectorRun, Dashboard, DashboardCard, DeleteReconciliation, LoadExpectation, LoadExpectationInput, ObjectQueryParams, PropertyPatch, ResolvedLoadExpectation, RowCountBound, SaveQueryInput, SavedQuery, SnapshotRef, StoredLoadExpectation, TraceQuery, TransformLanguage, TransformResult, TypePatch } from '@dudousxd/nestjs-catalog/client';
|
|
1
|
+
import type { CallableWorkflowRef, CatalogAuditEvent, CatalogConnection, CatalogConnector, CatalogObjectPage, CatalogQueryRelation, CatalogQueryResult, CatalogReusableNode, CatalogRevision, CatalogSearchResult, CatalogSnapshot, CatalogTrace, CatalogTraceList, CatalogTransform, ConnectionCheck, ConnectorRun, Dashboard, DashboardCard, DeleteReconciliation, LoadExpectation, LoadExpectationInput, ObjectQueryParams, PropertyPatch, ResolvedLoadExpectation, ReusableNodeBody, RowCountBound, SaveQueryInput, SavedQuery, SnapshotRef, StoredLoadExpectation, TraceQuery, TransformLanguage, TransformResult, TypePatch } from '@dudousxd/nestjs-catalog/client';
|
|
2
2
|
import { type ReactNode } from 'react';
|
|
3
3
|
import type { EmbeddedChartPayload, EmbeddedDashboardPayload } from './embed/payload';
|
|
4
4
|
import { type PeopleQuery } from './routes';
|
|
@@ -168,6 +168,69 @@ export interface ConnectionUse {
|
|
|
168
168
|
status: CatalogWorkflow['status'];
|
|
169
169
|
through: string;
|
|
170
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* One place a shared node body — or a transform — is used.
|
|
173
|
+
*
|
|
174
|
+
* The same shape for both, because they answer the same question about two
|
|
175
|
+
* stored objects and a second shape would be a second thing to keep in step.
|
|
176
|
+
* `CatalogReusableNodeUse` in core is the server's word for it; this is the same
|
|
177
|
+
* fields, re-declared here rather than imported for the reason
|
|
178
|
+
* {@link ConnectionUse} is: the transform route answers this shape too, and core
|
|
179
|
+
* has no type that covers both.
|
|
180
|
+
*
|
|
181
|
+
* Per **node**, not per graph. Three nodes of one graph using the same body are
|
|
182
|
+
* three places an edit lands, which is what somebody about to edit it is asking.
|
|
183
|
+
*/
|
|
184
|
+
export interface ReusableNodeUsage {
|
|
185
|
+
workflowId: string;
|
|
186
|
+
workflowName: string;
|
|
187
|
+
status: CatalogWorkflow['status'];
|
|
188
|
+
nodeId: string;
|
|
189
|
+
nodeName: string;
|
|
190
|
+
/**
|
|
191
|
+
* The version this node pinned, or absent for a reference that follows the
|
|
192
|
+
* latest.
|
|
193
|
+
*
|
|
194
|
+
* The field that turns a count into a decision. An unpinned node picks up this
|
|
195
|
+
* edit on its next run; a pinned one does not, until somebody edits that
|
|
196
|
+
* graph. A usage list without it would say "four graphs" and leave the reader
|
|
197
|
+
* unable to tell how many of them they are about to change.
|
|
198
|
+
*/
|
|
199
|
+
pinnedVersion?: number;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* A reusable node as the picker sees it: the body, plus how many places use it.
|
|
203
|
+
*
|
|
204
|
+
* The count is on the row rather than behind a request per row, because there is
|
|
205
|
+
* no library screen — the maintainer was explicit that reusable nodes belong
|
|
206
|
+
* where a node is added — so this list IS the picker, and a number that changes
|
|
207
|
+
* somebody's decision has to be there before the click.
|
|
208
|
+
*/
|
|
209
|
+
export interface ListedReusableNode extends CatalogReusableNode {
|
|
210
|
+
usedBy: number;
|
|
211
|
+
}
|
|
212
|
+
export interface ReusableNodeInput {
|
|
213
|
+
id?: string;
|
|
214
|
+
name: string;
|
|
215
|
+
description?: string;
|
|
216
|
+
body: ReusableNodeBody;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* What lifting a node into the library answers with.
|
|
220
|
+
*
|
|
221
|
+
* `setOnNode` rather than an edited graph, and it is the server saying out loud
|
|
222
|
+
* what the caller still has to do: the node is not an instance of anything until
|
|
223
|
+
* `useId` is on it and the graph is saved. A call that had rewritten the graph
|
|
224
|
+
* itself would move its version for a reason its author cannot see in their own
|
|
225
|
+
* diff, which is the class of silence this whole feature exists to end.
|
|
226
|
+
*/
|
|
227
|
+
export interface SavedNodeAsReusable {
|
|
228
|
+
reusableNode: CatalogReusableNode;
|
|
229
|
+
setOnNode: {
|
|
230
|
+
nodeId: string;
|
|
231
|
+
useId: string;
|
|
232
|
+
};
|
|
233
|
+
}
|
|
171
234
|
/**
|
|
172
235
|
* What a manual run may say about itself.
|
|
173
236
|
*
|
|
@@ -454,6 +517,15 @@ export interface CatalogClient {
|
|
|
454
517
|
* and collapsing the two would cost the first question its answer.
|
|
455
518
|
*/
|
|
456
519
|
listTraces(query: TraceQuery): Promise<CatalogTraceList>;
|
|
520
|
+
/**
|
|
521
|
+
* One trace, with the event payloads `listTraces` leaves behind.
|
|
522
|
+
*
|
|
523
|
+
* The pair is the point. A list page carries every span of every trace on it,
|
|
524
|
+
* so putting the payloads there means fetching thousands of them to draw
|
|
525
|
+
* waterfalls that read none — see `CatalogTraceSpan.detail`. This is the call
|
|
526
|
+
* that has them, and a screen makes it for the one trace somebody opened.
|
|
527
|
+
*/
|
|
528
|
+
getTrace(id: string): Promise<CatalogTrace>;
|
|
457
529
|
/**
|
|
458
530
|
* Getting data in.
|
|
459
531
|
*
|
|
@@ -597,6 +669,20 @@ export interface CatalogClient {
|
|
|
597
669
|
* thing the screen has to be able to say out loud.
|
|
598
670
|
*/
|
|
599
671
|
listTransformRevisions(id: string): Promise<CatalogRevision[]>;
|
|
672
|
+
/**
|
|
673
|
+
* Which graphs run this transform, and at which node within each.
|
|
674
|
+
*
|
|
675
|
+
* The answer to "how many places use this", asked of the shared object that
|
|
676
|
+
* already existed. Read in the transform editor rather than in a listing,
|
|
677
|
+
* because the number changes a decision exactly when somebody is about to edit
|
|
678
|
+
* code four other graphs depend on — which is not a moment they spend on a
|
|
679
|
+
* listing page.
|
|
680
|
+
*
|
|
681
|
+
* `pinnedVersion` is what turns the count into a decision rather than an
|
|
682
|
+
* alarm: an unpinned node moves the moment this is saved, a pinned one does
|
|
683
|
+
* not, and the two need different amounts of care.
|
|
684
|
+
*/
|
|
685
|
+
listTransformWorkflows(id: string): Promise<ReusableNodeUsage[]>;
|
|
600
686
|
/**
|
|
601
687
|
* Run code against sample records without storing anything.
|
|
602
688
|
*
|
|
@@ -618,6 +704,40 @@ export interface CatalogClient {
|
|
|
618
704
|
* rather than as a toast a minute later. Sharing the code is not the same as
|
|
619
705
|
* trusting the client: this call is still made, and its refusal always wins.
|
|
620
706
|
*/
|
|
707
|
+
/**
|
|
708
|
+
* Node bodies saved under a name and used from several graphs, each with the
|
|
709
|
+
* number of places it is used.
|
|
710
|
+
*
|
|
711
|
+
* There is deliberately no library screen behind this. It is the source of the
|
|
712
|
+
* picker offered where a node is added, and the count rides along on every row
|
|
713
|
+
* rather than behind a request per row — a number that changes somebody's
|
|
714
|
+
* decision has to be there before the click.
|
|
715
|
+
*
|
|
716
|
+
* Refuses by name on a deployment whose store cannot hold reusable nodes,
|
|
717
|
+
* rather than answering an empty list. "There are none yet" and "there cannot
|
|
718
|
+
* be any here" look identical to somebody who has never seen one, and the
|
|
719
|
+
* first invites them to keep looking for the button.
|
|
720
|
+
*/
|
|
721
|
+
listReusableNodes(): Promise<ListedReusableNode[]>;
|
|
722
|
+
saveReusableNode(input: ReusableNodeInput): Promise<CatalogReusableNode>;
|
|
723
|
+
deleteReusableNode(id: string): Promise<{
|
|
724
|
+
deleted: boolean;
|
|
725
|
+
}>;
|
|
726
|
+
/** Which graphs use it, and at which node within each. */
|
|
727
|
+
listReusableNodeWorkflows(id: string): Promise<ReusableNodeUsage[]>;
|
|
728
|
+
/**
|
|
729
|
+
* Lift one node of a saved graph into a reusable node, by reference.
|
|
730
|
+
*
|
|
731
|
+
* **It does not edit the graph.** It answers with the reusable node and the
|
|
732
|
+
* `useId` to put on that node; setting it and saving is one ordinary
|
|
733
|
+
* {@link CatalogClient.saveWorkflow}, which bumps the graph's version and
|
|
734
|
+
* shows a diff. A call that stored one thing and silently rewrote another
|
|
735
|
+
* would move a version for a reason its author cannot see in their own diff.
|
|
736
|
+
*/
|
|
737
|
+
saveNodeAsReusable(workflowId: string, nodeId: string, input: {
|
|
738
|
+
name?: string;
|
|
739
|
+
description?: string;
|
|
740
|
+
}): Promise<SavedNodeAsReusable>;
|
|
621
741
|
listWorkflows(): Promise<CatalogWorkflow[]>;
|
|
622
742
|
saveWorkflow(input: WorkflowInput): Promise<CatalogWorkflow>;
|
|
623
743
|
/**
|
|
@@ -798,6 +918,17 @@ export declare const catalogQueryKeys: {
|
|
|
798
918
|
* today's code, which is the one thing it exists not to do.
|
|
799
919
|
*/
|
|
800
920
|
transformRevisions: (id: string) => readonly ["nestjs-catalog", "pipeline", "transforms", string, "revisions"];
|
|
921
|
+
/**
|
|
922
|
+
* Which graphs run one transform, keyed UNDER `transforms` for the reason its
|
|
923
|
+
* neighbour above is: saving a graph is what changes this, and the list
|
|
924
|
+
* invalidation a save already performs has to reach it — a usage count that
|
|
925
|
+
* kept yesterday's number is worse than none, because it is read by somebody
|
|
926
|
+
* deciding whether an edit is safe.
|
|
927
|
+
*/
|
|
928
|
+
transformWorkflows: (id: string) => readonly ["nestjs-catalog", "pipeline", "transforms", string, "workflows"];
|
|
929
|
+
reusableNodes: readonly ["nestjs-catalog", "pipeline", "reusable-nodes"];
|
|
930
|
+
/** Keyed under `reusableNodes`, so saving one invalidates its usage list too. */
|
|
931
|
+
reusableNodeWorkflows: (id: string) => readonly ["nestjs-catalog", "pipeline", "reusable-nodes", string, "workflows"];
|
|
801
932
|
runs: (connectorId?: string) => readonly ["nestjs-catalog", "pipeline", "runs", string];
|
|
802
933
|
/**
|
|
803
934
|
* One type's resolved load expectation.
|
package/dist/context.js
CHANGED
|
@@ -51,6 +51,7 @@ export function CatalogProvider({ transport, pipelineBasePath = DEFAULT_PIPELINE
|
|
|
51
51
|
embedDashboard: (id) => transport.get(embedRoutes.dashboard(id)),
|
|
52
52
|
listEvents: (query) => transport.get(catalogRoutes.events(), { ...query }),
|
|
53
53
|
listTraces: (query) => transport.get(catalogRoutes.traces(), { ...query }),
|
|
54
|
+
getTrace: (id) => transport.get(catalogRoutes.trace(id)),
|
|
54
55
|
pipelineCapabilities: () => transport.get(pipeline.capabilities()),
|
|
55
56
|
listCallableWorkflows: () => transport.get(pipeline.callableWorkflows()),
|
|
56
57
|
listConnections: () => transport.get(pipeline.connections()),
|
|
@@ -87,7 +88,13 @@ export function CatalogProvider({ transport, pipelineBasePath = DEFAULT_PIPELINE
|
|
|
87
88
|
saveTransform: (input) => transport.post(pipeline.transforms(), input),
|
|
88
89
|
deleteTransform: (id) => transport.delete(pipeline.transform(id)),
|
|
89
90
|
listTransformRevisions: (id) => transport.get(pipeline.transformRevisions(id)),
|
|
91
|
+
listTransformWorkflows: (id) => transport.get(pipeline.transformWorkflows(id)),
|
|
90
92
|
tryTransform: (input) => transport.post(pipeline.tryTransform(), input),
|
|
93
|
+
listReusableNodes: () => transport.get(pipeline.reusableNodes()),
|
|
94
|
+
saveReusableNode: (input) => transport.post(pipeline.reusableNodes(), input),
|
|
95
|
+
deleteReusableNode: (id) => transport.delete(pipeline.reusableNode(id)),
|
|
96
|
+
listReusableNodeWorkflows: (id) => transport.get(pipeline.reusableNodeWorkflows(id)),
|
|
97
|
+
saveNodeAsReusable: (workflowId, nodeId, input) => transport.post(pipeline.saveNodeAsReusable(workflowId, nodeId), input),
|
|
91
98
|
listWorkflows: () => transport.get(pipeline.workflows()),
|
|
92
99
|
saveWorkflow: (input) => transport.post(pipeline.workflows(), input),
|
|
93
100
|
publishWorkflow: (id) => transport.post(pipeline.publishWorkflow(id), {}),
|
|
@@ -191,6 +198,17 @@ export const catalogQueryKeys = {
|
|
|
191
198
|
* today's code, which is the one thing it exists not to do.
|
|
192
199
|
*/
|
|
193
200
|
transformRevisions: (id) => ['nestjs-catalog', 'pipeline', 'transforms', id, 'revisions'],
|
|
201
|
+
/**
|
|
202
|
+
* Which graphs run one transform, keyed UNDER `transforms` for the reason its
|
|
203
|
+
* neighbour above is: saving a graph is what changes this, and the list
|
|
204
|
+
* invalidation a save already performs has to reach it — a usage count that
|
|
205
|
+
* kept yesterday's number is worse than none, because it is read by somebody
|
|
206
|
+
* deciding whether an edit is safe.
|
|
207
|
+
*/
|
|
208
|
+
transformWorkflows: (id) => ['nestjs-catalog', 'pipeline', 'transforms', id, 'workflows'],
|
|
209
|
+
reusableNodes: ['nestjs-catalog', 'pipeline', 'reusable-nodes'],
|
|
210
|
+
/** Keyed under `reusableNodes`, so saving one invalidates its usage list too. */
|
|
211
|
+
reusableNodeWorkflows: (id) => ['nestjs-catalog', 'pipeline', 'reusable-nodes', id, 'workflows'],
|
|
194
212
|
runs: (connectorId) => ['nestjs-catalog', 'pipeline', 'runs', connectorId ?? 'all'],
|
|
195
213
|
/**
|
|
196
214
|
* One type's resolved load expectation.
|
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 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 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
|
@@ -170,7 +170,43 @@ export interface PipelineRoutes {
|
|
|
170
170
|
* traceable and the code did not.
|
|
171
171
|
*/
|
|
172
172
|
transformRevisions(id: string): string;
|
|
173
|
+
/**
|
|
174
|
+
* Which graphs run this transform, and at which node within each.
|
|
175
|
+
*
|
|
176
|
+
* The sibling of {@link PipelineRoutes.connectionWorkflows}, one shared object
|
|
177
|
+
* over. Both are pressed by somebody about to change something and wondering
|
|
178
|
+
* who is downstream, and both are answerable only because the reference is by
|
|
179
|
+
* id rather than by copy.
|
|
180
|
+
*
|
|
181
|
+
* A sub-resource rather than a count on `transforms`, unlike
|
|
182
|
+
* {@link PipelineRoutes.reusableNodes} which does carry one. The difference is
|
|
183
|
+
* where the number is read: a reusable node's count is rendered on the row of
|
|
184
|
+
* a picker somebody is about to click, and a transform's is read once, in an
|
|
185
|
+
* editor already open on one transform.
|
|
186
|
+
*/
|
|
187
|
+
transformWorkflows(id: string): string;
|
|
173
188
|
tryTransform(): string;
|
|
189
|
+
/**
|
|
190
|
+
* Node bodies saved under a name and used from several graphs. GET lists
|
|
191
|
+
* (each with a `usedBy` count), POST creates or updates one.
|
|
192
|
+
*
|
|
193
|
+
* There is deliberately **no library screen** behind this, and no tab. The
|
|
194
|
+
* maintainer was explicit that reusable nodes belong where a node is added
|
|
195
|
+
* rather than in a listing of their own, so this list is the picker's source:
|
|
196
|
+
* the count rides along on every row, because a number that changes somebody's
|
|
197
|
+
* decision has to be there before the click rather than one request after it.
|
|
198
|
+
*/
|
|
199
|
+
reusableNodes(): string;
|
|
200
|
+
reusableNode(id: string): string;
|
|
201
|
+
/**
|
|
202
|
+
* Which graphs use this reusable node, and at which node within each.
|
|
203
|
+
*
|
|
204
|
+
* Reports each *node*, not each graph — three nodes in one graph are three
|
|
205
|
+
* places an edit lands, which is the question somebody about to edit a shared
|
|
206
|
+
* body is actually asking. {@link PipelineRoutes.connectionWorkflows} reports
|
|
207
|
+
* each graph once, because deleting a connection breaks a graph once.
|
|
208
|
+
*/
|
|
209
|
+
reusableNodeWorkflows(id: string): string;
|
|
174
210
|
/**
|
|
175
211
|
* Authored graphs of transforms. GET lists, POST creates or updates.
|
|
176
212
|
*
|
|
@@ -218,6 +254,18 @@ export interface PipelineRoutes {
|
|
|
218
254
|
* a source has a shape to report.
|
|
219
255
|
*/
|
|
220
256
|
discoverSourceSchema(id: string, nodeId: string): string;
|
|
257
|
+
/**
|
|
258
|
+
* Lift one node of a graph into a reusable node, by reference.
|
|
259
|
+
*
|
|
260
|
+
* Beside `.../discover` because it is the same shape of thing: an action on
|
|
261
|
+
* one node of one graph. It stores the body and answers with the reusable
|
|
262
|
+
* node and the `useId` to put on that node — **it does not edit the graph**,
|
|
263
|
+
* because a route that stored one thing and silently rewrote another would
|
|
264
|
+
* move a graph's version for a reason its author cannot see in their own diff.
|
|
265
|
+
* The caller sets `useId` and saves the graph, which is one ordinary
|
|
266
|
+
* {@link PipelineRoutes.workflows} POST.
|
|
267
|
+
*/
|
|
268
|
+
saveNodeAsReusable(id: string, nodeId: string): string;
|
|
221
269
|
/**
|
|
222
270
|
* Every per-type load expectation an operator has stored.
|
|
223
271
|
*
|
package/dist/routes.js
CHANGED
|
@@ -143,7 +143,11 @@ export function pipelineRoutes(basePath = DEFAULT_PIPELINE_BASE_PATH) {
|
|
|
143
143
|
transforms: () => `${base}/transforms`,
|
|
144
144
|
transform: (id) => `${base}/transforms/${encodeURIComponent(id)}`,
|
|
145
145
|
transformRevisions: (id) => `${base}/transforms/${encodeURIComponent(id)}/revisions`,
|
|
146
|
+
transformWorkflows: (id) => `${base}/transforms/${encodeURIComponent(id)}/workflows`,
|
|
146
147
|
tryTransform: () => `${base}/transforms/try`,
|
|
148
|
+
reusableNodes: () => `${base}/reusable-nodes`,
|
|
149
|
+
reusableNode: (id) => `${base}/reusable-nodes/${encodeURIComponent(id)}`,
|
|
150
|
+
reusableNodeWorkflows: (id) => `${base}/reusable-nodes/${encodeURIComponent(id)}/workflows`,
|
|
147
151
|
workflows: () => `${base}/workflows`,
|
|
148
152
|
workflow: (id) => `${base}/workflows/${encodeURIComponent(id)}`,
|
|
149
153
|
publishWorkflow: (id) => `${base}/workflows/${encodeURIComponent(id)}/publish`,
|
|
@@ -151,6 +155,7 @@ export function pipelineRoutes(basePath = DEFAULT_PIPELINE_BASE_PATH) {
|
|
|
151
155
|
runWorkflow: (id) => `${base}/workflows/${encodeURIComponent(id)}/run`,
|
|
152
156
|
workflowSchedule: (id) => `${base}/workflows/${encodeURIComponent(id)}/schedule`,
|
|
153
157
|
discoverSourceSchema: (id, nodeId) => `${base}/workflows/${encodeURIComponent(id)}/nodes/${encodeURIComponent(nodeId)}/discover`,
|
|
158
|
+
saveNodeAsReusable: (id, nodeId) => `${base}/workflows/${encodeURIComponent(id)}/nodes/${encodeURIComponent(nodeId)}/save-as-reusable`,
|
|
154
159
|
loadExpectations: () => expectations.expectations(),
|
|
155
160
|
loadExpectation: (typeName) => expectations.expectation(typeName),
|
|
156
161
|
};
|
package/dist/workflow/graph.js
CHANGED
|
@@ -371,6 +371,26 @@ export function toFlowEdges(edges, nodes, brokenEdgeIds, flowing = new Set()) {
|
|
|
371
371
|
flowing: flowing.has(edgeId(edge)),
|
|
372
372
|
}));
|
|
373
373
|
}
|
|
374
|
+
/**
|
|
375
|
+
* The arrowhead, hoisted out of the edge builder — and this is a bug fix, not tidying.
|
|
376
|
+
*
|
|
377
|
+
* React Flow keeps one `<defs>` of marker definitions, derived from the markers
|
|
378
|
+
* its edges reference. `toFlowEdges` is memoised on `draft.nodes`, so **every
|
|
379
|
+
* frame of a node drag rebuilds the whole edge array**, and a fresh
|
|
380
|
+
* `{ type, width, height }` literal per edge per frame churned that registry:
|
|
381
|
+
* for the instant the defs were being rebuilt, `marker-end="url(#…)"` pointed at
|
|
382
|
+
* nothing. The line survived — it is a `path` — and the arrowhead vanished,
|
|
383
|
+
* which is exactly what somebody dragging a node reported seeing.
|
|
384
|
+
*
|
|
385
|
+
* One frozen object, referenced by every edge, gives the registry a stable
|
|
386
|
+
* identity to dedupe on. Frozen rather than merely `const` because it is now
|
|
387
|
+
* shared by every edge on the canvas, and a mutation would move all of them.
|
|
388
|
+
*/
|
|
389
|
+
const ARROW_END = Object.freeze({
|
|
390
|
+
type: MarkerType.ArrowClosed,
|
|
391
|
+
width: 14,
|
|
392
|
+
height: 14,
|
|
393
|
+
});
|
|
374
394
|
/**
|
|
375
395
|
* One wire, drawn.
|
|
376
396
|
*
|
|
@@ -397,7 +417,7 @@ function toFlowEdge(edge, context) {
|
|
|
397
417
|
animated: context.flowing,
|
|
398
418
|
// An arrowhead, because "the output of this feeds that" is directional and
|
|
399
419
|
// a plain line says only that two nodes are related.
|
|
400
|
-
markerEnd:
|
|
420
|
+
markerEnd: ARROW_END,
|
|
401
421
|
label: edge.branch,
|
|
402
422
|
labelStyle: branch ? { fill: branch.text, fontSize: 10, fontWeight: 600 } : undefined,
|
|
403
423
|
// The word sits on the wire, so it takes the canvas behind it rather than a
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Taking an edit back, throwing the whole draft away, and not losing it by
|
|
3
|
+
* accident.
|
|
4
|
+
*
|
|
5
|
+
* WHY THIS IS ITS OWN FILE
|
|
6
|
+
* ------------------------
|
|
7
|
+
* Everything here is about the same one thing — the gap between what is on the
|
|
8
|
+
* canvas and what the server has — and none of it is about drawing a graph.
|
|
9
|
+
* `WorkflowCanvas.tsx` is already six thousand lines and is the file every
|
|
10
|
+
* feature wants to grow, so the rule that keeps it readable is that a concern
|
|
11
|
+
* with its own vocabulary gets its own module. This one has four words in it:
|
|
12
|
+
* an ACTION (the unit undo steps over), the PAST (the actions still takeable
|
|
13
|
+
* back), the BASELINE (the graph as the server last described it) and DIRTY
|
|
14
|
+
* (whether those two differ).
|
|
15
|
+
*
|
|
16
|
+
* WHAT THIS DOES NOT COVER, AND SAYS SO ON SCREEN
|
|
17
|
+
* ----------------------------------------------
|
|
18
|
+
* Undo is about the DRAFT and nothing else. Saving, publishing, running and
|
|
19
|
+
* deleting the workflow are requests the server has already answered; a control
|
|
20
|
+
* that appeared to unmake one of them would be promising something no client
|
|
21
|
+
* can deliver. The boundary is stated in {@link UNDO_SCOPE}, which is rendered —
|
|
22
|
+
* as a tooltip for a pointer and as text for a screen reader — rather than left
|
|
23
|
+
* in this comment, because a boundary somebody has to read the source to learn
|
|
24
|
+
* is not a boundary they will learn.
|
|
25
|
+
*
|
|
26
|
+
* WHY SNAPSHOTS RATHER THAN INVERSE COMMANDS
|
|
27
|
+
* ------------------------------------------
|
|
28
|
+
* The alternative is an undo stack of operations that know how to reverse
|
|
29
|
+
* themselves. That is smaller in memory and considerably more code, and every
|
|
30
|
+
* new gesture on the canvas is a new inverse that can be written wrongly — a
|
|
31
|
+
* wrong inverse is silent, and lands in a SAVED graph. A snapshot cannot be
|
|
32
|
+
* wrong about what the graph was. The cost is bounded by {@link UNDO_DEPTH} and
|
|
33
|
+
* by the fact that a snapshot holds the same node and edge ARRAYS the draft
|
|
34
|
+
* already held: this canvas replaces arrays rather than mutating them (see the
|
|
35
|
+
* copy note in `draftFrom`), so an entry costs four references, not a graph.
|
|
36
|
+
*/
|
|
37
|
+
import type { WorkflowEdge, WorkflowNode } from './model';
|
|
38
|
+
/**
|
|
39
|
+
* How many actions can be taken back.
|
|
40
|
+
*
|
|
41
|
+
* A cap rather than an unbounded stack, and 50 rather than 500, because the
|
|
42
|
+
* promise a history makes should be one it can keep at any graph size. Fifty
|
|
43
|
+
* snapshots of a hundred-node graph is fifty times four references — nothing —
|
|
44
|
+
* but the honesty matters more than the arithmetic: an unbounded stack grows
|
|
45
|
+
* with how long somebody has had the tab open, which is exactly the session
|
|
46
|
+
* where they can least afford the tab to get slow.
|
|
47
|
+
*
|
|
48
|
+
* At the limit the OLDEST entry is dropped, so undo always steps back from
|
|
49
|
+
* where the person is rather than refusing. What is lost is the ability to walk
|
|
50
|
+
* all the way to the beginning — and that is what Reset is for, which is why the
|
|
51
|
+
* two controls sit beside each other and why {@link resetDescription} says how
|
|
52
|
+
* many actions are about to go.
|
|
53
|
+
*/
|
|
54
|
+
export declare const UNDO_DEPTH = 50;
|
|
55
|
+
/**
|
|
56
|
+
* How long a run of edits stays open, when nothing else closes it.
|
|
57
|
+
*
|
|
58
|
+
* The fallback half of the granularity rule. A gesture with a real end — a drag
|
|
59
|
+
* — says so through `continuing` and ignores this entirely; a gesture without
|
|
60
|
+
* one — typing into a field, holding an arrow key — has only elapsed time to go
|
|
61
|
+
* on. 700ms is longer than a fast typist's inter-key gap and shorter than the
|
|
62
|
+
* pause somebody makes when they stop to think, which is the boundary between
|
|
63
|
+
* "still writing the name" and "wrote the name, then did something else".
|
|
64
|
+
*/
|
|
65
|
+
export declare const RUN_WINDOW_MS = 700;
|
|
66
|
+
/** What undo can and cannot reach, in the words the controls use. */
|
|
67
|
+
export declare const UNDO_SCOPE: string;
|
|
68
|
+
/** Said once, when somebody reaches for a redo that deliberately does not exist. */
|
|
69
|
+
export declare const NO_REDO = "There is no redo on this canvas. Undo only steps backwards; Reset returns the whole drawing to the last saved version.";
|
|
70
|
+
/**
|
|
71
|
+
* The part of a draft an edit can change.
|
|
72
|
+
*
|
|
73
|
+
* Deliberately not the whole draft: `id` and `version` are the server's answers
|
|
74
|
+
* about which stored graph this is, and an undo that could change them would be
|
|
75
|
+
* an undo that quietly retargets the next save.
|
|
76
|
+
*/
|
|
77
|
+
export interface DraftSnapshot {
|
|
78
|
+
name: string;
|
|
79
|
+
description: string;
|
|
80
|
+
nodes: WorkflowNode[];
|
|
81
|
+
edges: WorkflowEdge[];
|
|
82
|
+
}
|
|
83
|
+
/** One takeable-back action: what the draft was before it, and what to call it. */
|
|
84
|
+
export interface HistoryEntry {
|
|
85
|
+
before: DraftSnapshot;
|
|
86
|
+
/**
|
|
87
|
+
* A past-tense phrase, announced as `Undone: {label}.`
|
|
88
|
+
*
|
|
89
|
+
* Written from the CALLER's vocabulary rather than from the diff, because a
|
|
90
|
+
* label derived from what changed says "two edges removed" where the person
|
|
91
|
+
* pressed "delete Out" — and the whole job of this string is to be recognised
|
|
92
|
+
* by somebody who cannot see what moved.
|
|
93
|
+
*/
|
|
94
|
+
label: string;
|
|
95
|
+
/** Consecutive edits sharing a run key fold into this one entry. */
|
|
96
|
+
run?: string;
|
|
97
|
+
at: number;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* What an edit says about itself.
|
|
101
|
+
*
|
|
102
|
+
* Every call site passes one. There is no default, on purpose: an unlabelled
|
|
103
|
+
* entry is an undo that announces nothing, and the moment a default exists it is
|
|
104
|
+
* what new call sites get.
|
|
105
|
+
*/
|
|
106
|
+
export interface EditAction {
|
|
107
|
+
label: string;
|
|
108
|
+
/**
|
|
109
|
+
* Names the gesture, when this edit is one frame of a longer one. Two edits
|
|
110
|
+
* fold together only when their keys match, so dragging node A and then node B
|
|
111
|
+
* are always two entries even back to back.
|
|
112
|
+
*/
|
|
113
|
+
run?: string;
|
|
114
|
+
/**
|
|
115
|
+
* Set while the gesture is demonstrably still happening — a pointer still
|
|
116
|
+
* down. Folds into the open run however long it has been going, which is what
|
|
117
|
+
* keeps a slow drag with a pause in the middle one action rather than two.
|
|
118
|
+
*/
|
|
119
|
+
continuing?: boolean;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* The draft fields this module owns.
|
|
123
|
+
*
|
|
124
|
+
* Structural rather than an import of `Draft`, which lives in `WorkflowCanvas`
|
|
125
|
+
* and would make this a cycle. The canvas's `Draft` extends it, so the two
|
|
126
|
+
* cannot drift without the compiler saying so.
|
|
127
|
+
*/
|
|
128
|
+
export interface HistoricDraft extends DraftSnapshot {
|
|
129
|
+
dirty: boolean;
|
|
130
|
+
/** Oldest first. The last entry is the next undo. */
|
|
131
|
+
past: HistoryEntry[];
|
|
132
|
+
/**
|
|
133
|
+
* The graph as the server last described it: the load, or the most recent
|
|
134
|
+
* save in this session.
|
|
135
|
+
*
|
|
136
|
+
* This is what makes Reset different from undoing to the beginning. Save
|
|
137
|
+
* halfway through a session and the baseline MOVES to that save — so Reset
|
|
138
|
+
* afterwards returns to the saved v2, not to the v1 the tab was opened on.
|
|
139
|
+
* Undoing forty times would walk past that save and back to v1, which is a
|
|
140
|
+
* different and much more surprising thing to hand somebody who asked to throw
|
|
141
|
+
* away their unsaved work.
|
|
142
|
+
*/
|
|
143
|
+
baseline: DraftSnapshot;
|
|
144
|
+
}
|
|
145
|
+
export declare function snapshotOf(draft: DraftSnapshot): DraftSnapshot;
|
|
146
|
+
/**
|
|
147
|
+
* Whether two snapshots are the same graph.
|
|
148
|
+
*
|
|
149
|
+
* Reference identity on the arrays, and that is the point rather than a
|
|
150
|
+
* shortcut. Nothing on this canvas mutates a node or an edge array in place —
|
|
151
|
+
* every path replaces — so two identical references ARE the same graph, and the
|
|
152
|
+
* comparison cannot report "unchanged" for a graph that has changed. It can
|
|
153
|
+
* report "changed" for a graph that has been edited back to where it started
|
|
154
|
+
* through two different arrays, and that asymmetry is the safe one: the only
|
|
155
|
+
* consequence is a save button that stays live and a leave-warning that still
|
|
156
|
+
* fires, which is a nuisance. The opposite error loses work.
|
|
157
|
+
*
|
|
158
|
+
* Undo restores the very arrays it recorded, so walking all the way back to the
|
|
159
|
+
* baseline compares equal and the draft goes genuinely clean — which is what
|
|
160
|
+
* makes the beforeunload guard below trustworthy enough to be worth having.
|
|
161
|
+
*/
|
|
162
|
+
export declare function sameSnapshot(a: DraftSnapshot, b: DraftSnapshot): boolean;
|
|
163
|
+
/**
|
|
164
|
+
* An edit, recorded.
|
|
165
|
+
*
|
|
166
|
+
* Pure, and it has to be: this runs inside a `setState` updater, which React is
|
|
167
|
+
* free to call twice for the same input. Nothing here reads or writes anything
|
|
168
|
+
* outside its arguments except the clock, and the clock only moves a timestamp
|
|
169
|
+
* that two calls a microsecond apart agree about anyway.
|
|
170
|
+
*/
|
|
171
|
+
export declare function withEdit<T extends HistoricDraft>(before: T, after: T, action: EditAction): T;
|
|
172
|
+
/** The next thing undo would take back, for a control that has to name it. */
|
|
173
|
+
export declare function nextUndo(draft: HistoricDraft): HistoryEntry | undefined;
|
|
174
|
+
/**
|
|
175
|
+
* One action back.
|
|
176
|
+
*
|
|
177
|
+
* Returns the label as well as the draft because the announcement is half the
|
|
178
|
+
* feature: undo can revert something that is scrolled off the canvas, and a
|
|
179
|
+
* silent revert of an invisible thing is indistinguishable from nothing
|
|
180
|
+
* happening.
|
|
181
|
+
*/
|
|
182
|
+
export declare function undone<T extends HistoricDraft>(draft: T): {
|
|
183
|
+
draft: T;
|
|
184
|
+
label: string;
|
|
185
|
+
} | null;
|
|
186
|
+
/**
|
|
187
|
+
* All the way back to the last saved version.
|
|
188
|
+
*
|
|
189
|
+
* The history goes with it. Keeping it would offer to undo the reset, which is
|
|
190
|
+
* a redo of everything by another name — and this module does not have one.
|
|
191
|
+
*/
|
|
192
|
+
export declare function reverted<T extends HistoricDraft>(draft: T): T;
|
|
193
|
+
/** The ids still in the graph, for the per-node bookkeeping the canvas keeps. */
|
|
194
|
+
export declare function keepKnown(ids: ReadonlySet<string>, nodes: WorkflowNode[]): ReadonlySet<string>;
|
|
195
|
+
/** How many nodes, named where naming them is short enough to be useful. */
|
|
196
|
+
export declare function namesOf(nodes: WorkflowNode[], ids: Iterable<string>): string;
|
|
197
|
+
/**
|
|
198
|
+
* One edit to a node, described by which of its fields moved.
|
|
199
|
+
*
|
|
200
|
+
* The run key carries the CHANGED FIELDS, not just the node, and that is the
|
|
201
|
+
* difference between a useful granularity and an irritating one: typing into a
|
|
202
|
+
* name box folds into one action, but typing a name and then flipping a switch
|
|
203
|
+
* on the same node a moment later stays two — because the second edit touches a
|
|
204
|
+
* different field and so opens a new run. Without the field in the key those two
|
|
205
|
+
* would merge, and undoing the switch would silently retype the name.
|
|
206
|
+
*
|
|
207
|
+
* The fields are read through `Object.entries` rather than by name: a node is a
|
|
208
|
+
* union of six shapes with different fields each, and a hand-written list here
|
|
209
|
+
* would go quietly out of date the next time a node kind gains one — which
|
|
210
|
+
* shows up as an edit that mysteriously will not undo on its own.
|
|
211
|
+
*/
|
|
212
|
+
export declare function nodeEditAction(before: WorkflowNode | undefined, after: WorkflowNode): EditAction;
|
|
213
|
+
/** What Reset is about to do, in the numbers the person can check it against. */
|
|
214
|
+
export declare function resetDescription(draft: HistoricDraft): string;
|
|
215
|
+
/**
|
|
216
|
+
* A tab that will not close on unsaved work without asking.
|
|
217
|
+
*
|
|
218
|
+
* Registered only while there IS unsaved work, which is the whole design
|
|
219
|
+
* constraint: a page that always warns teaches people to dismiss the dialog
|
|
220
|
+
* without reading it, and then it is not a guard, it is a habit. Cleaning up on
|
|
221
|
+
* `dirty` going false is what makes a save silence it immediately.
|
|
222
|
+
*
|
|
223
|
+
* The wording belongs to the browser — every engine ignores whatever string a
|
|
224
|
+
* page supplies here, and has for a decade — so this asks for the dialog and
|
|
225
|
+
* says nothing. `returnValue` is set as well as `preventDefault` because Chrome
|
|
226
|
+
* and Safari have historically disagreed about which one arms it.
|
|
227
|
+
*
|
|
228
|
+
* Nothing happens on a server: `useEffect` does not run there, so a host
|
|
229
|
+
* rendering this canvas into HTML sees no `window`.
|
|
230
|
+
*/
|
|
231
|
+
export declare function useUnsavedGuard(dirty: boolean): void;
|
|
232
|
+
/**
|
|
233
|
+
* Whether a key press belongs to something being typed into.
|
|
234
|
+
*
|
|
235
|
+
* The reason Cmd/Ctrl+Z can be bound at all. This canvas contains a name field,
|
|
236
|
+
* a description box, several config fields and a real code editor, and in every
|
|
237
|
+
* one of them Cmd+Z means "undo my typing" — a canvas-level binding that fired
|
|
238
|
+
* there would silently discard a graph edit instead, which is the worst possible
|
|
239
|
+
* outcome for a control whose entire job is not losing work.
|
|
240
|
+
*
|
|
241
|
+
* `closest` rather than the target itself: a contenteditable code surface puts
|
|
242
|
+
* the caret on a descendant span, so the event target is not the editable host.
|
|
243
|
+
* The dialog and sheet cases are the same argument one level up — a modal over
|
|
244
|
+
* the canvas is a different document with its own undo, and the canvas has no
|
|
245
|
+
* business acting on keys pressed inside it.
|
|
246
|
+
*
|
|
247
|
+
* Narrowed with `instanceof` rather than asserted: `event.target` is typed
|
|
248
|
+
* `EventTarget | null` and genuinely can be a `Window` or a text node.
|
|
249
|
+
*/
|
|
250
|
+
export declare function isTypingTarget(target: EventTarget | null): boolean;
|
|
251
|
+
/**
|
|
252
|
+
* Cmd/Ctrl+Z, on the canvas and nowhere else.
|
|
253
|
+
*
|
|
254
|
+
* Shift+Cmd/Ctrl+Z is caught deliberately rather than left to the browser: the
|
|
255
|
+
* hands that reach for it are expecting a redo, and silence would read as a
|
|
256
|
+
* broken shortcut. It says there is none, once, in the same live region
|
|
257
|
+
* everything else on this canvas speaks through.
|
|
258
|
+
*
|
|
259
|
+
* On `window` rather than on the canvas element because the canvas is not
|
|
260
|
+
* reliably focused — somebody who has just clicked a toolbar button, or closed
|
|
261
|
+
* the inspector, has focus on chrome — and a shortcut that only works when the
|
|
262
|
+
* right thing happens to be focused is a shortcut people stop trusting.
|
|
263
|
+
*/
|
|
264
|
+
export declare function useUndoShortcut({ enabled, onUndo, onSay, }: {
|
|
265
|
+
enabled: boolean;
|
|
266
|
+
onUndo: () => void;
|
|
267
|
+
onSay: (message: string) => void;
|
|
268
|
+
}): void;
|
|
269
|
+
/**
|
|
270
|
+
* Undo, Reset, and the fact that there is unsaved work — as one cluster.
|
|
271
|
+
*
|
|
272
|
+
* Together because they are one subject and answer each other: the chip says
|
|
273
|
+
* something is at risk, Undo takes back the last thing, Reset gives up on all of
|
|
274
|
+
* it. Split across the screen they would be three unrelated controls, and the
|
|
275
|
+
* chip in particular means nothing without something to do about it.
|
|
276
|
+
*
|
|
277
|
+
* The unsaved chip is `role="status"`, so it is announced when it appears rather
|
|
278
|
+
* than only when somebody goes looking. It appears once per clean→dirty
|
|
279
|
+
* transition, because its text does not change while dirty — a status that
|
|
280
|
+
* re-announced on every keystroke would be unusable.
|
|
281
|
+
*/
|
|
282
|
+
export declare function HistoryControls({ draft, canEdit, reducedMotion, resetting, onResettingChange, onUndo, onReset, }: {
|
|
283
|
+
draft: HistoricDraft;
|
|
284
|
+
canEdit: boolean;
|
|
285
|
+
/** No pulse for somebody who has asked their machine to stop moving things. */
|
|
286
|
+
reducedMotion: boolean;
|
|
287
|
+
resetting: boolean;
|
|
288
|
+
onResettingChange: (open: boolean) => void;
|
|
289
|
+
onUndo: () => void;
|
|
290
|
+
onReset: () => void;
|
|
291
|
+
}): import("react/jsx-runtime").JSX.Element;
|