@dudousxd/nestjs-catalog-react 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (239) hide show
  1. package/LICENSE-bklit +21 -0
  2. package/README.md +282 -0
  3. package/dist/AccessConsole.d.ts +40 -0
  4. package/dist/AccessConsole.js +160 -0
  5. package/dist/CatalogManager.d.ts +12 -0
  6. package/dist/CatalogManager.js +123 -0
  7. package/dist/ConnectionPanel.d.ts +41 -0
  8. package/dist/ConnectionPanel.js +228 -0
  9. package/dist/CoverageLedger.d.ts +16 -0
  10. package/dist/CoverageLedger.js +16 -0
  11. package/dist/DashboardBoard.d.ts +10 -0
  12. package/dist/DashboardBoard.js +206 -0
  13. package/dist/EditableField.d.ts +18 -0
  14. package/dist/EditableField.js +61 -0
  15. package/dist/FlowView.d.ts +13 -0
  16. package/dist/FlowView.js +93 -0
  17. package/dist/GovernanceTimeline.d.ts +16 -0
  18. package/dist/GovernanceTimeline.js +93 -0
  19. package/dist/ObjectExplorer.d.ts +9 -0
  20. package/dist/ObjectExplorer.js +153 -0
  21. package/dist/PipelineConsole.d.ts +20 -0
  22. package/dist/PipelineConsole.js +272 -0
  23. package/dist/QueryConsole.d.ts +11 -0
  24. package/dist/QueryConsole.js +144 -0
  25. package/dist/SavedQueryPanel.d.ts +16 -0
  26. package/dist/SavedQueryPanel.js +78 -0
  27. package/dist/TraceExplorer.d.ts +54 -0
  28. package/dist/TraceExplorer.js +342 -0
  29. package/dist/TransformEditor.d.ts +23 -0
  30. package/dist/TransformEditor.js +129 -0
  31. package/dist/WorkflowCanvas.d.ts +24 -0
  32. package/dist/WorkflowCanvas.js +701 -0
  33. package/dist/charts/bklit/animation.d.ts +19 -0
  34. package/dist/charts/bklit/animation.js +28 -0
  35. package/dist/charts/bklit/area-chart-loading.d.ts +33 -0
  36. package/dist/charts/bklit/area-chart-loading.js +30 -0
  37. package/dist/charts/bklit/area-chart.d.ts +47 -0
  38. package/dist/charts/bklit/area-chart.js +65 -0
  39. package/dist/charts/bklit/area-gradient-defs.d.ts +28 -0
  40. package/dist/charts/bklit/area-gradient-defs.js +23 -0
  41. package/dist/charts/bklit/area.d.ts +75 -0
  42. package/dist/charts/bklit/area.js +112 -0
  43. package/dist/charts/bklit/bar-chart-loading.d.ts +16 -0
  44. package/dist/charts/bklit/bar-chart-loading.js +22 -0
  45. package/dist/charts/bklit/bar-chart.d.ts +54 -0
  46. package/dist/charts/bklit/bar-chart.js +440 -0
  47. package/dist/charts/bklit/bar-depth-geometry.d.ts +41 -0
  48. package/dist/charts/bklit/bar-depth-geometry.js +46 -0
  49. package/dist/charts/bklit/bar-squares-layout.d.ts +36 -0
  50. package/dist/charts/bklit/bar-squares-layout.js +46 -0
  51. package/dist/charts/bklit/bar-squares.d.ts +48 -0
  52. package/dist/charts/bklit/bar-squares.js +206 -0
  53. package/dist/charts/bklit/bar-x-axis.d.ts +13 -0
  54. package/dist/charts/bklit/bar-x-axis.js +81 -0
  55. package/dist/charts/bklit/bar-y-axis.d.ts +11 -0
  56. package/dist/charts/bklit/bar-y-axis.js +72 -0
  57. package/dist/charts/bklit/bar.d.ts +40 -0
  58. package/dist/charts/bklit/bar.js +207 -0
  59. package/dist/charts/bklit/chart-child-passthrough.d.ts +25 -0
  60. package/dist/charts/bklit/chart-child-passthrough.js +82 -0
  61. package/dist/charts/bklit/chart-config-context.d.ts +34 -0
  62. package/dist/charts/bklit/chart-config-context.js +55 -0
  63. package/dist/charts/bklit/chart-context.d.ts +207 -0
  64. package/dist/charts/bklit/chart-context.js +200 -0
  65. package/dist/charts/bklit/chart-defs.d.ts +21 -0
  66. package/dist/charts/bklit/chart-defs.js +57 -0
  67. package/dist/charts/bklit/chart-formatters.d.ts +16 -0
  68. package/dist/charts/bklit/chart-formatters.js +26 -0
  69. package/dist/charts/bklit/chart-legend-hover.d.ts +21 -0
  70. package/dist/charts/bklit/chart-legend-hover.js +26 -0
  71. package/dist/charts/bklit/chart-loading-label.d.ts +9 -0
  72. package/dist/charts/bklit/chart-loading-label.js +29 -0
  73. package/dist/charts/bklit/chart-phase.d.ts +39 -0
  74. package/dist/charts/bklit/chart-phase.js +20 -0
  75. package/dist/charts/bklit/chart-reveal-clip.d.ts +32 -0
  76. package/dist/charts/bklit/chart-reveal-clip.js +23 -0
  77. package/dist/charts/bklit/dash-tail-stroke.d.ts +17 -0
  78. package/dist/charts/bklit/dash-tail-stroke.js +21 -0
  79. package/dist/charts/bklit/decimate-time-series.d.ts +18 -0
  80. package/dist/charts/bklit/decimate-time-series.js +120 -0
  81. package/dist/charts/bklit/fade-edges.d.ts +42 -0
  82. package/dist/charts/bklit/fade-edges.js +34 -0
  83. package/dist/charts/bklit/filter-data-by-x-domain.d.ts +13 -0
  84. package/dist/charts/bklit/filter-data-by-x-domain.js +50 -0
  85. package/dist/charts/bklit/generate-chart-skeleton-data.d.ts +24 -0
  86. package/dist/charts/bklit/generate-chart-skeleton-data.js +33 -0
  87. package/dist/charts/bklit/grid.d.ts +57 -0
  88. package/dist/charts/bklit/grid.js +88 -0
  89. package/dist/charts/bklit/highlight-segment-bounds.d.ts +26 -0
  90. package/dist/charts/bklit/highlight-segment-bounds.js +35 -0
  91. package/dist/charts/bklit/highlight-segment.d.ts +30 -0
  92. package/dist/charts/bklit/highlight-segment.js +22 -0
  93. package/dist/charts/bklit/indicator-fade.d.ts +23 -0
  94. package/dist/charts/bklit/indicator-fade.js +41 -0
  95. package/dist/charts/bklit/line-chart-loading.d.ts +33 -0
  96. package/dist/charts/bklit/line-chart-loading.js +30 -0
  97. package/dist/charts/bklit/line-chart.d.ts +45 -0
  98. package/dist/charts/bklit/line-chart.js +99 -0
  99. package/dist/charts/bklit/line-loading-pulse.d.ts +19 -0
  100. package/dist/charts/bklit/line-loading-pulse.js +132 -0
  101. package/dist/charts/bklit/line-loading-timing.d.ts +18 -0
  102. package/dist/charts/bklit/line-loading-timing.js +18 -0
  103. package/dist/charts/bklit/line-series-terminal-marker.d.ts +15 -0
  104. package/dist/charts/bklit/line-series-terminal-marker.js +54 -0
  105. package/dist/charts/bklit/line.d.ts +63 -0
  106. package/dist/charts/bklit/line.js +104 -0
  107. package/dist/charts/bklit/loading-sweep.d.ts +65 -0
  108. package/dist/charts/bklit/loading-sweep.js +182 -0
  109. package/dist/charts/bklit/motion-utils.d.ts +17 -0
  110. package/dist/charts/bklit/motion-utils.js +27 -0
  111. package/dist/charts/bklit/path-stroke-utils.d.ts +28 -0
  112. package/dist/charts/bklit/path-stroke-utils.js +64 -0
  113. package/dist/charts/bklit/pattern-area.d.ts +20 -0
  114. package/dist/charts/bklit/pattern-area.js +27 -0
  115. package/dist/charts/bklit/pattern-preset.d.ts +34 -0
  116. package/dist/charts/bklit/pattern-preset.js +82 -0
  117. package/dist/charts/bklit/projection-config.d.ts +19 -0
  118. package/dist/charts/bklit/projection-config.js +88 -0
  119. package/dist/charts/bklit/projection-line-end-marker.d.ts +14 -0
  120. package/dist/charts/bklit/projection-line-end-marker.js +35 -0
  121. package/dist/charts/bklit/projection-line.d.ts +39 -0
  122. package/dist/charts/bklit/projection-line.js +87 -0
  123. package/dist/charts/bklit/projection-utils.d.ts +54 -0
  124. package/dist/charts/bklit/projection-utils.js +252 -0
  125. package/dist/charts/bklit/reference-area-config.d.ts +18 -0
  126. package/dist/charts/bklit/reference-area-config.js +47 -0
  127. package/dist/charts/bklit/reference-area-registration-context.d.ts +7 -0
  128. package/dist/charts/bklit/reference-area-registration-context.js +15 -0
  129. package/dist/charts/bklit/series-bar-layout.d.ts +26 -0
  130. package/dist/charts/bklit/series-bar-layout.js +39 -0
  131. package/dist/charts/bklit/series-dash-tail-overlay.d.ts +16 -0
  132. package/dist/charts/bklit/series-dash-tail-overlay.js +47 -0
  133. package/dist/charts/bklit/series-highlight-layer.d.ts +31 -0
  134. package/dist/charts/bklit/series-highlight-layer.js +20 -0
  135. package/dist/charts/bklit/series-hover-dim.d.ts +28 -0
  136. package/dist/charts/bklit/series-hover-dim.js +34 -0
  137. package/dist/charts/bklit/series-markers.d.ts +13 -0
  138. package/dist/charts/bklit/series-markers.js +106 -0
  139. package/dist/charts/bklit/series-path-utils.d.ts +18 -0
  140. package/dist/charts/bklit/series-path-utils.js +68 -0
  141. package/dist/charts/bklit/series-point-marker.d.ts +47 -0
  142. package/dist/charts/bklit/series-point-marker.js +47 -0
  143. package/dist/charts/bklit/static-chart-preview-context.d.ts +15 -0
  144. package/dist/charts/bklit/static-chart-preview-context.js +20 -0
  145. package/dist/charts/bklit/time-series-chart-shell.d.ts +46 -0
  146. package/dist/charts/bklit/time-series-chart-shell.js +398 -0
  147. package/dist/charts/bklit/tooltip/chart-tooltip.d.ts +75 -0
  148. package/dist/charts/bklit/tooltip/chart-tooltip.js +158 -0
  149. package/dist/charts/bklit/tooltip/date-ticker.d.ts +10 -0
  150. package/dist/charts/bklit/tooltip/date-ticker.js +85 -0
  151. package/dist/charts/bklit/tooltip/index.d.ts +15 -0
  152. package/dist/charts/bklit/tooltip/index.js +15 -0
  153. package/dist/charts/bklit/tooltip/tooltip-box.d.ts +56 -0
  154. package/dist/charts/bklit/tooltip/tooltip-box.js +122 -0
  155. package/dist/charts/bklit/tooltip/tooltip-content.d.ts +26 -0
  156. package/dist/charts/bklit/tooltip/tooltip-content.js +8 -0
  157. package/dist/charts/bklit/tooltip/tooltip-dot.d.ts +27 -0
  158. package/dist/charts/bklit/tooltip/tooltip-dot.js +62 -0
  159. package/dist/charts/bklit/tooltip/tooltip-indicator.d.ts +44 -0
  160. package/dist/charts/bklit/tooltip/tooltip-indicator.js +73 -0
  161. package/dist/charts/bklit/use-animated-series-path.d.ts +18 -0
  162. package/dist/charts/bklit/use-animated-series-path.js +101 -0
  163. package/dist/charts/bklit/use-animated-y-domains.d.ts +13 -0
  164. package/dist/charts/bklit/use-animated-y-domains.js +158 -0
  165. package/dist/charts/bklit/use-chart-interaction.d.ts +40 -0
  166. package/dist/charts/bklit/use-chart-interaction.js +252 -0
  167. package/dist/charts/bklit/use-chart-phase-orchestrator.d.ts +22 -0
  168. package/dist/charts/bklit/use-chart-phase-orchestrator.js +147 -0
  169. package/dist/charts/bklit/use-enter-complete.d.ts +16 -0
  170. package/dist/charts/bklit/use-enter-complete.js +22 -0
  171. package/dist/charts/bklit/use-grid-shimmer.d.ts +15 -0
  172. package/dist/charts/bklit/use-grid-shimmer.js +71 -0
  173. package/dist/charts/bklit/use-highlight-segment.d.ts +22 -0
  174. package/dist/charts/bklit/use-highlight-segment.js +42 -0
  175. package/dist/charts/bklit/use-mount-progress.d.ts +12 -0
  176. package/dist/charts/bklit/use-mount-progress.js +30 -0
  177. package/dist/charts/bklit/use-scheduled-tooltip.d.ts +8 -0
  178. package/dist/charts/bklit/use-scheduled-tooltip.js +84 -0
  179. package/dist/charts/bklit/visx-pattern.d.ts +27 -0
  180. package/dist/charts/bklit/visx-pattern.js +28 -0
  181. package/dist/charts/bklit/x-axis.d.ts +26 -0
  182. package/dist/charts/bklit/x-axis.js +423 -0
  183. package/dist/charts/bklit/y-axis-scales.d.ts +34 -0
  184. package/dist/charts/bklit/y-axis-scales.js +80 -0
  185. package/dist/charts/bklit/y-axis-ticks.d.ts +20 -0
  186. package/dist/charts/bklit/y-axis-ticks.js +32 -0
  187. package/dist/charts/bklit/y-domain-utils.d.ts +26 -0
  188. package/dist/charts/bklit/y-domain-utils.js +96 -0
  189. package/dist/charts/bklit.d.ts +2 -0
  190. package/dist/charts/bklit.js +90 -0
  191. package/dist/charts/components/shimmering-text.d.ts +31 -0
  192. package/dist/charts/components/shimmering-text.js +39 -0
  193. package/dist/charts/css.d.ts +35 -0
  194. package/dist/charts/css.js +64 -0
  195. package/dist/charts/recharts.d.ts +28 -0
  196. package/dist/charts/recharts.js +48 -0
  197. package/dist/charts/registry.d.ts +34 -0
  198. package/dist/charts/registry.js +60 -0
  199. package/dist/charts/skeleton.d.ts +55 -0
  200. package/dist/charts/skeleton.js +66 -0
  201. package/dist/cn.d.ts +10 -0
  202. package/dist/cn.js +13 -0
  203. package/dist/context.d.ts +346 -0
  204. package/dist/context.js +95 -0
  205. package/dist/index.d.ts +30 -0
  206. package/dist/index.js +65 -0
  207. package/dist/routes.d.ts +70 -0
  208. package/dist/routes.js +73 -0
  209. package/dist/source-fields.d.ts +111 -0
  210. package/dist/source-fields.js +204 -0
  211. package/dist/ui/chart.d.ts +54 -0
  212. package/dist/ui/chart.js +122 -0
  213. package/dist/ui/dialog.d.ts +27 -0
  214. package/dist/ui/dialog.js +24 -0
  215. package/dist/ui/field.d.ts +29 -0
  216. package/dist/ui/field.js +31 -0
  217. package/dist/ui/select.d.ts +42 -0
  218. package/dist/ui/select.js +30 -0
  219. package/dist/ui/sheet.d.ts +38 -0
  220. package/dist/ui/sheet.js +37 -0
  221. package/dist/ui/switch.d.ts +17 -0
  222. package/dist/ui/switch.js +14 -0
  223. package/dist/ui/tabs.d.ts +30 -0
  224. package/dist/ui/tabs.js +36 -0
  225. package/dist/ui/tooltip.d.ts +37 -0
  226. package/dist/ui/tooltip.js +43 -0
  227. package/dist/workflow/graph.d.ts +112 -0
  228. package/dist/workflow/graph.js +297 -0
  229. package/dist/workflow/index.d.ts +16 -0
  230. package/dist/workflow/index.js +16 -0
  231. package/dist/workflow/model.d.ts +151 -0
  232. package/dist/workflow/model.js +97 -0
  233. package/dist/workflow/name.d.ts +28 -0
  234. package/dist/workflow/name.js +28 -0
  235. package/dist/workflow/nodes.d.ts +40 -0
  236. package/dist/workflow/nodes.js +86 -0
  237. package/dist/workflow/validate.d.ts +104 -0
  238. package/dist/workflow/validate.js +199 -0
  239. package/package.json +148 -0
