@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.
- package/LICENSE-bklit +21 -0
- package/README.md +282 -0
- package/dist/AccessConsole.d.ts +40 -0
- package/dist/AccessConsole.js +160 -0
- package/dist/CatalogManager.d.ts +12 -0
- package/dist/CatalogManager.js +123 -0
- package/dist/ConnectionPanel.d.ts +41 -0
- package/dist/ConnectionPanel.js +228 -0
- package/dist/CoverageLedger.d.ts +16 -0
- package/dist/CoverageLedger.js +16 -0
- package/dist/DashboardBoard.d.ts +10 -0
- package/dist/DashboardBoard.js +206 -0
- package/dist/EditableField.d.ts +18 -0
- package/dist/EditableField.js +61 -0
- package/dist/FlowView.d.ts +13 -0
- package/dist/FlowView.js +93 -0
- package/dist/GovernanceTimeline.d.ts +16 -0
- package/dist/GovernanceTimeline.js +93 -0
- package/dist/ObjectExplorer.d.ts +9 -0
- package/dist/ObjectExplorer.js +153 -0
- package/dist/PipelineConsole.d.ts +20 -0
- package/dist/PipelineConsole.js +272 -0
- package/dist/QueryConsole.d.ts +11 -0
- package/dist/QueryConsole.js +144 -0
- package/dist/SavedQueryPanel.d.ts +16 -0
- package/dist/SavedQueryPanel.js +78 -0
- package/dist/TraceExplorer.d.ts +54 -0
- package/dist/TraceExplorer.js +342 -0
- package/dist/TransformEditor.d.ts +23 -0
- package/dist/TransformEditor.js +129 -0
- package/dist/WorkflowCanvas.d.ts +24 -0
- package/dist/WorkflowCanvas.js +701 -0
- package/dist/charts/bklit/animation.d.ts +19 -0
- package/dist/charts/bklit/animation.js +28 -0
- package/dist/charts/bklit/area-chart-loading.d.ts +33 -0
- package/dist/charts/bklit/area-chart-loading.js +30 -0
- package/dist/charts/bklit/area-chart.d.ts +47 -0
- package/dist/charts/bklit/area-chart.js +65 -0
- package/dist/charts/bklit/area-gradient-defs.d.ts +28 -0
- package/dist/charts/bklit/area-gradient-defs.js +23 -0
- package/dist/charts/bklit/area.d.ts +75 -0
- package/dist/charts/bklit/area.js +112 -0
- package/dist/charts/bklit/bar-chart-loading.d.ts +16 -0
- package/dist/charts/bklit/bar-chart-loading.js +22 -0
- package/dist/charts/bklit/bar-chart.d.ts +54 -0
- package/dist/charts/bklit/bar-chart.js +440 -0
- package/dist/charts/bklit/bar-depth-geometry.d.ts +41 -0
- package/dist/charts/bklit/bar-depth-geometry.js +46 -0
- package/dist/charts/bklit/bar-squares-layout.d.ts +36 -0
- package/dist/charts/bklit/bar-squares-layout.js +46 -0
- package/dist/charts/bklit/bar-squares.d.ts +48 -0
- package/dist/charts/bklit/bar-squares.js +206 -0
- package/dist/charts/bklit/bar-x-axis.d.ts +13 -0
- package/dist/charts/bklit/bar-x-axis.js +81 -0
- package/dist/charts/bklit/bar-y-axis.d.ts +11 -0
- package/dist/charts/bklit/bar-y-axis.js +72 -0
- package/dist/charts/bklit/bar.d.ts +40 -0
- package/dist/charts/bklit/bar.js +207 -0
- package/dist/charts/bklit/chart-child-passthrough.d.ts +25 -0
- package/dist/charts/bklit/chart-child-passthrough.js +82 -0
- package/dist/charts/bklit/chart-config-context.d.ts +34 -0
- package/dist/charts/bklit/chart-config-context.js +55 -0
- package/dist/charts/bklit/chart-context.d.ts +207 -0
- package/dist/charts/bklit/chart-context.js +200 -0
- package/dist/charts/bklit/chart-defs.d.ts +21 -0
- package/dist/charts/bklit/chart-defs.js +57 -0
- package/dist/charts/bklit/chart-formatters.d.ts +16 -0
- package/dist/charts/bklit/chart-formatters.js +26 -0
- package/dist/charts/bklit/chart-legend-hover.d.ts +21 -0
- package/dist/charts/bklit/chart-legend-hover.js +26 -0
- package/dist/charts/bklit/chart-loading-label.d.ts +9 -0
- package/dist/charts/bklit/chart-loading-label.js +29 -0
- package/dist/charts/bklit/chart-phase.d.ts +39 -0
- package/dist/charts/bklit/chart-phase.js +20 -0
- package/dist/charts/bklit/chart-reveal-clip.d.ts +32 -0
- package/dist/charts/bklit/chart-reveal-clip.js +23 -0
- package/dist/charts/bklit/dash-tail-stroke.d.ts +17 -0
- package/dist/charts/bklit/dash-tail-stroke.js +21 -0
- package/dist/charts/bklit/decimate-time-series.d.ts +18 -0
- package/dist/charts/bklit/decimate-time-series.js +120 -0
- package/dist/charts/bklit/fade-edges.d.ts +42 -0
- package/dist/charts/bklit/fade-edges.js +34 -0
- package/dist/charts/bklit/filter-data-by-x-domain.d.ts +13 -0
- package/dist/charts/bklit/filter-data-by-x-domain.js +50 -0
- package/dist/charts/bklit/generate-chart-skeleton-data.d.ts +24 -0
- package/dist/charts/bklit/generate-chart-skeleton-data.js +33 -0
- package/dist/charts/bklit/grid.d.ts +57 -0
- package/dist/charts/bklit/grid.js +88 -0
- package/dist/charts/bklit/highlight-segment-bounds.d.ts +26 -0
- package/dist/charts/bklit/highlight-segment-bounds.js +35 -0
- package/dist/charts/bklit/highlight-segment.d.ts +30 -0
- package/dist/charts/bklit/highlight-segment.js +22 -0
- package/dist/charts/bklit/indicator-fade.d.ts +23 -0
- package/dist/charts/bklit/indicator-fade.js +41 -0
- package/dist/charts/bklit/line-chart-loading.d.ts +33 -0
- package/dist/charts/bklit/line-chart-loading.js +30 -0
- package/dist/charts/bklit/line-chart.d.ts +45 -0
- package/dist/charts/bklit/line-chart.js +99 -0
- package/dist/charts/bklit/line-loading-pulse.d.ts +19 -0
- package/dist/charts/bklit/line-loading-pulse.js +132 -0
- package/dist/charts/bklit/line-loading-timing.d.ts +18 -0
- package/dist/charts/bklit/line-loading-timing.js +18 -0
- package/dist/charts/bklit/line-series-terminal-marker.d.ts +15 -0
- package/dist/charts/bklit/line-series-terminal-marker.js +54 -0
- package/dist/charts/bklit/line.d.ts +63 -0
- package/dist/charts/bklit/line.js +104 -0
- package/dist/charts/bklit/loading-sweep.d.ts +65 -0
- package/dist/charts/bklit/loading-sweep.js +182 -0
- package/dist/charts/bklit/motion-utils.d.ts +17 -0
- package/dist/charts/bklit/motion-utils.js +27 -0
- package/dist/charts/bklit/path-stroke-utils.d.ts +28 -0
- package/dist/charts/bklit/path-stroke-utils.js +64 -0
- package/dist/charts/bklit/pattern-area.d.ts +20 -0
- package/dist/charts/bklit/pattern-area.js +27 -0
- package/dist/charts/bklit/pattern-preset.d.ts +34 -0
- package/dist/charts/bklit/pattern-preset.js +82 -0
- package/dist/charts/bklit/projection-config.d.ts +19 -0
- package/dist/charts/bklit/projection-config.js +88 -0
- package/dist/charts/bklit/projection-line-end-marker.d.ts +14 -0
- package/dist/charts/bklit/projection-line-end-marker.js +35 -0
- package/dist/charts/bklit/projection-line.d.ts +39 -0
- package/dist/charts/bklit/projection-line.js +87 -0
- package/dist/charts/bklit/projection-utils.d.ts +54 -0
- package/dist/charts/bklit/projection-utils.js +252 -0
- package/dist/charts/bklit/reference-area-config.d.ts +18 -0
- package/dist/charts/bklit/reference-area-config.js +47 -0
- package/dist/charts/bklit/reference-area-registration-context.d.ts +7 -0
- package/dist/charts/bklit/reference-area-registration-context.js +15 -0
- package/dist/charts/bklit/series-bar-layout.d.ts +26 -0
- package/dist/charts/bklit/series-bar-layout.js +39 -0
- package/dist/charts/bklit/series-dash-tail-overlay.d.ts +16 -0
- package/dist/charts/bklit/series-dash-tail-overlay.js +47 -0
- package/dist/charts/bklit/series-highlight-layer.d.ts +31 -0
- package/dist/charts/bklit/series-highlight-layer.js +20 -0
- package/dist/charts/bklit/series-hover-dim.d.ts +28 -0
- package/dist/charts/bklit/series-hover-dim.js +34 -0
- package/dist/charts/bklit/series-markers.d.ts +13 -0
- package/dist/charts/bklit/series-markers.js +106 -0
- package/dist/charts/bklit/series-path-utils.d.ts +18 -0
- package/dist/charts/bklit/series-path-utils.js +68 -0
- package/dist/charts/bklit/series-point-marker.d.ts +47 -0
- package/dist/charts/bklit/series-point-marker.js +47 -0
- package/dist/charts/bklit/static-chart-preview-context.d.ts +15 -0
- package/dist/charts/bklit/static-chart-preview-context.js +20 -0
- package/dist/charts/bklit/time-series-chart-shell.d.ts +46 -0
- package/dist/charts/bklit/time-series-chart-shell.js +398 -0
- package/dist/charts/bklit/tooltip/chart-tooltip.d.ts +75 -0
- package/dist/charts/bklit/tooltip/chart-tooltip.js +158 -0
- package/dist/charts/bklit/tooltip/date-ticker.d.ts +10 -0
- package/dist/charts/bklit/tooltip/date-ticker.js +85 -0
- package/dist/charts/bklit/tooltip/index.d.ts +15 -0
- package/dist/charts/bklit/tooltip/index.js +15 -0
- package/dist/charts/bklit/tooltip/tooltip-box.d.ts +56 -0
- package/dist/charts/bklit/tooltip/tooltip-box.js +122 -0
- package/dist/charts/bklit/tooltip/tooltip-content.d.ts +26 -0
- package/dist/charts/bklit/tooltip/tooltip-content.js +8 -0
- package/dist/charts/bklit/tooltip/tooltip-dot.d.ts +27 -0
- package/dist/charts/bklit/tooltip/tooltip-dot.js +62 -0
- package/dist/charts/bklit/tooltip/tooltip-indicator.d.ts +44 -0
- package/dist/charts/bklit/tooltip/tooltip-indicator.js +73 -0
- package/dist/charts/bklit/use-animated-series-path.d.ts +18 -0
- package/dist/charts/bklit/use-animated-series-path.js +101 -0
- package/dist/charts/bklit/use-animated-y-domains.d.ts +13 -0
- package/dist/charts/bklit/use-animated-y-domains.js +158 -0
- package/dist/charts/bklit/use-chart-interaction.d.ts +40 -0
- package/dist/charts/bklit/use-chart-interaction.js +252 -0
- package/dist/charts/bklit/use-chart-phase-orchestrator.d.ts +22 -0
- package/dist/charts/bklit/use-chart-phase-orchestrator.js +147 -0
- package/dist/charts/bklit/use-enter-complete.d.ts +16 -0
- package/dist/charts/bklit/use-enter-complete.js +22 -0
- package/dist/charts/bklit/use-grid-shimmer.d.ts +15 -0
- package/dist/charts/bklit/use-grid-shimmer.js +71 -0
- package/dist/charts/bklit/use-highlight-segment.d.ts +22 -0
- package/dist/charts/bklit/use-highlight-segment.js +42 -0
- package/dist/charts/bklit/use-mount-progress.d.ts +12 -0
- package/dist/charts/bklit/use-mount-progress.js +30 -0
- package/dist/charts/bklit/use-scheduled-tooltip.d.ts +8 -0
- package/dist/charts/bklit/use-scheduled-tooltip.js +84 -0
- package/dist/charts/bklit/visx-pattern.d.ts +27 -0
- package/dist/charts/bklit/visx-pattern.js +28 -0
- package/dist/charts/bklit/x-axis.d.ts +26 -0
- package/dist/charts/bklit/x-axis.js +423 -0
- package/dist/charts/bklit/y-axis-scales.d.ts +34 -0
- package/dist/charts/bklit/y-axis-scales.js +80 -0
- package/dist/charts/bklit/y-axis-ticks.d.ts +20 -0
- package/dist/charts/bklit/y-axis-ticks.js +32 -0
- package/dist/charts/bklit/y-domain-utils.d.ts +26 -0
- package/dist/charts/bklit/y-domain-utils.js +96 -0
- package/dist/charts/bklit.d.ts +2 -0
- package/dist/charts/bklit.js +90 -0
- package/dist/charts/components/shimmering-text.d.ts +31 -0
- package/dist/charts/components/shimmering-text.js +39 -0
- package/dist/charts/css.d.ts +35 -0
- package/dist/charts/css.js +64 -0
- package/dist/charts/recharts.d.ts +28 -0
- package/dist/charts/recharts.js +48 -0
- package/dist/charts/registry.d.ts +34 -0
- package/dist/charts/registry.js +60 -0
- package/dist/charts/skeleton.d.ts +55 -0
- package/dist/charts/skeleton.js +66 -0
- package/dist/cn.d.ts +10 -0
- package/dist/cn.js +13 -0
- package/dist/context.d.ts +346 -0
- package/dist/context.js +95 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +65 -0
- package/dist/routes.d.ts +70 -0
- package/dist/routes.js +73 -0
- package/dist/source-fields.d.ts +111 -0
- package/dist/source-fields.js +204 -0
- package/dist/ui/chart.d.ts +54 -0
- package/dist/ui/chart.js +122 -0
- package/dist/ui/dialog.d.ts +27 -0
- package/dist/ui/dialog.js +24 -0
- package/dist/ui/field.d.ts +29 -0
- package/dist/ui/field.js +31 -0
- package/dist/ui/select.d.ts +42 -0
- package/dist/ui/select.js +30 -0
- package/dist/ui/sheet.d.ts +38 -0
- package/dist/ui/sheet.js +37 -0
- package/dist/ui/switch.d.ts +17 -0
- package/dist/ui/switch.js +14 -0
- package/dist/ui/tabs.d.ts +30 -0
- package/dist/ui/tabs.js +36 -0
- package/dist/ui/tooltip.d.ts +37 -0
- package/dist/ui/tooltip.js +43 -0
- package/dist/workflow/graph.d.ts +112 -0
- package/dist/workflow/graph.js +297 -0
- package/dist/workflow/index.d.ts +16 -0
- package/dist/workflow/index.js +16 -0
- package/dist/workflow/model.d.ts +151 -0
- package/dist/workflow/model.js +97 -0
- package/dist/workflow/name.d.ts +28 -0
- package/dist/workflow/name.js +28 -0
- package/dist/workflow/nodes.d.ts +40 -0
- package/dist/workflow/nodes.js +86 -0
- package/dist/workflow/validate.d.ts +104 -0
- package/dist/workflow/validate.js +199 -0
- package/package.json +148 -0
package/LICENSE-bklit
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 uixmat
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
# @dudousxd/nestjs-catalog-react
|
|
2
|
+
|
|
3
|
+
Ready-made React screens for [`@dudousxd/nestjs-catalog`](../nestjs-catalog): a
|
|
4
|
+
model manager, an object explorer, a query console, dashboards, an activity
|
|
5
|
+
timeline, and the screens for getting data in and saying who may touch it.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @dudousxd/nestjs-catalog-react
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Use it
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { CatalogManager, CatalogProvider } from "@dudousxd/nestjs-catalog-react";
|
|
15
|
+
|
|
16
|
+
const transport = {
|
|
17
|
+
get: async (path, params) => (await api.get(path, { params })).data,
|
|
18
|
+
patch: async (path, body) => (await api.patch(path, body)).data,
|
|
19
|
+
post: async (path, body) => (await api.post(path, body)).data,
|
|
20
|
+
delete: async (path) => (await api.delete(path)).data,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
<CatalogProvider transport={transport}>
|
|
24
|
+
<CatalogManager title="Data model" explorerHref={(t) => `/explore?type=${t}`} />
|
|
25
|
+
</CatalogProvider>;
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
It asks for a **transport**, not a base URL. Every app that would install this
|
|
29
|
+
already has an HTTP client with its own auth interceptors, retries and error
|
|
30
|
+
reporting — bringing a second one along would make the console the one screen
|
|
31
|
+
that authenticates differently.
|
|
32
|
+
|
|
33
|
+
Requires a `QueryClientProvider` from `@tanstack/react-query` above it.
|
|
34
|
+
|
|
35
|
+
## What you get
|
|
36
|
+
|
|
37
|
+
- **`<CatalogManager />`** — browse types by group, see every property beside the
|
|
38
|
+
column it came from, and edit labels, descriptions and units inline. Edits are
|
|
39
|
+
presentation-only; nothing here can reach a migration.
|
|
40
|
+
- **`<ObjectExplorer />`** — one table for every type in the catalog. Columns,
|
|
41
|
+
labels, alignment and units all arrive with the data, so it knows nothing about
|
|
42
|
+
your domain.
|
|
43
|
+
- **`<QueryConsole />`**, **`<DashboardBoard />`** — SQL over the published
|
|
44
|
+
snapshots, saved queries, and cards built from them.
|
|
45
|
+
- **`<GovernanceTimeline />`**, **`<TraceExplorer />`** — what happened, flat and
|
|
46
|
+
grouped into causal stories.
|
|
47
|
+
- **`<PipelineConsole />`** — connections, connectors and transforms on one
|
|
48
|
+
screen, including a **Test connection** button that reports what actually
|
|
49
|
+
answered: a server version, a bucket and whether anything sits under the
|
|
50
|
+
prefix, an HTTP status.
|
|
51
|
+
- **`<WorkflowCanvas />`** — a drag-and-drop canvas for wiring transforms to
|
|
52
|
+
each other. On its own subpath (see [Workflows](#workflows)) because it needs
|
|
53
|
+
an optional peer.
|
|
54
|
+
- **`<AccessConsole />`** — which applications may touch what, and which people
|
|
55
|
+
sign in through them.
|
|
56
|
+
- **`<CoverageLedger />`**, **`<EditableField />`**, and the vendored primitives
|
|
57
|
+
under `ui/` — the pieces, if you want to assemble something else.
|
|
58
|
+
|
|
59
|
+
## Endpoints it expects
|
|
60
|
+
|
|
61
|
+
The catalog screens call paths the library's own controller serves, described by
|
|
62
|
+
`catalogRoutes` in `@dudousxd/nestjs-catalog/client`. Install the module and they
|
|
63
|
+
exist.
|
|
64
|
+
|
|
65
|
+
The pipeline and access screens are different, and the difference is deliberate.
|
|
66
|
+
The library defines the connector, connection and principal **model**, but ships
|
|
67
|
+
no controller for them — how a deployment exposes the code that reshapes its data
|
|
68
|
+
and who may create an account are decisions that belong to the deployment. So
|
|
69
|
+
this package states the shapes it needs and lets you mount them:
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
<CatalogProvider
|
|
73
|
+
transport={transport}
|
|
74
|
+
pipelineBasePath="/pipeline" // default
|
|
75
|
+
accessBasePath="/access" // default
|
|
76
|
+
>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
`pipelineRoutes()` and `accessRoutes()` are exported so you can see exactly what
|
|
80
|
+
is expected, and the response types are on the `CatalogClient` interface.
|
|
81
|
+
|
|
82
|
+
## Workflows
|
|
83
|
+
|
|
84
|
+
`<WorkflowCanvas />` is a canvas where nodes are transforms and edges mean "the
|
|
85
|
+
output of this feeds that". It ships on its own subpath and needs
|
|
86
|
+
[React Flow](https://reactflow.dev) — an **optional** peer, so a host that never
|
|
87
|
+
opens this screen pays nothing:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
pnpm add @xyflow/react
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
import { WorkflowCanvas } from "@dudousxd/nestjs-catalog-react/workflow";
|
|
95
|
+
|
|
96
|
+
<CatalogProvider transport={transport}>
|
|
97
|
+
<WorkflowCanvas />
|
|
98
|
+
</CatalogProvider>;
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
The package is **`@xyflow/react`**, not `reactflow`. The two are the same
|
|
102
|
+
project: `reactflow` is the v11 name, last published in mid-2024, and
|
|
103
|
+
`@xyflow/react` is the v12 line that succeeded it and is where the work
|
|
104
|
+
continues. Anything you find under the old name is a version behind by design.
|
|
105
|
+
It brings its own stylesheet, which the component imports itself — there is
|
|
106
|
+
nothing for a host to add, and React Flow renders as an unstyled pile of divs if
|
|
107
|
+
that import is missing, which looks like a broken canvas rather than a missing
|
|
108
|
+
line of setup.
|
|
109
|
+
|
|
110
|
+
The canvas colours itself from React Flow's `--xy-*` variables under the host's
|
|
111
|
+
own `dark:` class rather than React Flow's `colorMode` prop, because
|
|
112
|
+
`colorMode="system"` follows the operating system — which is not the same thing
|
|
113
|
+
as the theme the app is actually in.
|
|
114
|
+
|
|
115
|
+
### What it asks of the server
|
|
116
|
+
|
|
117
|
+
Three routes on top of the pipeline base path, listed by `pipelineRoutes()`:
|
|
118
|
+
|
|
119
|
+
| Route | Purpose |
|
|
120
|
+
| --- | --- |
|
|
121
|
+
| `GET/POST {base}/workflows` | list; create or update |
|
|
122
|
+
| `DELETE {base}/workflows/:id` | delete |
|
|
123
|
+
| `POST {base}/workflows/:id/run` | execute |
|
|
124
|
+
|
|
125
|
+
…plus one optional field on `GET {base}/capabilities`:
|
|
126
|
+
|
|
127
|
+
```jsonc
|
|
128
|
+
{ "languages": ["javascript"], "pythonPackages": [],
|
|
129
|
+
"durable": { "available": true, "engine": "nestjs-durable" } }
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**`durable` matters more than it looks.** Each node becomes its own durable step
|
|
133
|
+
when a durable engine is available, so a ten-node graph that fails at node seven
|
|
134
|
+
resumes at node seven; with no engine the whole graph runs inline and a failure
|
|
135
|
+
restarts it from the beginning. The screen states which of those the deployment
|
|
136
|
+
has, on the screen, not in a tooltip. Omitting the field is a **third** answer —
|
|
137
|
+
"this deployment did not say" — and the canvas renders it as such rather than
|
|
138
|
+
guessing, because a canvas implying resumability that does not exist is worse
|
|
139
|
+
than one that admits it does not know.
|
|
140
|
+
|
|
141
|
+
### The canvas warns; the server refuses
|
|
142
|
+
|
|
143
|
+
While a graph is being drawn the canvas checks it — a cycle, two sinks, a node
|
|
144
|
+
wired to nothing, a node pointing at a deleted transform — and shows the result
|
|
145
|
+
beside the node that caused it. A connection that would close a loop refuses
|
|
146
|
+
itself mid-drag rather than being accepted and reported afterwards.
|
|
147
|
+
|
|
148
|
+
None of that is authoritative and none of it gates a save. `POST /workflows` is
|
|
149
|
+
the only check that counts: it can see which types exist, who may write to them
|
|
150
|
+
and whether a transform's output fits the sink, and its refusal is shown
|
|
151
|
+
verbatim. The rules are exported (`validateWorkflow`, `canConnect`,
|
|
152
|
+
`wouldCycle`) so a host can run the same checks — never so it can skip the
|
|
153
|
+
server's.
|
|
154
|
+
|
|
155
|
+
### Keyboard and screen readers
|
|
156
|
+
|
|
157
|
+
React Flow makes nodes focusable, movable with the arrow keys and deletable, and
|
|
158
|
+
that is turned on. What it has no gesture for is *drawing an edge* — a
|
|
159
|
+
connection is a pointer drag and nothing else — so the node inspector carries a
|
|
160
|
+
**"send its output to…"** control listing only nodes that can legally take it,
|
|
161
|
+
filtered by the same rule the drag uses. Beside the canvas, a **Wiring** list
|
|
162
|
+
states every connection as operable text, since a picture is not a
|
|
163
|
+
representation for everybody. Each node's `aria-label` says what it is, what
|
|
164
|
+
feeds it, what it feeds and what is wrong with it; refusals and edits are
|
|
165
|
+
announced through a polite live region.
|
|
166
|
+
|
|
167
|
+
### Naming
|
|
168
|
+
|
|
169
|
+
The screen is called **Workflow** for now, in one constant (`WORKFLOW_NAME`).
|
|
170
|
+
Deliberately not "Flow": `<FlowView />` is *derived* lineage, reconstructed from
|
|
171
|
+
what publishers actually did, and this is an authored graph somebody wrote and
|
|
172
|
+
the server executes. Two screens sharing a name while making opposite claims
|
|
173
|
+
about where the truth lives is how people trust the wrong one.
|
|
174
|
+
|
|
175
|
+
## Styling
|
|
176
|
+
|
|
177
|
+
Plain Tailwind utilities from the default palette, with `dark:` variants. No
|
|
178
|
+
design tokens to define, no stylesheet to import, and no Tailwind plugins — the
|
|
179
|
+
open and close transitions use core utilities driven by data attributes rather
|
|
180
|
+
than `tailwindcss-animate`, so nothing renders half-styled because a plugin was
|
|
181
|
+
missing from a host's config.
|
|
182
|
+
|
|
183
|
+
Because the classes ship inside compiled JS, Tailwind needs to be told to look
|
|
184
|
+
at them:
|
|
185
|
+
|
|
186
|
+
```css
|
|
187
|
+
@source "../node_modules/@dudousxd/nestjs-catalog-react/dist/*.js";
|
|
188
|
+
@source "../node_modules/@dudousxd/nestjs-catalog-react/dist/**/*.js";
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Without those lines the screens render unstyled.
|
|
192
|
+
|
|
193
|
+
## Primitives
|
|
194
|
+
|
|
195
|
+
The components under `src/ui/` are vendored in the shadcn style — components you
|
|
196
|
+
own, not a dependency you take — and built on
|
|
197
|
+
[Base UI](https://base-ui.com) (`@base-ui/react`), which is where shadcn's
|
|
198
|
+
primitives are moving. Note that the older `@base-ui-components/react` package
|
|
199
|
+
name is deprecated on npm; this package uses the current one.
|
|
200
|
+
|
|
201
|
+
Base UI is a peer dependency, so a host already using it does not get a second
|
|
202
|
+
copy.
|
|
203
|
+
|
|
204
|
+
## Charts
|
|
205
|
+
|
|
206
|
+
Chart libraries are registered rather than imported, so a host pays only for the
|
|
207
|
+
one it wants. Two renderers ship, on their own subpaths:
|
|
208
|
+
|
|
209
|
+
```tsx
|
|
210
|
+
import { registerChartRenderer } from "@dudousxd/nestjs-catalog-react";
|
|
211
|
+
import { ShadcnChartRenderer } from "@dudousxd/nestjs-catalog-react/recharts";
|
|
212
|
+
import { BklitRenderer } from "@dudousxd/nestjs-catalog-react/bklit";
|
|
213
|
+
|
|
214
|
+
registerChartRenderer("recharts", ShadcnChartRenderer);
|
|
215
|
+
registerChartRenderer("bklit", BklitRenderer);
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
A saved query naming a library nobody registered falls back to the built-in CSS
|
|
219
|
+
renderer rather than failing — a dashboard should degrade to a plainer chart,
|
|
220
|
+
not to an error. `library` is stored data, so a query saved when a renderer was
|
|
221
|
+
registered outlives it, and this is what keeps such a card drawing something.
|
|
222
|
+
|
|
223
|
+
### The `bklit` renderer
|
|
224
|
+
|
|
225
|
+
Registered name: **`bklit`**. Its components are vendored (see Attribution
|
|
226
|
+
below), so selecting it needs no `@bklit/*` package — but it does need the peers
|
|
227
|
+
it is built on, all of them optional:
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
pnpm add @visx/curve@4.0.1-alpha.0 @visx/event@4.0.1-alpha.0 \
|
|
231
|
+
@visx/grid@4.0.1-alpha.0 @visx/pattern@4.0.1-alpha.0 \
|
|
232
|
+
@visx/responsive@4.0.1-alpha.0 @visx/scale@4.0.1-alpha.0 \
|
|
233
|
+
@visx/shape@4.0.1-alpha.0 d3-array d3-shape motion
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
**The visx pins are alpha (`4.0.1-alpha.0`)**, which is what bklit-ui is built
|
|
237
|
+
against — not a choice this package made, and worth knowing before you register
|
|
238
|
+
it in production.
|
|
239
|
+
|
|
240
|
+
One real constraint: bklit's **line and area charts are time-series charts**.
|
|
241
|
+
They build a `scaleTime` and coerce x with `new Date(...)`, so a saved query
|
|
242
|
+
whose label column holds categories rather than dates cannot be drawn by them —
|
|
243
|
+
and it fails silently, as an empty box, not as an error. The renderer therefore
|
|
244
|
+
checks the label column first and degrades categorical line/area cards to the
|
|
245
|
+
built-in bars. bklit's **bar** chart is banded and categorical, so it takes
|
|
246
|
+
whatever the label column holds.
|
|
247
|
+
|
|
248
|
+
### Loading states
|
|
249
|
+
|
|
250
|
+
`<ChartSkeleton />` draws the chart that is coming — bars for a bar chart, a
|
|
251
|
+
silhouette for a line or area, a number block for a single value — at exactly
|
|
252
|
+
the height the real chart will occupy, so nothing shifts when data lands. It
|
|
253
|
+
animates only under `motion-safe`. `<ChartEmpty />` and `<ChartFailed />` sit
|
|
254
|
+
beside it, because a query that matched nothing and a query that failed must
|
|
255
|
+
never be left under a placeholder that suggests something is still on its way.
|
|
256
|
+
|
|
257
|
+
The `bklit` renderer has its own loading vocabulary — a shimmer sweep and a
|
|
258
|
+
pulse, driven by its `status` prop — and both are vendored here. They are
|
|
259
|
+
deliberately **not** wired into the dashboard: on one board, a bklit card
|
|
260
|
+
sweeping beside a Recharts card pulsing reads as two different things loading
|
|
261
|
+
rather than one board. If you register `bklit` for every card, prefer its own;
|
|
262
|
+
mixed boards should use `<ChartSkeleton />` throughout, which is what
|
|
263
|
+
`DashboardBoard` does.
|
|
264
|
+
|
|
265
|
+
## Attribution
|
|
266
|
+
|
|
267
|
+
The chart components under `src/charts/bklit/` (and
|
|
268
|
+
`src/charts/components/shimmering-text.tsx`) are vendored from
|
|
269
|
+
[**bklit-ui**](https://github.com/bklit/bklit-ui), Copyright (c) 2026 uixmat,
|
|
270
|
+
released under the **MIT licence**. The full licence text ships with this
|
|
271
|
+
package as [`LICENSE-bklit`](./LICENSE-bklit), and every vendored file carries a
|
|
272
|
+
header naming its origin.
|
|
273
|
+
|
|
274
|
+
They are vendored rather than depended on because bklit-ui is a shadcn-style
|
|
275
|
+
registry — components you own, not a package you install. The only local change
|
|
276
|
+
is that their `@/lib/utils` import was repointed at this package's own `cn`,
|
|
277
|
+
which is the same function; nothing else is modified, so re-syncing with
|
|
278
|
+
upstream stays a diff rather than a merge.
|
|
279
|
+
|
|
280
|
+
## License
|
|
281
|
+
|
|
282
|
+
MIT (see `LICENSE-bklit` for the vendored bklit-ui components).
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type CatalogIdentity } from './context';
|
|
2
|
+
export interface AccessConsoleProps {
|
|
3
|
+
/**
|
|
4
|
+
* Who is looking, if the host knows.
|
|
5
|
+
*
|
|
6
|
+
* A prop rather than something this screen fetches, because signing in is not
|
|
7
|
+
* part of the catalog's surface. A host may authenticate with a session
|
|
8
|
+
* cookie, OIDC, a proxy header or nothing at all, and a library that reached
|
|
9
|
+
* for `/auth/me` would be choosing for them. Omit it and the "you" panel
|
|
10
|
+
* disappears; the two lists below are the same either way.
|
|
11
|
+
*/
|
|
12
|
+
identity?: CatalogIdentity;
|
|
13
|
+
/**
|
|
14
|
+
* Signing out, if the host has somewhere to sign out to. Omit and the button
|
|
15
|
+
* is absent rather than present and inert.
|
|
16
|
+
*/
|
|
17
|
+
onSignOut?: () => void;
|
|
18
|
+
signOutPending?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Whether to offer the "add someone" form.
|
|
21
|
+
*
|
|
22
|
+
* Defaults to what `identity` implies, and is separate so a host that knows
|
|
23
|
+
* better — because its proxy already gated the route — can say so. The
|
|
24
|
+
* endpoint refuses either way; this only stops a console showing a form whose
|
|
25
|
+
* only possible outcome is a 403.
|
|
26
|
+
*/
|
|
27
|
+
canAddPeople?: boolean;
|
|
28
|
+
title?: string;
|
|
29
|
+
eyebrow?: string;
|
|
30
|
+
intro?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* One page answering the two questions a shared catalog creates: which
|
|
34
|
+
* application is allowed to touch what, and which person is behind it.
|
|
35
|
+
*
|
|
36
|
+
* Kept as one page rather than split, because the answer to "who did this" is a
|
|
37
|
+
* pair — a person, acting through an application, capped by both — and two
|
|
38
|
+
* screens would let a reader see one half and believe it was the whole thing.
|
|
39
|
+
*/
|
|
40
|
+
export declare function AccessConsole({ identity, onSignOut, signOutPending, canAddPeople, title, eyebrow, intro, }: AccessConsoleProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
3
|
+
import { KeyRound, LogOut, ShieldCheck, ShieldHalf, UserRound } from 'lucide-react';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { cn } from './cn';
|
|
6
|
+
import { catalogQueryKeys, useCatalogClient, } from './context';
|
|
7
|
+
import { TextField } from './ui/field';
|
|
8
|
+
import { SelectField } from './ui/select';
|
|
9
|
+
import { Tooltip, TooltipProvider } from './ui/tooltip';
|
|
10
|
+
const MUTED = 'text-zinc-400 dark:text-zinc-500';
|
|
11
|
+
const RULE = 'border-zinc-200 dark:border-zinc-800';
|
|
12
|
+
const PANEL = 'bg-white dark:bg-zinc-900';
|
|
13
|
+
/**
|
|
14
|
+
* One page answering the two questions a shared catalog creates: which
|
|
15
|
+
* application is allowed to touch what, and which person is behind it.
|
|
16
|
+
*
|
|
17
|
+
* Kept as one page rather than split, because the answer to "who did this" is a
|
|
18
|
+
* pair — a person, acting through an application, capped by both — and two
|
|
19
|
+
* screens would let a reader see one half and believe it was the whole thing.
|
|
20
|
+
*/
|
|
21
|
+
export function AccessConsole({ identity, onSignOut, signOutPending, canAddPeople, title = 'Access', eyebrow = 'Governance', intro = 'Two kinds of caller reach this catalog. Applications hold keys and act on their own behalf. People sign in and act through an application, and can never do more than both of them may.', }) {
|
|
22
|
+
const client = useCatalogClient();
|
|
23
|
+
const applications = useQuery({
|
|
24
|
+
queryKey: catalogQueryKeys.principals,
|
|
25
|
+
queryFn: () => client.listPrincipals(),
|
|
26
|
+
// Grants change when an operator changes them, which is not often and not
|
|
27
|
+
// from here. Long enough that moving between tabs is instant.
|
|
28
|
+
staleTime: 30_000,
|
|
29
|
+
});
|
|
30
|
+
const people = useQuery({
|
|
31
|
+
queryKey: catalogQueryKeys.people,
|
|
32
|
+
queryFn: () => client.listPeople(),
|
|
33
|
+
staleTime: 30_000,
|
|
34
|
+
});
|
|
35
|
+
const mayAdminister = canAddPeople ?? identity?.scopes.includes('catalog:admin') ?? false;
|
|
36
|
+
return (_jsx(TooltipProvider, { children: _jsxs("div", { className: "mx-auto max-w-5xl px-8 py-8", children: [_jsx("p", { className: cn('font-mono text-[11px] uppercase tracking-[0.18em]', MUTED), children: eyebrow }), _jsx("h1", { className: "mt-1 text-2xl font-semibold tracking-tight", children: title }), _jsx("p", { className: "mt-1 max-w-2xl text-sm text-zinc-500 dark:text-zinc-400", children: intro }), identity && (_jsx(YouPanel, { identity: identity, onSignOut: onSignOut, signOutPending: signOutPending })), _jsxs(Section, { title: "People", note: "Sign in to the console. Capped by the application they sign in through.", children: [mayAdminister && _jsx(AddPerson, {}), people.isPending && _jsx(Placeholder, { children: "Reading people\u2026" }), people.isError && (_jsx(Failed, { message: people.error instanceof Error
|
|
37
|
+
? people.error.message
|
|
38
|
+
: 'Could not read the people list.', onRetry: () => people.refetch() })), people.data?.map((person) => (_jsx(PersonCard, { person: person }, person.email))), people.data?.length === 0 && (_jsx(Placeholder, { children: "Nobody can sign in yet. Seed the first administrator from the environment before anybody can reach this console as a person." }))] }), _jsxs(Section, { title: "Applications", note: "Provisioned by an operator \u2014 a console that could hand grants out is one that stops leaving a trail.", children: [applications.isPending && _jsx(Placeholder, { children: "Reading applications\u2026" }), applications.isError && (_jsx(Failed, { message: applications.error instanceof Error
|
|
39
|
+
? applications.error.message
|
|
40
|
+
: 'Could not read the application list.', onRetry: () => applications.refetch() })), applications.data?.map((principal) => (_jsx(PrincipalCard, { principal: principal }, principal.id))), applications.data?.length === 0 && (_jsx(Placeholder, { children: "No applications are provisioned." }))] })] }) }));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Who you are, said plainly, including the exact string your actions will be
|
|
44
|
+
* stamped with.
|
|
45
|
+
*
|
|
46
|
+
* Showing the raw `principalId` is not a debugging affordance. It is the whole
|
|
47
|
+
* claim the sign-in makes — that the audit trail names a person — and the
|
|
48
|
+
* cheapest way to let somebody verify it is true is to show them the string
|
|
49
|
+
* before they go looking for it on the activity timeline.
|
|
50
|
+
*/
|
|
51
|
+
function YouPanel({ identity, onSignOut, signOutPending, }) {
|
|
52
|
+
// Null actor means an application key is behind this request rather than a
|
|
53
|
+
// person. Derived from `actor` rather than carried as a separate flag,
|
|
54
|
+
// because two fields that must agree are two fields that can disagree.
|
|
55
|
+
const machine = identity.actor === null;
|
|
56
|
+
return (_jsxs("div", { className: cn('mt-6 rounded-lg border p-4', PANEL, machine ? 'border-amber-500/40' : RULE), children: [_jsxs("div", { className: "flex flex-wrap items-start justify-between gap-3", children: [_jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: cn('font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: machine ? 'Acting as an application' : 'Signed in' }), _jsxs("div", { className: "mt-1 flex items-center gap-2 text-sm font-medium", children: [machine ? _jsx(KeyRound, { size: 14 }) : _jsx(UserRound, { size: 14 }), identity.displayName] }), _jsxs("div", { className: cn('mt-1 font-mono text-[11px]', MUTED), children: ["recorded as ", identity.principalId] }), machine && (_jsx("p", { className: "mt-2 max-w-md text-xs text-amber-600", children: "Nothing you do here will name you. This is the application-key path, kept for local development \u2014 sign in to be attributable." }))] }), _jsxs("div", { className: "flex items-center gap-4", children: [identity.session && (_jsxs("span", { className: cn('font-mono text-[11px]', MUTED), children: ["expires ", new Date(identity.session.expiresAt).toLocaleTimeString(), " \u00B7 idle", ' ', identity.session.idleMinutes, "m"] })), !machine && onSignOut && (_jsxs("button", { type: "button", onClick: onSignOut, disabled: signOutPending, className: cn('flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs disabled:opacity-40', RULE, 'hover:bg-zinc-50 dark:hover:bg-zinc-800'), children: [_jsx(LogOut, { size: 13 }), signOutPending ? 'Signing out…' : 'Sign out'] }))] })] }), _jsxs("div", { className: "mt-4 grid gap-3 sm:grid-cols-2 lg:grid-cols-4", children: [_jsx(Grant, { label: "Effective scopes", values: identity.scopes, tone: "neutral" }), _jsx(Grant, { label: "May write", values: identity.writeTypes, tone: "write", emptyNote: "nothing" }), _jsx(Grant, { label: "May read", values: identity.readTypes ?? ['every type'], tone: "neutral" }), _jsx(Grant, { label: "May see", values: identity.classifications, tone: "classified", emptyNote: "nothing classified" })] })] }));
|
|
57
|
+
}
|
|
58
|
+
function PersonCard({ person }) {
|
|
59
|
+
return (_jsxs("div", { className: cn('rounded-lg border p-4', RULE, PANEL), children: [_jsxs("div", { className: "flex flex-wrap items-start justify-between gap-3", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-sm font-medium", children: person.displayName }), _jsx("span", { className: "rounded-sm bg-zinc-100 px-1.5 py-0.5 font-mono text-[10px] uppercase text-zinc-500 dark:bg-zinc-800", children: person.role }), !person.active && (_jsx("span", { className: "rounded-sm bg-red-100 px-1.5 py-0.5 font-mono text-[10px] uppercase text-red-600 dark:bg-red-950", children: "disabled" }))] }), _jsx("div", { className: cn('mt-0.5 font-mono text-[11px]', MUTED), children: person.principalId })] }), _jsxs("div", { className: cn('flex items-center gap-4 font-mono text-[11px]', MUTED), children: [_jsx(Tooltip, { content: "Sessions currently alive \u2014 not expired, not idled out, not revoked.", children: _jsxs("span", { className: "cursor-help", children: [person.liveSessions, " live"] }) }), _jsx("span", { children: person.lastLoginAt
|
|
60
|
+
? `last in ${new Date(person.lastLoginAt).toLocaleString()}`
|
|
61
|
+
: 'never signed in' })] })] }), _jsxs("div", { className: "mt-4 grid gap-3 sm:grid-cols-2 lg:grid-cols-4", children: [_jsx(Grant, { label: "Effective scopes", values: person.effective.scopes, tone: "neutral", emptyNote: "nothing" }), _jsx(Grant, { label: "May write", values: person.effective.writeTypes, tone: "write", emptyNote: "nothing" }), _jsx(Grant, { label: "May read", values: person.effective.readTypes ?? ['every type'], tone: "neutral" }), _jsx(Grant, { label: "May see", values: person.effective.classifications, tone: "classified", emptyNote: "nothing classified" })] })] }));
|
|
62
|
+
}
|
|
63
|
+
const ROLE_OPTIONS = [
|
|
64
|
+
{ value: 'viewer', label: 'viewer', hint: 'read' },
|
|
65
|
+
{ value: 'curator', label: 'curator', hint: 'read, curate' },
|
|
66
|
+
{ value: 'admin', label: 'admin', hint: 'read, curate, administer' },
|
|
67
|
+
];
|
|
68
|
+
/** Narrowed rather than cast: a select value is a string as far as the DOM cares. */
|
|
69
|
+
function toRole(value) {
|
|
70
|
+
return value === 'curator' || value === 'admin' ? value : 'viewer';
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Creating an account, for administrators only.
|
|
74
|
+
*
|
|
75
|
+
* The one write on this page, and it stays narrow on purpose: a name, a role
|
|
76
|
+
* and a password. Per-type grants for a person are deliberately not editable
|
|
77
|
+
* here — they are the exception, they are read straight out of the row, and a
|
|
78
|
+
* form that offers them invites somebody to build a bespoke permission set that
|
|
79
|
+
* nobody can audit later.
|
|
80
|
+
*/
|
|
81
|
+
function AddPerson() {
|
|
82
|
+
const client = useCatalogClient();
|
|
83
|
+
const queryClient = useQueryClient();
|
|
84
|
+
const [open, setOpen] = useState(false);
|
|
85
|
+
const [email, setEmail] = useState('');
|
|
86
|
+
const [displayName, setDisplayName] = useState('');
|
|
87
|
+
const [role, setRole] = useState('viewer');
|
|
88
|
+
const [password, setPassword] = useState('');
|
|
89
|
+
const save = useMutation({
|
|
90
|
+
mutationFn: () => client.upsertPerson({
|
|
91
|
+
email: email.trim(),
|
|
92
|
+
displayName: displayName.trim() || email.trim(),
|
|
93
|
+
role,
|
|
94
|
+
password,
|
|
95
|
+
}),
|
|
96
|
+
onSuccess: () => {
|
|
97
|
+
setEmail('');
|
|
98
|
+
setDisplayName('');
|
|
99
|
+
setPassword('');
|
|
100
|
+
setOpen(false);
|
|
101
|
+
// Precisely this list. Invalidating everything would refetch the model,
|
|
102
|
+
// the connectors and every run on the screen because somebody added a
|
|
103
|
+
// viewer.
|
|
104
|
+
queryClient.invalidateQueries({ queryKey: catalogQueryKeys.people });
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
if (!open) {
|
|
108
|
+
return (_jsx("button", { type: "button", onClick: () => setOpen(true), className: cn('rounded-lg border border-dashed px-4 py-3 text-left text-sm', RULE, MUTED, 'hover:text-zinc-600 dark:hover:text-zinc-300'), children: "+ Add someone" }));
|
|
109
|
+
}
|
|
110
|
+
return (_jsxs("form", { className: cn('rounded-lg border p-4', RULE, PANEL), onSubmit: (event) => {
|
|
111
|
+
event.preventDefault();
|
|
112
|
+
save.mutate();
|
|
113
|
+
}, children: [_jsxs("div", { className: "grid gap-3 sm:grid-cols-2", children: [_jsx(TextField, { label: "Email", type: "email", value: email, onChange: setEmail, placeholder: "someone@example.mil" }), _jsx(TextField, { label: "Display name", value: displayName, onChange: setDisplayName, placeholder: "Defaults to the email" }), _jsx(SelectField, { label: "Role", ariaLabel: "Role", value: role, onValueChange: (value) => setRole(toRole(value)), options: ROLE_OPTIONS }), _jsx(TextField, { label: "Password", type: "password", value: password, onChange: setPassword, placeholder: "12 characters or more", autoComplete: "new-password" })] }), save.isError && (_jsx("p", { className: "mt-2 text-xs text-red-600", children: save.error instanceof Error ? save.error.message : 'Could not save.' })), _jsx("p", { className: cn('mt-2 text-xs', MUTED), children: "No role carries permission to load a snapshot. Publishing is something an application does from a pipeline, with a retryable snapshot id." }), _jsxs("div", { className: "mt-3 flex gap-2", children: [_jsx("button", { type: "submit", disabled: save.isPending || email.trim().length === 0 || password.length < 12, className: "rounded-md bg-zinc-950 px-3 py-1.5 text-xs text-zinc-50 disabled:opacity-40 dark:bg-zinc-100 dark:text-zinc-950", children: save.isPending ? 'Saving…' : 'Save' }), _jsx("button", { type: "button", onClick: () => setOpen(false), className: cn('rounded-md px-3 py-1.5 text-xs', MUTED), children: "Cancel" })] })] }));
|
|
114
|
+
}
|
|
115
|
+
const AUTH_METHODS = {
|
|
116
|
+
token: {
|
|
117
|
+
icon: ShieldCheck,
|
|
118
|
+
tone: 'text-emerald-600',
|
|
119
|
+
hint: 'Authenticates with an access token — rotation and revocation belong to the identity provider.',
|
|
120
|
+
},
|
|
121
|
+
key: {
|
|
122
|
+
icon: KeyRound,
|
|
123
|
+
tone: 'text-amber-600',
|
|
124
|
+
hint: 'Authenticates with a long-lived static key, revoked only by editing its row.',
|
|
125
|
+
},
|
|
126
|
+
session: {
|
|
127
|
+
icon: ShieldHalf,
|
|
128
|
+
tone: 'text-violet-600',
|
|
129
|
+
hint: 'Holds no credential of its own. Reachable only by a person signing in, and it caps what any of them can do.',
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
function PrincipalCard({ principal }) {
|
|
133
|
+
const method = AUTH_METHODS[principal.authMethod];
|
|
134
|
+
// Lifted into a capitalised binding: JSX reads a lowercase `method.icon` in
|
|
135
|
+
// element position as a member expression, which happens to work, but the
|
|
136
|
+
// capitalised local is what every other component here does and is what the
|
|
137
|
+
// union of icon types resolves cleanly against.
|
|
138
|
+
const MethodIcon = method.icon;
|
|
139
|
+
return (_jsxs("div", { className: cn('rounded-lg border p-4', RULE, PANEL), children: [_jsxs("div", { className: "flex flex-wrap items-start justify-between gap-3", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-sm font-medium", children: principal.displayName }), !principal.active && (_jsx("span", { className: "rounded-sm bg-zinc-100 px-1.5 py-0.5 font-mono text-[10px] uppercase text-zinc-500 dark:bg-zinc-800", children: "disabled" }))] }), _jsx("div", { className: cn('mt-0.5 font-mono text-[11px]', MUTED), children: principal.id })] }), _jsxs("div", { className: "flex items-center gap-4", children: [_jsx(Tooltip, { content: method.hint, children: _jsxs("span", { className: cn('flex cursor-help items-center gap-1.5 font-mono text-[10px] uppercase tracking-wider', method.tone), children: [_jsx(MethodIcon, { size: 13 }), principal.authMethod] }) }), _jsx("span", { className: cn('font-mono text-[11px]', MUTED), children: principal.lastSeenAt
|
|
140
|
+
? `seen ${new Date(principal.lastSeenAt).toLocaleString()}`
|
|
141
|
+
: 'never seen' })] })] }), _jsxs("div", { className: "mt-4 grid gap-3 sm:grid-cols-2 lg:grid-cols-4", children: [_jsx(Grant, { label: "Scopes", values: principal.scopes, tone: "neutral" }), _jsx(Grant, { label: "May write", values: principal.writeTypes, tone: "write", emptyNote: "nothing" }), _jsx(Grant, { label: "May read", values: principal.readTypes ?? ['every type'], tone: "neutral" }), _jsx(Grant, { label: "Owns", values: principal.ownedTypes, tone: "own", emptyNote: "no types published" })] }), principal.classifications.length > 0 && (_jsx("div", { className: "mt-3", children: _jsx(Grant, { label: "May see", values: principal.classifications, tone: "classified" }) }))] }));
|
|
142
|
+
}
|
|
143
|
+
function Section({ title, note, children, }) {
|
|
144
|
+
return (_jsxs("div", { className: "mt-10", children: [_jsx("h2", { className: "text-sm font-semibold tracking-tight", children: title }), _jsx("p", { className: cn('mt-0.5 max-w-2xl text-xs', MUTED), children: note }), _jsx("div", { className: "mt-3 flex flex-col gap-3", children: children })] }));
|
|
145
|
+
}
|
|
146
|
+
function Placeholder({ children }) {
|
|
147
|
+
return (_jsx("p", { className: cn('rounded-lg border border-dashed px-4 py-8 text-center text-sm', RULE, MUTED), children: children }));
|
|
148
|
+
}
|
|
149
|
+
function Failed({ message, onRetry, }) {
|
|
150
|
+
return (_jsxs("div", { className: "rounded-lg border border-red-200 bg-red-50 px-4 py-6 text-center dark:border-red-900 dark:bg-red-950/40", children: [_jsx("p", { className: "text-sm text-red-700 dark:text-red-300", children: message }), _jsx("button", { type: "button", onClick: onRetry, className: "mt-2 rounded-md border border-red-300 px-3 py-1 text-xs text-red-700 dark:border-red-800 dark:text-red-300", children: "Try again" })] }));
|
|
151
|
+
}
|
|
152
|
+
const TONES = {
|
|
153
|
+
neutral: 'bg-zinc-100 text-zinc-600 dark:bg-zinc-800 dark:text-zinc-300',
|
|
154
|
+
write: 'bg-violet-100 text-violet-700 dark:bg-violet-950 dark:text-violet-300',
|
|
155
|
+
own: 'bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300',
|
|
156
|
+
classified: 'bg-amber-100 text-amber-700 dark:bg-amber-950 dark:text-amber-300',
|
|
157
|
+
};
|
|
158
|
+
function Grant({ label, values, tone, emptyNote = '—', }) {
|
|
159
|
+
return (_jsxs("div", { children: [_jsx("div", { className: cn('font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: label }), _jsx("div", { className: "mt-1 flex flex-wrap gap-1", children: values.length === 0 ? (_jsx("span", { className: cn('text-xs italic', MUTED), children: emptyNote })) : (values.map((value) => (_jsx("span", { className: cn('rounded-sm px-1.5 py-0.5 font-mono text-[10px]', TONES[tone]), children: value }, value)))) })] }));
|
|
160
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface CatalogManagerProps {
|
|
2
|
+
/**
|
|
3
|
+
* Where the object explorer lives, if the host mounts one. Receives the type
|
|
4
|
+
* name. Omit to hide the "Open …" button entirely.
|
|
5
|
+
*/
|
|
6
|
+
explorerHref?: (typeName: string) => string;
|
|
7
|
+
/** Heading copy, so the host can call this whatever its users call it. */
|
|
8
|
+
title?: string;
|
|
9
|
+
eyebrow?: string;
|
|
10
|
+
intro?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function CatalogManager({ explorerHref, title, eyebrow, intro, }: CatalogManagerProps): import("react/jsx-runtime").JSX.Element;
|