@@ -0,0 +1,40 @@
1
+ import { type NodeProps } from '@xyflow/react';
2
+ import { type ReactNode } from 'react';
3
+ import type { WorkflowFlowNode } from './graph';
4
+ /**
5
+ * What a node can reach without being handed a callback in its `data`.
6
+ *
7
+ * A context rather than props on the node data, because React Flow re-creates
8
+ * a node's props from `data` and compares them: a handler in `data` is a new
9
+ * function identity on every render of the screen, which invalidates every node
10
+ * at once and makes dragging one node re-render all of them.
11
+ *
12
+ * The default throws rather than no-oping. A node rendered outside the canvas
13
+ * would otherwise look completely normal and quietly ignore every click, which
14
+ * is a much worse bug to find than an error naming the missing provider.
15
+ */
16
+ interface WorkflowNodeHandlers {
17
+ /** Open the inspector for this node. */
18
+ onInspect(nodeId: string): void;
19
+ /** Jump straight to the code editor for this node's transform. */
20
+ onEditCode(nodeId: string): void;
21
+ /** Whether editing is offered at all. */
22
+ canEdit: boolean;
23
+ }
24
+ export declare function WorkflowNodeProvider({ handlers, children, }: {
25
+ handlers: WorkflowNodeHandlers;
26
+ children: ReactNode;
27
+ }): import("react/jsx-runtime").JSX.Element;
28
+ export declare function WorkflowNodeBody({ id, data, selected }: NodeProps<WorkflowFlowNode>): import("react/jsx-runtime").JSX.Element;
29
+ /**
30
+ * Declared once, at module scope.
31
+ *
32
+ * React Flow compares `nodeTypes` by identity and warns — then remounts every
33
+ * node — when it changes. An object literal written inline in the screen is a
34
+ * new object on every render, so the canvas would tear down and rebuild the
35
+ * whole graph on each keystroke in the name field.
36
+ */
37
+ export declare const workflowNodeTypes: {
38
+ workflowNode: typeof WorkflowNodeBody;
39
+ };
40
+ export {};
@@ -0,0 +1,86 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Handle, Position } from '@xyflow/react';
3
+ import { CircleAlert, CircleCheck, Code2, Database, Loader2, Plug, Repeat, TriangleAlert, } from 'lucide-react';
4
+ import { createContext, useContext } from 'react';
5
+ import { cn } from '../cn';
6
+ import { Tooltip } from '../ui/tooltip';
7
+ const RULE = 'border-zinc-200 dark:border-zinc-800';
8
+ const PANEL = 'bg-white dark:bg-zinc-900';
9
+ const MUTED = 'text-zinc-400 dark:text-zinc-500';
10
+ const WorkflowNodeContext = createContext(null);
11
+ export function WorkflowNodeProvider({ handlers, children, }) {
12
+ return _jsx(WorkflowNodeContext.Provider, { value: handlers, children: children });
13
+ }
14
+ function useWorkflowNodeHandlers() {
15
+ const handlers = useContext(WorkflowNodeContext);
16
+ if (!handlers) {
17
+ throw new Error('A workflow node was rendered outside <WorkflowNodeProvider>.');
18
+ }
19
+ return handlers;
20
+ }
21
+ const KIND_STYLE = {
22
+ source: {
23
+ accent: 'bg-sky-500',
24
+ chip: 'text-sky-700 dark:text-sky-300',
25
+ icon: Plug,
26
+ noun: 'source',
27
+ },
28
+ transform: {
29
+ accent: 'bg-violet-500',
30
+ chip: 'text-violet-700 dark:text-violet-300',
31
+ icon: Repeat,
32
+ noun: 'transform',
33
+ },
34
+ sink: {
35
+ accent: 'bg-emerald-500',
36
+ chip: 'text-emerald-700 dark:text-emerald-300',
37
+ icon: Database,
38
+ noun: 'sink',
39
+ },
40
+ };
41
+ /**
42
+ * Handles are styled larger than React Flow's default 6px dot.
43
+ *
44
+ * A 6px target is fine for somebody with a mouse and a steady hand and awful
45
+ * for everybody else, and the whole interaction of this screen is landing a
46
+ * drag on one. `connectionRadius` on the canvas widens the drop zone; this
47
+ * widens what you can see to aim at.
48
+ */
49
+ const HANDLE = cn('!h-3 !w-3 !rounded-full !border-2', '!border-zinc-300 !bg-white dark:!border-zinc-600 dark:!bg-zinc-800',
50
+ // React Flow adds these while a connection is being dragged. Colouring them
51
+ // is what makes an illegal target — one that would close a loop, or a source
52
+ // that takes no input — visibly refuse *before* the mouse is released.
53
+ '[.react-flow__handle-connecting&]:!border-red-500', '[.react-flow__handle-valid&]:!border-emerald-500 [.react-flow__handle-valid&]:!bg-emerald-500');
54
+ function RunBadge({ run }) {
55
+ if (run.status === 'running') {
56
+ return (_jsx(Tooltip, { content: "Running now.", children: _jsx("span", { className: "flex items-center", children: _jsx(Loader2, { size: 11, className: "animate-spin text-sky-500" }) }) }));
57
+ }
58
+ if (run.status === 'failed') {
59
+ return (_jsx(Tooltip, { content: run.error ?? 'This step failed.', children: _jsx("span", { className: "flex items-center", children: _jsx(CircleAlert, { size: 11, className: "text-red-500" }) }) }));
60
+ }
61
+ if (run.status === 'succeeded') {
62
+ return (_jsx(Tooltip, { content: run.replayed
63
+ ? // The single most useful fact on a resumed run, and there is
64
+ // nowhere else on the screen to read it from.
65
+ 'Replayed from a checkpoint — this step did not run again.'
66
+ : `Ran${typeof run.rows === 'number' ? `, ${run.rows} rows` : ''}.`, children: _jsx("span", { className: "flex items-center", children: _jsx(CircleCheck, { size: 11, className: run.replayed ? 'text-zinc-400' : 'text-emerald-500' }) }) }));
67
+ }
68
+ return null;
69
+ }
70
+ export function WorkflowNodeBody({ id, data, selected }) {
71
+ const { onInspect, onEditCode, canEdit } = useWorkflowNodeHandlers();
72
+ const style = KIND_STYLE[data.kind];
73
+ const Icon = style.icon;
74
+ const errors = data.problems.filter((problem) => problem.level === 'error');
75
+ const warnings = data.problems.filter((problem) => problem.level === 'warning');
76
+ return (_jsxs("div", { className: cn('relative w-56 overflow-hidden rounded-lg border shadow-sm transition-shadow', RULE, PANEL, selected && 'ring-2 ring-violet-500/40', errors.length > 0 && 'border-red-400 dark:border-red-800', errors.length === 0 && warnings.length > 0 && 'border-amber-300 dark:border-amber-800'), children: [_jsx("span", { className: cn('absolute inset-y-0 left-0 w-1', style.accent) }), data.kind !== 'source' && (_jsx(Handle, { type: "target", position: Position.Left, className: HANDLE, "aria-label": `input of ${data.label}` })), data.kind !== 'sink' && (_jsx(Handle, { type: "source", position: Position.Right, className: HANDLE, "aria-label": `output of ${data.label}` })), _jsxs("div", { className: "pl-3 pr-2 py-2", children: [_jsxs("div", { className: "flex items-center gap-1.5", children: [_jsx(Icon, { size: 12, className: style.chip }), _jsx("span", { className: cn('font-mono text-[9px] uppercase tracking-[0.16em]', style.chip), children: style.noun }), _jsxs("span", { className: "ml-auto flex items-center gap-1", children: [data.run && _jsx(RunBadge, { run: data.run }), errors.length > 0 && (_jsx(Tooltip, { content: errors.map((p) => p.message).join(' '), children: _jsx("span", { className: "flex items-center", children: _jsx(CircleAlert, { size: 11, className: "text-red-500" }) }) })), errors.length === 0 && warnings.length > 0 && (_jsx(Tooltip, { content: warnings.map((p) => p.message).join(' '), children: _jsx("span", { className: "flex items-center", children: _jsx(TriangleAlert, { size: 11, className: "text-amber-500" }) }) }))] })] }), _jsxs("button", { type: "button", onClick: () => onInspect(id), className: "nodrag mt-1 block w-full text-left", children: [_jsx("span", { className: "block truncate text-[13px] font-medium", children: data.label }), _jsx("span", { className: cn('block truncate font-mono text-[10px]', MUTED), children: data.subtitle })] }), data.kind === 'transform' && canEdit && (_jsx("div", { className: "mt-1.5 flex", children: _jsx(Tooltip, { content: "Open this transform's code. The canvas stays where it is.", children: _jsxs("button", { type: "button", onClick: () => onEditCode(id), "aria-label": `Edit the code behind ${data.label}`, className: cn('nodrag flex items-center gap-1 rounded border px-1.5 py-0.5 font-mono text-[9px]', RULE, MUTED, 'hover:bg-zinc-50 dark:hover:bg-zinc-800'), children: [_jsx(Code2, { size: 9 }), "code"] }) }) }))] })] }));
77
+ }
78
+ /**
79
+ * Declared once, at module scope.
80
+ *
81
+ * React Flow compares `nodeTypes` by identity and warns — then remounts every
82
+ * node — when it changes. An object literal written inline in the screen is a
83
+ * new object on every render, so the canvas would tear down and rebuild the
84
+ * whole graph on each keystroke in the name field.
85
+ */
86
+ export const workflowNodeTypes = { workflowNode: WorkflowNodeBody };
@@ -0,0 +1,104 @@
1
+ import { type WorkflowEdge, type WorkflowIssueCode, type WorkflowNode } from '@dudousxd/nestjs-catalog/client';
2
+ /**
3
+ * What is wrong with a graph, checked in the browser while it is being drawn.
4
+ *
5
+ * **The rules are core's, not this file's.** `validateWorkflow` in
6
+ * `@dudousxd/nestjs-catalog` is pure and dependency-free and is exported from
7
+ * `/client` for exactly this purpose, so the canvas and the store run the same
8
+ * function over the same graph. This file used to carry its own copy of those
9
+ * rules and they had already drifted: it checked a `connectorId` field the
10
+ * executable model does not have, and reported "does not name a connector" on a
11
+ * source that ran perfectly well. A validator that flags correct graphs is worse
12
+ * than no validator, because people learn to ignore it and then they ignore the
13
+ * real one.
14
+ *
15
+ * What is left here is the part core genuinely cannot answer:
16
+ *
17
+ * - **Mid-drag connection legality.** `canConnect` is asked before an edge
18
+ * exists, on every pointer move, so React Flow can refuse the drop visibly.
19
+ * Core validates a graph that already has the edge in it.
20
+ * - **A transform naming something that was deleted.** Core has no idea which
21
+ * transforms exist; only a screen holding the list does.
22
+ * - **A sink with no object type.** Core's type requires `targetType` on a sink
23
+ * but its validator never checks that the string is non-empty, and the server
24
+ * refuses one that is. The check is additive, not contradictory.
25
+ * - **Two sinks writing the same type.** Core reports it as `duplicate-sink-type`.
26
+ *
27
+ * The consequence worth stating: nothing in the canvas may *skip* a server check
28
+ * because this passed. Save always goes to the server, the server's refusal
29
+ * always wins, and a graph with no problems here can still be rejected — core
30
+ * sees which types exist and who may write to them, and this does not.
31
+ */
32
+ export type WorkflowProblemLevel = 'error' | 'warning';
33
+ /**
34
+ * Core's codes, plus the three this screen adds.
35
+ *
36
+ * Core's are re-used verbatim rather than remapped so that a caller — or a test
37
+ * — matching on a code matches the same string the server would have sent back.
38
+ */
39
+ export type WorkflowProblemCode = WorkflowIssueCode | 'missing-transform' | 'sink-has-no-type' | 'duplicate-sink-type';
40
+ export interface WorkflowProblem {
41
+ level: WorkflowProblemLevel;
42
+ code: WorkflowProblemCode;
43
+ message: string;
44
+ /** Which nodes to ring on the canvas. Empty means the graph as a whole. */
45
+ nodeIds: string[];
46
+ /** Which wires to draw in red. Derived here; core reports nodes only. */
47
+ edgeIds: string[];
48
+ }
49
+ export interface WorkflowDraft {
50
+ nodes: WorkflowNode[];
51
+ edges: WorkflowEdge[];
52
+ }
53
+ export interface ValidateOptions {
54
+ /**
55
+ * Ids of transforms that currently exist. A node pointing at a transform
56
+ * somebody deleted still looks fine on the canvas and fails at run time, so
57
+ * the list is passed in rather than assumed complete.
58
+ */
59
+ transformIds: ReadonlySet<string>;
60
+ }
61
+ /**
62
+ * The identity React Flow needs, derived rather than stored.
63
+ *
64
+ * The executable model gives an edge no id of its own — `from` and `to` already
65
+ * identify a wire, and a second identity is something a canvas could let drift
66
+ * from the pair that actually matters. React Flow does need a string, so it is
67
+ * computed the same way everywhere from the only two fields there are.
68
+ */
69
+ export declare function edgeId(edge: WorkflowEdge): string;
70
+ export declare function validateWorkflow(draft: WorkflowDraft, options: ValidateOptions): WorkflowProblem[];
71
+ /**
72
+ * Would adding `from -> to` close a loop?
73
+ *
74
+ * Asked before the edge exists, which is the whole point: this is what lets the
75
+ * canvas refuse the connection at the moment somebody drags it, instead of
76
+ * accepting it and having core report a cycle a second later. A cycle exists iff
77
+ * `from` is already reachable from `to`.
78
+ */
79
+ export declare function wouldCycle(edges: WorkflowEdge[], from: string, to: string): boolean;
80
+ /**
81
+ * May these two be wired together?
82
+ *
83
+ * One function, two callers, and that is the point. React Flow's
84
+ * `isValidConnection` only wants a boolean and is asked on every pointer move
85
+ * during a drag, so it cannot be where the explanation lives; `onConnectEnd`
86
+ * and the keyboard wiring control both need the sentence. Two implementations
87
+ * would eventually disagree, and the disagreement would show up as a drag that
88
+ * is refused with no reason or a reason with no refusal.
89
+ *
90
+ * Every rule here is one core also enforces once the edge exists — a source
91
+ * takes no input, nothing runs after a sink, no duplicates, no loops. Asking
92
+ * them a moment earlier is the canvas's job; deciding what they are is not.
93
+ */
94
+ export type ConnectionVerdict = {
95
+ ok: true;
96
+ } | {
97
+ ok: false;
98
+ reason: string;
99
+ };
100
+ export declare function canConnect(nodes: WorkflowNode[], edges: WorkflowEdge[], from: string, to: string): ConnectionVerdict;
101
+ /** Convenience for the save button: errors block, warnings do not. */
102
+ export declare function hasBlockingProblem(problems: WorkflowProblem[]): boolean;
103
+ /** Node id -> the problems mentioning it, for ringing nodes on the canvas. */
104
+ export declare function problemsByNode(problems: WorkflowProblem[]): Map<string, WorkflowProblem[]>;
@@ -0,0 +1,199 @@
1
+ import { validateWorkflow as validateCoreWorkflow, } from '@dudousxd/nestjs-catalog/client';
2
+ import { nodeName } from './model';
3
+ import { WORKFLOW_NAME } from './name';
4
+ /**
5
+ * Core issues this canvas deliberately does not show, and the only place the two
6
+ * validators disagree.
7
+ *
8
+ * Both codes encode a rule that has been withdrawn: "a workflow produces exactly
9
+ * one object type". It was withdrawn because the whole reason a graph exists is
10
+ * one expensive read feeding several outputs — pull ten million rows once,
11
+ * derive vehicles and work orders from them — and one type per workflow means
12
+ * pulling twice. The partial-commit worry that motivated the rule was never
13
+ * specific to workflows: two connectors writing `Mvr` and `Subwo` can already
14
+ * half-fail today, and nobody calls that broken. The fix is to be explicit that
15
+ * each sink commits its own type independently, which this screen is, rather
16
+ * than to forbid the shape.
17
+ *
18
+ * The half of the rule that survives is enforced below as `duplicate-sink-type`:
19
+ * two sinks writing the *same* type really is ambiguous, because it is two
20
+ * snapshots of one type in one run with nothing to say which won.
21
+ *
22
+ * Core now agrees: it emits `duplicate-sink-type` and no longer has
23
+ * `multiple-sinks` or `mixed-output-types`. There is consequently nothing left
24
+ * to suppress, and the set is gone rather than left empty — an empty
25
+ * suppression list is an invitation to put something back in it, and a screen
26
+ * that hides one of the server's answers is a screen that will eventually
27
+ * promise a save the server refuses.
28
+ */
29
+ /** The wires an issue is really about, since core names nodes and not edges. */
30
+ function edgesFor(code, nodeIds, edges) {
31
+ if (code !== 'cycle' && code !== 'self-edge' && code !== 'duplicate-edge') {
32
+ return [];
33
+ }
34
+ const named = new Set(nodeIds);
35
+ return edges
36
+ .filter((edge) => named.has(edge.from) && named.has(edge.to))
37
+ .map((edge) => edgeId(edge));
38
+ }
39
+ /**
40
+ * The identity React Flow needs, derived rather than stored.
41
+ *
42
+ * The executable model gives an edge no id of its own — `from` and `to` already
43
+ * identify a wire, and a second identity is something a canvas could let drift
44
+ * from the pair that actually matters. React Flow does need a string, so it is
45
+ * computed the same way everywhere from the only two fields there are.
46
+ */
47
+ export function edgeId(edge) {
48
+ return `${edge.from}->${edge.to}`;
49
+ }
50
+ export function validateWorkflow(draft, options) {
51
+ const { nodes, edges } = draft;
52
+ const problems = [];
53
+ for (const issue of validateCoreWorkflow({ nodes, edges })) {
54
+ problems.push({
55
+ level: 'error',
56
+ code: issue.code,
57
+ message: issue.message,
58
+ nodeIds: issue.nodeIds,
59
+ edgeIds: edgesFor(issue.code, issue.nodeIds, edges),
60
+ });
61
+ }
62
+ // Everything below is canvas-only. It runs whatever core said, because these
63
+ // are different questions and suppressing them behind a structural error would
64
+ // make somebody fix one problem to be told about the next.
65
+ const sinkTypes = new Map();
66
+ for (const node of nodes) {
67
+ const name = nodeName(node);
68
+ if (node.kind === 'transform') {
69
+ if (node.transformId.length > 0 && !options.transformIds.has(node.transformId)) {
70
+ // A deleted transform is invisible on the canvas — the node keeps its
71
+ // name and its wiring, and only fails when the graph runs. Core cannot
72
+ // see this; it has no list of transforms.
73
+ problems.push({
74
+ level: 'error',
75
+ code: 'missing-transform',
76
+ message: `"${name}" points at a transform that no longer exists. It was probably deleted from the Transforms tab.`,
77
+ nodeIds: [node.id],
78
+ edgeIds: [],
79
+ });
80
+ }
81
+ continue;
82
+ }
83
+ if (node.kind !== 'sink')
84
+ continue;
85
+ const type = typeof node.targetType === 'string' ? node.targetType.trim() : '';
86
+ if (type.length === 0) {
87
+ problems.push({
88
+ level: 'error',
89
+ code: 'sink-has-no-type',
90
+ message: `"${name}" does not say which object type it writes, so there would be nothing for the run to commit into. The type is chosen on the sink because the sink is the node that commits.`,
91
+ nodeIds: [node.id],
92
+ edgeIds: [],
93
+ });
94
+ continue;
95
+ }
96
+ sinkTypes.set(type, [...(sinkTypes.get(type) ?? []), node.id]);
97
+ }
98
+ for (const [type, ids] of sinkTypes) {
99
+ if (ids.length < 2)
100
+ continue;
101
+ const named = ids
102
+ .map((id) => {
103
+ const node = nodes.find((candidate) => candidate.id === id);
104
+ return node ? `"${nodeName(node)}"` : `"${id}"`;
105
+ })
106
+ .join(' and ');
107
+ problems.push({
108
+ level: 'error',
109
+ code: 'duplicate-sink-type',
110
+ message: `${named} both write ${type}. Two sinks may write two different types — that is the point of a ${WORKFLOW_NAME.singular}, one read feeding several outputs — but two writing the same type would commit two snapshots of ${type} in one run with nothing to say which one won. Merge the branches into a single ${type} sink.`,
111
+ nodeIds: ids,
112
+ edgeIds: [],
113
+ });
114
+ }
115
+ return problems;
116
+ }
117
+ /**
118
+ * Would adding `from -> to` close a loop?
119
+ *
120
+ * Asked before the edge exists, which is the whole point: this is what lets the
121
+ * canvas refuse the connection at the moment somebody drags it, instead of
122
+ * accepting it and having core report a cycle a second later. A cycle exists iff
123
+ * `from` is already reachable from `to`.
124
+ */
125
+ export function wouldCycle(edges, from, to) {
126
+ if (from === to)
127
+ return true;
128
+ const out = new Map();
129
+ for (const edge of edges) {
130
+ out.set(edge.from, [...(out.get(edge.from) ?? []), edge.to]);
131
+ }
132
+ const seen = new Set([to]);
133
+ const stack = [to];
134
+ while (stack.length > 0) {
135
+ const current = stack.pop();
136
+ if (current === undefined)
137
+ break;
138
+ for (const next of out.get(current) ?? []) {
139
+ if (next === from)
140
+ return true;
141
+ if (seen.has(next))
142
+ continue;
143
+ seen.add(next);
144
+ stack.push(next);
145
+ }
146
+ }
147
+ return false;
148
+ }
149
+ export function canConnect(nodes, edges, from, to) {
150
+ if (from === to) {
151
+ return { ok: false, reason: 'A node cannot feed itself.' };
152
+ }
153
+ const source = nodes.find((node) => node.id === from);
154
+ const target = nodes.find((node) => node.id === to);
155
+ if (!source || !target) {
156
+ return { ok: false, reason: 'One end of that connection is not a node.' };
157
+ }
158
+ if (source.kind === 'sink') {
159
+ return {
160
+ ok: false,
161
+ reason: `"${nodeName(source)}" commits its rows. Nothing runs after a sink.`,
162
+ };
163
+ }
164
+ if (target.kind === 'source') {
165
+ return {
166
+ ok: false,
167
+ reason: `"${nodeName(target)}" reads from a system, so nothing can feed into it.`,
168
+ };
169
+ }
170
+ if (edges.some((edge) => edge.from === from && edge.to === to)) {
171
+ return {
172
+ ok: false,
173
+ reason: `Those two are already wired together, and wiring them twice would send "${nodeName(target)}" the same rows twice.`,
174
+ };
175
+ }
176
+ if (wouldCycle(edges, from, to)) {
177
+ return {
178
+ ok: false,
179
+ reason: `That would close a loop: "${nodeName(target)}" already feeds "${nodeName(source)}", directly or through other nodes. A ${WORKFLOW_NAME.singular} that loops has no order to run in.`,
180
+ };
181
+ }
182
+ return { ok: true };
183
+ }
184
+ /** Convenience for the save button: errors block, warnings do not. */
185
+ export function hasBlockingProblem(problems) {
186
+ return problems.some((problem) => problem.level === 'error');
187
+ }
188
+ /** Node id -> the problems mentioning it, for ringing nodes on the canvas. */
189
+ export function problemsByNode(problems) {
190
+ const byNode = new Map();
191
+ for (const problem of problems) {
192
+ for (const nodeId of problem.nodeIds) {
193
+ const list = byNode.get(nodeId) ?? [];
194
+ list.push(problem);
195
+ byNode.set(nodeId, list);
196
+ }
197
+ }
198
+ return byNode;
199
+ }
package/package.json ADDED
@@ -0,0 +1,148 @@
1
+ {
2
+ "name": "@dudousxd/nestjs-catalog-react",
3
+ "version": "0.1.0",
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
+ "license": "MIT",
6
+ "author": "Davide Carvalho",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/DavideCarvalho/nestjs-catalog.git",
10
+ "directory": "packages/react"
11
+ },
12
+ "keywords": [
13
+ "nestjs",
14
+ "catalog",
15
+ "metadata",
16
+ "react",
17
+ "admin"
18
+ ],
19
+ "type": "module",
20
+ "main": "dist/index.js",
21
+ "types": "dist/index.d.ts",
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/index.d.ts",
25
+ "default": "./dist/index.js"
26
+ },
27
+ "./recharts": {
28
+ "types": "./dist/charts/recharts.d.ts",
29
+ "default": "./dist/charts/recharts.js"
30
+ },
31
+ "./bklit": {
32
+ "types": "./dist/charts/bklit.d.ts",
33
+ "default": "./dist/charts/bklit.js"
34
+ },
35
+ "./workflow": {
36
+ "types": "./dist/workflow/index.d.ts",
37
+ "default": "./dist/workflow/index.js"
38
+ }
39
+ },
40
+ "files": [
41
+ "dist",
42
+ "LICENSE-bklit"
43
+ ],
44
+ "peerDependencies": {
45
+ "@base-ui/react": ">=1.6.0",
46
+ "@dnd-kit/core": ">=6",
47
+ "@dnd-kit/sortable": ">=10",
48
+ "@dnd-kit/utilities": ">=3",
49
+ "@tanstack/react-query": ">=5",
50
+ "@visx/curve": "4.0.1-alpha.0",
51
+ "@visx/event": "4.0.1-alpha.0",
52
+ "@visx/grid": "4.0.1-alpha.0",
53
+ "@visx/pattern": "4.0.1-alpha.0",
54
+ "@visx/responsive": "4.0.1-alpha.0",
55
+ "@visx/scale": "4.0.1-alpha.0",
56
+ "@visx/shape": "4.0.1-alpha.0",
57
+ "@xyflow/react": ">=12",
58
+ "d3-array": ">=3",
59
+ "d3-shape": ">=3",
60
+ "lucide-react": ">=0.400.0",
61
+ "motion": ">=11",
62
+ "prism-react-renderer": ">=2.4.0",
63
+ "react": ">=18",
64
+ "react-dom": ">=18",
65
+ "recharts": ">=2.12.0",
66
+ "@dudousxd/nestjs-catalog": ">=0.1.0"
67
+ },
68
+ "devDependencies": {
69
+ "@base-ui/react": "1.6.0",
70
+ "@dnd-kit/core": "6.3.1",
71
+ "@dnd-kit/sortable": "10.0.0",
72
+ "@dnd-kit/utilities": "3.2.2",
73
+ "@tanstack/react-query": "5.99.2",
74
+ "@types/d3-array": "^3.2.2",
75
+ "@types/d3-shape": "^3.1.8",
76
+ "@types/react": "19.2.14",
77
+ "@types/react-dom": "^19.2.4",
78
+ "@visx/curve": "4.0.1-alpha.0",
79
+ "@visx/event": "4.0.1-alpha.0",
80
+ "@visx/grid": "4.0.1-alpha.0",
81
+ "@visx/pattern": "4.0.1-alpha.0",
82
+ "@visx/responsive": "4.0.1-alpha.0",
83
+ "@visx/scale": "4.0.1-alpha.0",
84
+ "@visx/shape": "4.0.1-alpha.0",
85
+ "@xyflow/react": "12.11.2",
86
+ "clsx": "2.1.1",
87
+ "d3-array": "^3.2.4",
88
+ "d3-shape": "^3.2.0",
89
+ "lucide-react": "0.552.0",
90
+ "motion": "^12.43.0",
91
+ "prism-react-renderer": "2.4.1",
92
+ "react": "19.2.0",
93
+ "react-dom": "^19.2.8",
94
+ "recharts": "2.15.4",
95
+ "tailwind-merge": "3.4.1",
96
+ "typescript": "5.9.3",
97
+ "@dudousxd/nestjs-catalog": "0.1.0"
98
+ },
99
+ "dependencies": {
100
+ "clsx": "2.1.1",
101
+ "tailwind-merge": "3.4.1"
102
+ },
103
+ "peerDependenciesMeta": {
104
+ "recharts": {
105
+ "optional": true
106
+ },
107
+ "@dnd-kit/core": {
108
+ "optional": false
109
+ },
110
+ "@visx/curve": {
111
+ "optional": true
112
+ },
113
+ "@visx/event": {
114
+ "optional": true
115
+ },
116
+ "@visx/grid": {
117
+ "optional": true
118
+ },
119
+ "@visx/responsive": {
120
+ "optional": true
121
+ },
122
+ "@visx/scale": {
123
+ "optional": true
124
+ },
125
+ "@visx/shape": {
126
+ "optional": true
127
+ },
128
+ "@visx/pattern": {
129
+ "optional": true
130
+ },
131
+ "d3-array": {
132
+ "optional": true
133
+ },
134
+ "d3-shape": {
135
+ "optional": true
136
+ },
137
+ "motion": {
138
+ "optional": true
139
+ },
140
+ "@xyflow/react": {
141
+ "optional": true
142
+ }
143
+ },
144
+ "scripts": {
145
+ "build": "tsc -p tsconfig.json",
146
+ "dev": "tsc -p tsconfig.json --watch"
147
+ }
148
+ }