okengine 0.11.2 → 0.13.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/manifest.v1.schema.json +1 -1
- package/package.json +57 -3
- package/site/content/docs/ai/index.mdx +2 -2
- package/site/content/docs/ai/llms-txt.mdx +21 -16
- package/site/content/docs/ai/mcp.mdx +1 -1
- package/site/content/docs/ai/skills.mdx +16 -14
- package/site/content/docs/deployment/docker-swarm.mdx +7 -8
- package/site/content/docs/deployment/docker.mdx +20 -12
- package/site/content/docs/deployment/index.mdx +2 -2
- package/site/content/docs/deployment/kubernetes.mdx +2 -2
- package/site/content/docs/deployment/reverse-proxy.mdx +39 -21
- package/site/content/docs/elements/ai.mdx +25 -15
- package/site/content/docs/elements/channel.mdx +2 -2
- package/site/content/docs/elements/clock.mdx +11 -1
- package/site/content/docs/elements/flow.mdx +66 -16
- package/site/content/docs/elements/gate.mdx +47 -39
- package/site/content/docs/elements/signal.mdx +2 -2
- package/site/content/docs/elements/store.mdx +211 -48
- package/site/content/docs/elements/vault.mdx +126 -41
- package/site/content/docs/get-started/basic-usage.mdx +14 -6
- package/site/content/docs/get-started/installation.mdx +24 -16
- package/site/content/docs/plugins/cors.mdx +9 -9
- package/site/content/docs/plugins/csrf.mdx +1 -1
- package/site/content/docs/providers/cockroachdb.mdx +13 -0
- package/site/content/docs/providers/index.mdx +1 -0
- package/site/content/docs/providers/neon.mdx +22 -0
- package/site/content/docs/providers/supabase.mdx +17 -0
- package/site/content/docs/providers/yugabytedb.mdx +15 -0
- package/site/content/docs/recipes/caddy.mdx +3 -3
- package/site/content/docs/recipes/cockroachdb.mdx +8 -2
- package/site/content/docs/recipes/dragonfly.mdx +4 -3
- package/site/content/docs/recipes/index.mdx +6 -1
- package/site/content/docs/recipes/llama-cpp.mdx +5 -6
- package/site/content/docs/recipes/mailpit.mdx +3 -3
- package/site/content/docs/recipes/meilisearch.mdx +4 -4
- package/site/content/docs/recipes/meta.json +1 -0
- package/site/content/docs/recipes/nginx.mdx +117 -0
- package/site/content/docs/recipes/ollama.mdx +3 -3
- package/site/content/docs/recipes/pgdog.mdx +1 -1
- package/site/content/docs/recipes/postgres.mdx +44 -8
- package/site/content/docs/recipes/redis.mdx +11 -7
- package/site/content/docs/recipes/rustfs.mdx +4 -4
- package/site/content/docs/recipes/sglang.mdx +2 -2
- package/site/content/docs/recipes/supabase-docker.mdx +24 -0
- package/site/content/docs/recipes/timescale.mdx +30 -6
- package/site/content/docs/recipes/traefik.mdx +10 -7
- package/site/content/docs/recipes/valkey.mdx +5 -3
- package/site/content/docs/recipes/vllm.mdx +2 -2
- package/site/content/docs/recipes/yugabytedb.mdx +7 -1
- package/site/content/docs/reference/cli.md +67 -34
- package/site/content/docs/reference/client.mdx +39 -20
- package/site/content/docs/reference/configuration.mdx +34 -25
- package/site/content/docs/reference/environment-variables.mdx +28 -25
- package/site/content/docs/reference/errors.mdx +25 -20
- package/site/content/docs/reference/fx.mdx +19 -12
- package/site/content/docs/reference/plugins.mdx +2 -2
- package/site/content/docs/reference/security.md +16 -7
- package/src/auth/auth.test.ts +2 -2
- package/src/auth/bindings.ts +5 -5
- package/src/auth/config.ts +8 -0
- package/src/auth/gate-auth.test.ts +5 -5
- package/src/auth/index.ts +3 -0
- package/src/auth/operator.ts +1 -1
- package/src/auth/password-policy.test.ts +142 -5
- package/src/auth/password-policy.ts +128 -12
- package/src/auth/plugin.ts +2 -2
- package/src/cli/ai-setup/ai-setup.test.ts +1 -1
- package/src/cli/ai-setup/apply.ts +3 -18
- package/src/cli/ai-setup/index.ts +4 -4
- package/src/cli/ai-setup/prompts.ts +1 -1
- package/src/cli/ask-seed.test.ts +27 -0
- package/src/cli/ask-seed.ts +11 -7
- package/src/cli/attach-host-console.test.ts +134 -0
- package/src/cli/attach-host-console.ts +100 -0
- package/src/cli/console-cmd.test.ts +81 -0
- package/src/cli/console-cmd.ts +107 -0
- package/src/cli/db-seed.ts +14 -3
- package/src/cli/db.test.ts +37 -2
- package/src/cli/db.ts +26 -0
- package/src/cli/dev-app-runner.ts +6 -40
- package/src/cli/dev-console-vite.test.ts +86 -0
- package/src/cli/dev-console-vite.ts +164 -0
- package/src/cli/dev-schema-sync.ts +2 -2
- package/src/cli/dev.test.ts +78 -2
- package/src/cli/dev.ts +170 -56
- package/src/cli/docker-cli.test.ts +2 -2
- package/src/cli/docker.ts +1 -1
- package/src/cli/doctor.ts +2 -1
- package/src/cli/drizzle-env.test.ts +4 -9
- package/src/cli/drizzle-env.ts +2 -2
- package/src/cli/hero-meta.test.ts +37 -0
- package/src/cli/hero-meta.ts +30 -9
- package/src/cli/index.ts +5 -0
- package/src/cli/load-config.images.test.ts +13 -12
- package/src/cli/load-config.ts +1 -1
- package/src/cli/project-state.test.ts +6 -2
- package/src/cli/project-state.ts +27 -11
- package/src/cli/registry.ts +11 -0
- package/src/cli/replay.ts +7 -2
- package/src/cli/vault-cmd.test.ts +2 -0
- package/src/cli/vault-cmd.ts +7 -2
- package/src/client/create.test.ts +38 -2
- package/src/client/create.ts +16 -11
- package/src/client/index.ts +6 -0
- package/src/client/pager.test.ts +66 -0
- package/src/client/pager.ts +138 -0
- package/src/client/transport.ts +9 -6
- package/src/client/types.ts +58 -10
- package/src/compiler/aot.test.ts +12 -2
- package/src/compiler/effects-infer.ts +13 -4
- package/src/compiler/extract.test.ts +257 -5
- package/src/compiler/extract.ts +324 -58
- package/src/compiler/fixtures/skyport/src/flows/bookings/index.ts +2 -2
- package/src/compiler/fixtures/skyport/src/gates.ts +2 -0
- package/src/compiler/fixtures/skyport.expected.json +4 -0
- package/src/config/driver-defaults.test.ts +3 -0
- package/src/config/driver-defaults.ts +14 -0
- package/src/config/index.ts +5 -0
- package/src/console/budget.test.ts +27 -37
- package/src/console/index.ts +3 -0
- package/src/console/password-policy.ts +89 -0
- package/src/console/server/app.ts +138 -12
- package/src/console/server/auth-rate.test.ts +3 -3
- package/src/console/server/auth-store.test.ts +222 -0
- package/src/console/server/auth-store.ts +499 -0
- package/src/console/server/bind.ts +2 -3
- package/src/console/server/channels.test.ts +1 -1
- package/src/console/server/claim.test.ts +60 -1
- package/src/console/server/claim.ts +137 -2
- package/src/console/server/console.test.ts +102 -6
- package/src/console/server/dry-run.audit.test.ts +5 -2
- package/src/console/server/files-catalog.test.ts +51 -0
- package/src/console/server/files-catalog.ts +122 -0
- package/src/console/server/flows-invoke.test.ts +655 -38
- package/src/console/server/flows.ts +907 -90
- package/src/console/server/gates.test.ts +59 -0
- package/src/console/server/gates.ts +17 -14
- package/src/console/server/i18n.ts +7 -4
- package/src/console/server/index-search.test.ts +57 -0
- package/src/console/server/index-search.ts +102 -0
- package/src/console/server/index.ts +32 -1
- package/src/console/server/instances.test.ts +68 -0
- package/src/console/server/instances.ts +58 -0
- package/src/console/server/invoke-user-flow.test.ts +206 -0
- package/src/console/server/invoke-user-flow.ts +367 -0
- package/src/console/server/live.test.ts +44 -1
- package/src/console/server/live.ts +16 -0
- package/src/console/server/operator-db.test.ts +5 -5
- package/src/console/server/operator-db.ts +2 -2
- package/src/console/server/panel-load.ts +1 -0
- package/src/console/server/plugin.ts +12 -2
- package/src/console/server/runs-history.test.ts +143 -0
- package/src/console/server/runs-ingest.test.ts +379 -0
- package/src/console/server/runs-ingest.ts +127 -0
- package/src/console/server/runs-list-nesting.test.ts +97 -0
- package/src/console/server/runs-pii.test.ts +69 -0
- package/src/console/server/runs-pii.ts +50 -4
- package/src/console/server/runs-query-guard.test.ts +75 -0
- package/src/console/server/runs-query-guard.ts +224 -0
- package/src/console/server/runs-query-mask.test.ts +37 -0
- package/src/console/server/runs-query-mask.ts +82 -0
- package/src/console/server/runs-query.test.ts +287 -0
- package/src/console/server/runs-query.ts +107 -0
- package/src/console/server/security-headers.ts +21 -2
- package/src/console/server/security.gate.test.ts +306 -3
- package/src/console/server/serve.ts +138 -9
- package/src/console/server/spa-paths.test.ts +36 -0
- package/src/console/server/spa-proxy.test.ts +86 -0
- package/src/console/server/sql-catalog.ts +572 -0
- package/src/console/server/sql-extension.test.ts +19 -0
- package/src/console/server/sql-rls.test.ts +44 -0
- package/src/console/server/state.ts +445 -7
- package/src/console/server/store-kv-stats.test.ts +178 -0
- package/src/console/server/store-kv-stats.ts +339 -0
- package/src/console/server/store-stats.test.ts +165 -0
- package/src/console/server/store-stats.ts +526 -0
- package/src/console/server/store.test.ts +930 -0
- package/src/console/server/store.ts +859 -76
- package/src/console/server/traces-replay.test.ts +212 -0
- package/src/console/server/vault-http.test.ts +458 -0
- package/src/console/server/vault-overlay.test.ts +49 -0
- package/src/console/server/vault-overlay.ts +99 -0
- package/src/console/server/vault.test.ts +75 -0
- package/src/console/server/vault.ts +443 -27
- package/src/console/ui-next/components.json +26 -0
- package/src/console/ui-next/dist/assets/bash-CLZ0U2zV.js +1 -0
- package/src/console/ui-next/dist/assets/cache-glyph-CLPBqZeb.js +1 -0
- package/src/console/ui-next/dist/assets/call-pii-button-bqkxMrJH.js +1 -0
- package/src/console/ui-next/dist/assets/collapsible-DYb0xU8C.js +1 -0
- package/src/console/ui-next/dist/assets/confirm-sheet-DDCRmG62.js +1 -0
- package/src/console/ui-next/dist/assets/dagre.esm-ZwcdTuZZ.js +1 -0
- package/src/console/ui-next/dist/assets/duration-tone-oiRxPVsZ.js +9 -0
- package/src/console/ui-next/dist/assets/explorer-empty-HjTnVQoR.js +1 -0
- package/src/console/ui-next/dist/assets/flows-page-Dg8CTE29.js +1 -0
- package/src/console/ui-next/dist/assets/github-dark-C-LZuMrd.js +1 -0
- package/src/console/ui-next/dist/assets/github-light-EUqPIrTm.js +1 -0
- package/src/console/ui-next/dist/assets/highlighted-json-CvDPvveV.js +154 -0
- package/src/console/ui-next/dist/assets/http-method-BJ92Z_ke.js +1 -0
- package/src/console/ui-next/dist/assets/index-Bp-R7jtM.js +66 -0
- package/src/console/ui-next/dist/assets/index-D4Ldtj79.css +2 -0
- package/src/console/ui-next/dist/assets/json-qhed-kSA.js +1 -0
- package/src/console/ui-next/dist/assets/link-DF7SZ9Ek.js +1 -0
- package/src/console/ui-next/dist/assets/observability-page-DAnpEaq1.js +4 -0
- package/src/console/ui-next/dist/assets/preload-helper-oH4irX4C.js +1 -0
- package/src/console/ui-next/dist/assets/query-gate-parts-1m8m1iNp.js +2 -0
- package/src/console/ui-next/dist/assets/react-B1ML8gxg.js +1 -0
- package/src/console/ui-next/dist/assets/react-dom-Bph1y7z7.js +9 -0
- package/src/console/ui-next/dist/assets/replica-lag-C8_BRt2x.js +18 -0
- package/src/console/ui-next/dist/assets/rolldown-runtime-hePW80VL.js +1 -0
- package/src/console/ui-next/dist/assets/sheet-form-D-ata7jy.js +1 -0
- package/src/console/ui-next/dist/assets/shortcut-Cgzuv4k1.js +1 -0
- package/src/console/ui-next/dist/assets/shortcut-keys-DO4IsVqv.js +1 -0
- package/src/console/ui-next/dist/assets/skeleton-CL_X0GCj.js +1 -0
- package/src/console/ui-next/dist/assets/sql-BskegiFM.js +1 -0
- package/src/console/ui-next/dist/assets/store-page-v3LXdYpr.js +45 -0
- package/src/console/ui-next/dist/assets/trace-detail-sheet-D16lWQMt.js +2 -0
- package/src/console/ui-next/dist/assets/tsx-udAQXfEw.js +1 -0
- package/src/console/ui-next/dist/assets/typescript-bsJCZSQ-.js +1 -0
- package/src/console/ui-next/dist/assets/units-page-BtQ0bqMe.js +1 -0
- package/src/console/ui-next/dist/assets/use-vault-list-Cl79j_ku.js +1 -0
- package/src/console/ui-next/dist/assets/vault-page-Ca-MvcmJ.js +2 -0
- package/src/console/ui-next/dist/assets/xyflow-D7n4g6go.js +7 -0
- package/src/console/ui-next/dist/assets/xyflow-DZ0Ws1xk.css +1 -0
- package/src/console/ui-next/dist/favicon.svg +6 -0
- package/src/console/ui-next/dist/index.html +56 -0
- package/src/console/ui-next/index.html +45 -0
- package/src/console/ui-next/public/favicon.svg +6 -0
- package/src/console/ui-next/seed-invoke-host.test.ts +47 -0
- package/src/console/ui-next/seed-invoke-host.ts +199 -0
- package/src/console/ui-next/seed-invoke-ops.test.ts +280 -0
- package/src/console/ui-next/seed-invoke-ops.ts +587 -0
- package/src/console/ui-next/src/client-session.test.ts +22 -0
- package/src/console/ui-next/src/client.ts +1379 -0
- package/src/console/ui-next/src/components/agents/agent-code.tsx +207 -0
- package/src/console/ui-next/src/components/agents/agent-disclosure.tsx +63 -0
- package/src/console/ui-next/src/components/agents/file-diff.tsx +271 -0
- package/src/console/ui-next/src/components/auth-card.tsx +298 -0
- package/src/console/ui-next/src/components/charts/animation.ts +36 -0
- package/src/console/ui-next/src/components/charts/area-chart-loading.tsx +115 -0
- package/src/console/ui-next/src/components/charts/area-chart.tsx +261 -0
- package/src/console/ui-next/src/components/charts/area-gradient-defs.tsx +98 -0
- package/src/console/ui-next/src/components/charts/area.tsx +349 -0
- package/src/console/ui-next/src/components/charts/chart-child-passthrough.ts +110 -0
- package/src/console/ui-next/src/components/charts/chart-config-context.tsx +81 -0
- package/src/console/ui-next/src/components/charts/chart-context.tsx +414 -0
- package/src/console/ui-next/src/components/charts/chart-defs.ts +61 -0
- package/src/console/ui-next/src/components/charts/chart-formatters.ts +26 -0
- package/src/console/ui-next/src/components/charts/chart-legend-hover.tsx +41 -0
- package/src/console/ui-next/src/components/charts/chart-loading-label.tsx +56 -0
- package/src/console/ui-next/src/components/charts/chart-phase.ts +52 -0
- package/src/console/ui-next/src/components/charts/chart-reveal-clip.tsx +87 -0
- package/src/console/ui-next/src/components/charts/composed-chart.tsx +333 -0
- package/src/console/ui-next/src/components/charts/dash-tail-stroke.tsx +75 -0
- package/src/console/ui-next/src/components/charts/decimate-time-series.ts +134 -0
- package/src/console/ui-next/src/components/charts/fade-edges.ts +52 -0
- package/src/console/ui-next/src/components/charts/filter-data-by-x-domain.ts +59 -0
- package/src/console/ui-next/src/components/charts/generate-chart-skeleton-data.ts +42 -0
- package/src/console/ui-next/src/components/charts/grid.tsx +299 -0
- package/src/console/ui-next/src/components/charts/highlight-segment-bounds.ts +68 -0
- package/src/console/ui-next/src/components/charts/highlight-segment.tsx +65 -0
- package/src/console/ui-next/src/components/charts/indicator-fade.ts +62 -0
- package/src/console/ui-next/src/components/charts/line-chart-loading.tsx +111 -0
- package/src/console/ui-next/src/components/charts/line-chart.tsx +293 -0
- package/src/console/ui-next/src/components/charts/line-loading-pulse.tsx +201 -0
- package/src/console/ui-next/src/components/charts/line-loading-timing.ts +12 -0
- package/src/console/ui-next/src/components/charts/line-series-terminal-marker.tsx +91 -0
- package/src/console/ui-next/src/components/charts/line.tsx +384 -0
- package/src/console/ui-next/src/components/charts/loading-sweep.tsx +452 -0
- package/src/console/ui-next/src/components/charts/motion-utils.ts +47 -0
- package/src/console/ui-next/src/components/charts/path-stroke-utils.ts +82 -0
- package/src/console/ui-next/src/components/charts/pattern-area.tsx +45 -0
- package/src/console/ui-next/src/components/charts/projection-config.ts +112 -0
- package/src/console/ui-next/src/components/charts/projection-line-end-marker.tsx +51 -0
- package/src/console/ui-next/src/components/charts/projection-line.tsx +208 -0
- package/src/console/ui-next/src/components/charts/projection-utils.ts +378 -0
- package/src/console/ui-next/src/components/charts/reference-area-config.ts +59 -0
- package/src/console/ui-next/src/components/charts/reference-area-geometry.ts +136 -0
- package/src/console/ui-next/src/components/charts/reference-area-registration-context.tsx +16 -0
- package/src/console/ui-next/src/components/charts/series-bar-layout.ts +60 -0
- package/src/console/ui-next/src/components/charts/series-bar.tsx +304 -0
- package/src/console/ui-next/src/components/charts/series-dash-tail-overlay.tsx +82 -0
- package/src/console/ui-next/src/components/charts/series-highlight-layer.tsx +49 -0
- package/src/console/ui-next/src/components/charts/series-hover-dim.tsx +57 -0
- package/src/console/ui-next/src/components/charts/series-markers.tsx +267 -0
- package/src/console/ui-next/src/components/charts/series-path-utils.ts +103 -0
- package/src/console/ui-next/src/components/charts/series-point-marker.tsx +205 -0
- package/src/console/ui-next/src/components/charts/static-chart-preview-context.tsx +16 -0
- package/src/console/ui-next/src/components/charts/time-series-chart-shell.tsx +644 -0
- package/src/console/ui-next/src/components/charts/tooltip/chart-tooltip.tsx +400 -0
- package/src/console/ui-next/src/components/charts/tooltip/date-ticker.tsx +140 -0
- package/src/console/ui-next/src/components/charts/tooltip/index.ts +10 -0
- package/src/console/ui-next/src/components/charts/tooltip/tooltip-box.tsx +227 -0
- package/src/console/ui-next/src/components/charts/tooltip/tooltip-content.tsx +58 -0
- package/src/console/ui-next/src/components/charts/tooltip/tooltip-dot.tsx +173 -0
- package/src/console/ui-next/src/components/charts/tooltip/tooltip-indicator.tsx +191 -0
- package/src/console/ui-next/src/components/charts/use-animated-series-path.ts +155 -0
- package/src/console/ui-next/src/components/charts/use-animated-y-domains.ts +227 -0
- package/src/console/ui-next/src/components/charts/use-chart-interaction.ts +343 -0
- package/src/console/ui-next/src/components/charts/use-chart-phase-orchestrator.ts +173 -0
- package/src/console/ui-next/src/components/charts/use-enter-complete.ts +28 -0
- package/src/console/ui-next/src/components/charts/use-grid-shimmer.ts +101 -0
- package/src/console/ui-next/src/components/charts/use-highlight-segment.ts +58 -0
- package/src/console/ui-next/src/components/charts/use-mount-progress.ts +29 -0
- package/src/console/ui-next/src/components/charts/use-scheduled-tooltip.ts +97 -0
- package/src/console/ui-next/src/components/charts/x-axis.tsx +635 -0
- package/src/console/ui-next/src/components/charts/y-axis-scales.ts +108 -0
- package/src/console/ui-next/src/components/charts/y-axis-ticks.ts +25 -0
- package/src/console/ui-next/src/components/charts/y-axis.tsx +151 -0
- package/src/console/ui-next/src/components/charts/y-domain-utils.ts +120 -0
- package/src/console/ui-next/src/components/console-chrome.tsx +50 -0
- package/src/console/ui-next/src/components/document-title.tsx +18 -0
- package/src/console/ui-next/src/components/explorer/copy-inline-button.tsx +57 -0
- package/src/console/ui-next/src/components/explorer/detail-header.tsx +82 -0
- package/src/console/ui-next/src/components/explorer/explorer-chrome.ts +123 -0
- package/src/console/ui-next/src/components/explorer/explorer-empty.tsx +67 -0
- package/src/console/ui-next/src/components/explorer/explorer-search.tsx +20 -0
- package/src/console/ui-next/src/components/explorer/explorer-start-toggle.tsx +52 -0
- package/src/console/ui-next/src/components/explorer/section-head.tsx +33 -0
- package/src/console/ui-next/src/components/explorer/tree-expand-toggle.tsx +69 -0
- package/src/console/ui-next/src/components/explorer/use-explorer-start-panel.ts +34 -0
- package/src/console/ui-next/src/components/gate-list.tsx +70 -0
- package/src/console/ui-next/src/components/generate-password-button.tsx +76 -0
- package/src/console/ui-next/src/components/highlighted-json.tsx +73 -0
- package/src/console/ui-next/src/components/http-method-badge.tsx +35 -0
- package/src/console/ui-next/src/components/mode-toggle.tsx +84 -0
- package/src/console/ui-next/src/components/motion/button/base.tsx +145 -0
- package/src/console/ui-next/src/components/motion/button/expanding-arrow.tsx +167 -0
- package/src/console/ui-next/src/components/motion/button/index.ts +12 -0
- package/src/console/ui-next/src/components/motion/button/stateful.tsx +243 -0
- package/src/console/ui-next/src/components/motion/checkbox.tsx +120 -0
- package/src/console/ui-next/src/components/motion/select.tsx +436 -0
- package/src/console/ui-next/src/components/motion/switch.tsx +108 -0
- package/src/console/ui-next/src/components/motion/table/editable-cell.tsx +98 -0
- package/src/console/ui-next/src/components/motion/table/index.tsx +404 -0
- package/src/console/ui-next/src/components/motion/table/row-handle.tsx +95 -0
- package/src/console/ui-next/src/components/motion/table/skeleton-rows.tsx +52 -0
- package/src/console/ui-next/src/components/motion/table/table-header.tsx +337 -0
- package/src/console/ui-next/src/components/motion/table/table-menu.tsx +130 -0
- package/src/console/ui-next/src/components/motion/table/types.ts +109 -0
- package/src/console/ui-next/src/components/motion/table/use-cell-range.ts +145 -0
- package/src/console/ui-next/src/components/motion/table/use-column-reorder.ts +112 -0
- package/src/console/ui-next/src/components/motion/table/use-column-resize.ts +83 -0
- package/src/console/ui-next/src/components/motion/table/use-column-sort.ts +73 -0
- package/src/console/ui-next/src/components/motion/table/use-row-selection.ts +70 -0
- package/src/console/ui-next/src/components/motion/table/utils.ts +138 -0
- package/src/console/ui-next/src/components/oke-logo.tsx +65 -0
- package/src/console/ui-next/src/components/password-input.tsx +67 -0
- package/src/console/ui-next/src/components/password-strength.tsx +160 -0
- package/src/console/ui-next/src/components/shell/app-sidebar.tsx +117 -0
- package/src/console/ui-next/src/components/shell/command-items.test.ts +30 -0
- package/src/console/ui-next/src/components/shell/command-items.ts +144 -0
- package/src/console/ui-next/src/components/shell/command-match.test.ts +37 -0
- package/src/console/ui-next/src/components/shell/command-match.ts +45 -0
- package/src/console/ui-next/src/components/shell/command-palette.tsx +334 -0
- package/src/console/ui-next/src/components/shell/nav-footer.tsx +109 -0
- package/src/console/ui-next/src/components/shell/section-empty.tsx +42 -0
- package/src/console/ui-next/src/components/shell/settings-dialog.tsx +65 -0
- package/src/console/ui-next/src/components/shell/shell-layout.tsx +100 -0
- package/src/console/ui-next/src/components/shimmering-text.tsx +87 -0
- package/src/console/ui-next/src/components/signal-delivery-badge.tsx +38 -0
- package/src/console/ui-next/src/components/theme-provider.tsx +86 -0
- package/src/console/ui-next/src/components/ui/alert-dialog.tsx +147 -0
- package/src/console/ui-next/src/components/ui/avatar.tsx +91 -0
- package/src/console/ui-next/src/components/ui/badge.tsx +54 -0
- package/src/console/ui-next/src/components/ui/breadcrumb.tsx +104 -0
- package/src/console/ui-next/src/components/ui/button.tsx +58 -0
- package/src/console/ui-next/src/components/ui/card.tsx +88 -0
- package/src/console/ui-next/src/components/ui/collapsible.tsx +15 -0
- package/src/console/ui-next/src/components/ui/confirm-sheet.tsx +149 -0
- package/src/console/ui-next/src/components/ui/dialog.tsx +144 -0
- package/src/console/ui-next/src/components/ui/dropdown-menu.tsx +265 -0
- package/src/console/ui-next/src/components/ui/empty.tsx +95 -0
- package/src/console/ui-next/src/components/ui/field.tsx +224 -0
- package/src/console/ui-next/src/components/ui/input.tsx +30 -0
- package/src/console/ui-next/src/components/ui/kbd.tsx +41 -0
- package/src/console/ui-next/src/components/ui/label.tsx +20 -0
- package/src/console/ui-next/src/components/ui/progress.tsx +66 -0
- package/src/console/ui-next/src/components/ui/resizable.tsx +74 -0
- package/src/console/ui-next/src/components/ui/select.tsx +230 -0
- package/src/console/ui-next/src/components/ui/separator.tsx +21 -0
- package/src/console/ui-next/src/components/ui/sheet-form.tsx +337 -0
- package/src/console/ui-next/src/components/ui/sheet.tsx +130 -0
- package/src/console/ui-next/src/components/ui/sidebar.tsx +691 -0
- package/src/console/ui-next/src/components/ui/skeleton.tsx +20 -0
- package/src/console/ui-next/src/components/ui/toggle-group.tsx +87 -0
- package/src/console/ui-next/src/components/ui/toggle.tsx +46 -0
- package/src/console/ui-next/src/components/ui/toolbar-tip.tsx +41 -0
- package/src/console/ui-next/src/components/ui/tooltip.tsx +74 -0
- package/src/console/ui-next/src/features/auth/auth-redirect.test.ts +119 -0
- package/src/console/ui-next/src/features/auth/auth-redirect.ts +153 -0
- package/src/console/ui-next/src/features/auth/login-form.tsx +234 -0
- package/src/console/ui-next/src/features/auth/logout.ts +17 -0
- package/src/console/ui-next/src/features/flows/data/console-live-session.test.ts +329 -0
- package/src/console/ui-next/src/features/flows/data/console-live-session.ts +210 -0
- package/src/console/ui-next/src/features/flows/data/use-console-live.ts +79 -0
- package/src/console/ui-next/src/features/flows/data/use-manifest.ts +23 -0
- package/src/console/ui-next/src/features/flows/data/use-runs.ts +24 -0
- package/src/console/ui-next/src/features/flows/fixture.ts +81 -0
- package/src/console/ui-next/src/features/flows/flows-page.tsx +227 -0
- package/src/console/ui-next/src/features/flows/graph/build-flow-graph.test.ts +236 -0
- package/src/console/ui-next/src/features/flows/graph/build-flow-graph.ts +530 -0
- package/src/console/ui-next/src/features/flows/graph/element-map.test.ts +443 -0
- package/src/console/ui-next/src/features/flows/graph/element-map.ts +1077 -0
- package/src/console/ui-next/src/features/flows/graph/flow-graph-nodes.tsx +486 -0
- package/src/console/ui-next/src/features/flows/graph/flow-graph-theme.ts +143 -0
- package/src/console/ui-next/src/features/flows/graph/flow-graph.tsx +268 -0
- package/src/console/ui-next/src/features/flows/graph/neighborhood.test.ts +64 -0
- package/src/console/ui-next/src/features/flows/graph/neighborhood.ts +82 -0
- package/src/console/ui-next/src/features/flows/graph/orchestra.test.ts +97 -0
- package/src/console/ui-next/src/features/flows/graph/orchestra.ts +86 -0
- package/src/console/ui-next/src/features/flows/graph/use-overview-orchestra.ts +95 -0
- package/src/console/ui-next/src/features/flows/state/flows-selection.test.ts +24 -0
- package/src/console/ui-next/src/features/flows/state/flows-selection.ts +92 -0
- package/src/console/ui-next/src/features/flows/traces/advanced-filters.tsx +222 -0
- package/src/console/ui-next/src/features/flows/traces/cache-glyph.tsx +42 -0
- package/src/console/ui-next/src/features/flows/traces/cache-icon.test.ts +27 -0
- package/src/console/ui-next/src/features/flows/traces/cache-icon.ts +48 -0
- package/src/console/ui-next/src/features/flows/traces/dimension-query.test.ts +100 -0
- package/src/console/ui-next/src/features/flows/traces/dimension-query.ts +325 -0
- package/src/console/ui-next/src/features/flows/traces/duration-tone.test.ts +71 -0
- package/src/console/ui-next/src/features/flows/traces/duration-tone.ts +128 -0
- package/src/console/ui-next/src/features/flows/traces/effect-kind.ts +106 -0
- package/src/console/ui-next/src/features/flows/traces/effect-summary.ts +193 -0
- package/src/console/ui-next/src/features/flows/traces/filter-runs.test.ts +98 -0
- package/src/console/ui-next/src/features/flows/traces/filter-runs.ts +68 -0
- package/src/console/ui-next/src/features/flows/traces/format-duration.test.ts +47 -0
- package/src/console/ui-next/src/features/flows/traces/format-duration.ts +25 -0
- package/src/console/ui-next/src/features/flows/traces/graph-filter.test.ts +192 -0
- package/src/console/ui-next/src/features/flows/traces/graph-filter.ts +175 -0
- package/src/console/ui-next/src/features/flows/traces/http-method.ts +134 -0
- package/src/console/ui-next/src/features/flows/traces/replay-playback.test.ts +101 -0
- package/src/console/ui-next/src/features/flows/traces/replay-playback.ts +107 -0
- package/src/console/ui-next/src/features/flows/traces/request-input-view.test.ts +60 -0
- package/src/console/ui-next/src/features/flows/traces/request-input-view.ts +108 -0
- package/src/console/ui-next/src/features/flows/traces/request-meta.ts +62 -0
- package/src/console/ui-next/src/features/flows/traces/scope-runs.test.ts +51 -0
- package/src/console/ui-next/src/features/flows/traces/scope-runs.ts +23 -0
- package/src/console/ui-next/src/features/flows/traces/trace-actions.test.ts +80 -0
- package/src/console/ui-next/src/features/flows/traces/trace-actions.ts +57 -0
- package/src/console/ui-next/src/features/flows/traces/trace-chain.test.ts +68 -0
- package/src/console/ui-next/src/features/flows/traces/trace-chain.ts +59 -0
- package/src/console/ui-next/src/features/flows/traces/trace-detail-sheet.tsx +1003 -0
- package/src/console/ui-next/src/features/flows/traces/trace-detail.test.ts +357 -0
- package/src/console/ui-next/src/features/flows/traces/trace-gates.ts +90 -0
- package/src/console/ui-next/src/features/flows/traces/trace-request-section.tsx +574 -0
- package/src/console/ui-next/src/features/flows/traces/trace-row-meta.test.ts +42 -0
- package/src/console/ui-next/src/features/flows/traces/trace-row-meta.ts +47 -0
- package/src/console/ui-next/src/features/flows/traces/trace-row.tsx +149 -0
- package/src/console/ui-next/src/features/flows/traces/traces-pane.tsx +289 -0
- package/src/console/ui-next/src/features/flows/traces/trigger-icon.test.ts +42 -0
- package/src/console/ui-next/src/features/flows/traces/trigger-icon.ts +53 -0
- package/src/console/ui-next/src/features/flows/traces/waterfall-bars.test.ts +93 -0
- package/src/console/ui-next/src/features/flows/traces/waterfall-bars.ts +80 -0
- package/src/console/ui-next/src/features/flows/traces/waterfall-timeline.test.ts +121 -0
- package/src/console/ui-next/src/features/flows/traces/waterfall-timeline.ts +230 -0
- package/src/console/ui-next/src/features/flows/traces/waterfall-tooltip.test.ts +51 -0
- package/src/console/ui-next/src/features/flows/traces/waterfall-tooltip.ts +20 -0
- package/src/console/ui-next/src/features/not-found/not-found-page.tsx +23 -0
- package/src/console/ui-next/src/features/observability/data/use-ai-list.ts +26 -0
- package/src/console/ui-next/src/features/observability/data/use-clock-list.ts +27 -0
- package/src/console/ui-next/src/features/observability/data/use-instances-list.ts +27 -0
- package/src/console/ui-next/src/features/observability/data/use-runs-query.ts +39 -0
- package/src/console/ui-next/src/features/observability/data/use-signals-list.ts +25 -0
- package/src/console/ui-next/src/features/observability/detail/ai-rail.tsx +77 -0
- package/src/console/ui-next/src/features/observability/detail/instance-fleet-sheet.tsx +111 -0
- package/src/console/ui-next/src/features/observability/detail/metrics-chart.tsx +111 -0
- package/src/console/ui-next/src/features/observability/detail/metrics-panel.tsx +154 -0
- package/src/console/ui-next/src/features/observability/explorer/error-list.tsx +139 -0
- package/src/console/ui-next/src/features/observability/explorer/error-row.tsx +84 -0
- package/src/console/ui-next/src/features/observability/explorer/health-strip.tsx +146 -0
- package/src/console/ui-next/src/features/observability/lib/ask-count.test.ts +47 -0
- package/src/console/ui-next/src/features/observability/lib/ask-count.ts +44 -0
- package/src/console/ui-next/src/features/observability/lib/health-cells.test.ts +243 -0
- package/src/console/ui-next/src/features/observability/lib/health-cells.ts +207 -0
- package/src/console/ui-next/src/features/observability/lib/run-fixture.ts +43 -0
- package/src/console/ui-next/src/features/observability/lib/time-buckets.test.ts +61 -0
- package/src/console/ui-next/src/features/observability/lib/time-buckets.ts +126 -0
- package/src/console/ui-next/src/features/observability/lib/token-count.test.ts +75 -0
- package/src/console/ui-next/src/features/observability/lib/token-count.ts +70 -0
- package/src/console/ui-next/src/features/observability/lib/top-errors.test.ts +89 -0
- package/src/console/ui-next/src/features/observability/lib/top-errors.ts +135 -0
- package/src/console/ui-next/src/features/observability/lib/window-stats.test.ts +62 -0
- package/src/console/ui-next/src/features/observability/lib/window-stats.ts +124 -0
- package/src/console/ui-next/src/features/observability/observability-page.tsx +217 -0
- package/src/console/ui-next/src/features/observability/query/runs-query-panel.tsx +91 -0
- package/src/console/ui-next/src/features/observability/state/observability-selection.test.ts +27 -0
- package/src/console/ui-next/src/features/observability/state/observability-selection.ts +121 -0
- package/src/console/ui-next/src/features/setup/auth-gate.test.ts +17 -0
- package/src/console/ui-next/src/features/setup/auth-gate.ts +21 -0
- package/src/console/ui-next/src/features/setup/claim-page.tsx +418 -0
- package/src/console/ui-next/src/features/store/data/use-gates.ts +26 -0
- package/src/console/ui-next/src/features/store/data/use-store-edit.ts +92 -0
- package/src/console/ui-next/src/features/store/data/use-store-files.ts +96 -0
- package/src/console/ui-next/src/features/store/data/use-store-kv-stats.ts +47 -0
- package/src/console/ui-next/src/features/store/data/use-store-query.test.ts +42 -0
- package/src/console/ui-next/src/features/store/data/use-store-query.ts +68 -0
- package/src/console/ui-next/src/features/store/data/use-store-reveal.ts +28 -0
- package/src/console/ui-next/src/features/store/data/use-store-sql-advise.ts +39 -0
- package/src/console/ui-next/src/features/store/data/use-store-sql-locks.ts +51 -0
- package/src/console/ui-next/src/features/store/data/use-store-sql-stats.ts +47 -0
- package/src/console/ui-next/src/features/store/data/use-store-sql.ts +39 -0
- package/src/console/ui-next/src/features/store/data/use-stores-list.ts +24 -0
- package/src/console/ui-next/src/features/store/detail/browse-section.tsx +692 -0
- package/src/console/ui-next/src/features/store/detail/json-value-sheet.tsx +470 -0
- package/src/console/ui-next/src/features/store/detail/resource-panel.tsx +325 -0
- package/src/console/ui-next/src/features/store/detail/reveal-cell.tsx +137 -0
- package/src/console/ui-next/src/features/store/detail/store-row-detail-sheet.tsx +225 -0
- package/src/console/ui-next/src/features/store/detail/touched-by-section.tsx +101 -0
- package/src/console/ui-next/src/features/store/explorer/store-tree.tsx +1044 -0
- package/src/console/ui-next/src/features/store/files/file-explorer.tsx +563 -0
- package/src/console/ui-next/src/features/store/files/file-kind-icon.tsx +70 -0
- package/src/console/ui-next/src/features/store/files/file-preview.tsx +338 -0
- package/src/console/ui-next/src/features/store/files/file-upload-sheet.tsx +190 -0
- package/src/console/ui-next/src/features/store/grid/catalog-advanced.tsx +80 -0
- package/src/console/ui-next/src/features/store/grid/extension-library-sheet.tsx +761 -0
- package/src/console/ui-next/src/features/store/grid/kv-add-sheet.tsx +165 -0
- package/src/console/ui-next/src/features/store/grid/pending-changes-sheet.tsx +219 -0
- package/src/console/ui-next/src/features/store/grid/rls-policy-sheet.tsx +875 -0
- package/src/console/ui-next/src/features/store/grid/sql-function-sheet.tsx +473 -0
- package/src/console/ui-next/src/features/store/grid/sql-index-sheet.tsx +355 -0
- package/src/console/ui-next/src/features/store/grid/sql-insert-sheet.tsx +177 -0
- package/src/console/ui-next/src/features/store/grid/sql-trigger-sheet.tsx +445 -0
- package/src/console/ui-next/src/features/store/grid/store-confirm-sheet.tsx +73 -0
- package/src/console/ui-next/src/features/store/grid/store-data-grid.tsx +1844 -0
- package/src/console/ui-next/src/features/store/grid/store-edit-sheet.tsx +329 -0
- package/src/console/ui-next/src/features/store/grid/store-grid-context-menu.tsx +111 -0
- package/src/console/ui-next/src/features/store/grid/store-grid-shortcuts.tsx +124 -0
- package/src/console/ui-next/src/features/store/lib/cell-selection.test.ts +125 -0
- package/src/console/ui-next/src/features/store/lib/cell-selection.ts +115 -0
- package/src/console/ui-next/src/features/store/lib/confirmation.test.ts +48 -0
- package/src/console/ui-next/src/features/store/lib/confirmation.ts +63 -0
- package/src/console/ui-next/src/features/store/lib/edit-history.test.ts +60 -0
- package/src/console/ui-next/src/features/store/lib/edit-history.ts +64 -0
- package/src/console/ui-next/src/features/store/lib/fields-from-table.ts +94 -0
- package/src/console/ui-next/src/features/store/lib/files-body.test.ts +16 -0
- package/src/console/ui-next/src/features/store/lib/files-body.ts +79 -0
- package/src/console/ui-next/src/features/store/lib/files-meta.test.ts +75 -0
- package/src/console/ui-next/src/features/store/lib/files-meta.ts +259 -0
- package/src/console/ui-next/src/features/store/lib/files-origin.test.ts +69 -0
- package/src/console/ui-next/src/features/store/lib/files-origin.ts +53 -0
- package/src/console/ui-next/src/features/store/lib/files-tree.test.ts +123 -0
- package/src/console/ui-next/src/features/store/lib/files-tree.ts +233 -0
- package/src/console/ui-next/src/features/store/lib/grid-model.test.ts +127 -0
- package/src/console/ui-next/src/features/store/lib/grid-model.ts +219 -0
- package/src/console/ui-next/src/features/store/lib/grid-transfer.test.ts +123 -0
- package/src/console/ui-next/src/features/store/lib/grid-transfer.ts +217 -0
- package/src/console/ui-next/src/features/store/lib/index-query.test.ts +30 -0
- package/src/console/ui-next/src/features/store/lib/index-query.ts +57 -0
- package/src/console/ui-next/src/features/store/lib/json-value.test.ts +141 -0
- package/src/console/ui-next/src/features/store/lib/json-value.ts +266 -0
- package/src/console/ui-next/src/features/store/lib/kv-format.test.ts +44 -0
- package/src/console/ui-next/src/features/store/lib/kv-format.ts +103 -0
- package/src/console/ui-next/src/features/store/lib/kv-meta.test.ts +43 -0
- package/src/console/ui-next/src/features/store/lib/kv-meta.ts +63 -0
- package/src/console/ui-next/src/features/store/lib/kv-query.test.ts +128 -0
- package/src/console/ui-next/src/features/store/lib/kv-query.ts +303 -0
- package/src/console/ui-next/src/features/store/lib/parse-resource-ref.ts +38 -0
- package/src/console/ui-next/src/features/store/lib/patch.test.ts +99 -0
- package/src/console/ui-next/src/features/store/lib/patch.ts +129 -0
- package/src/console/ui-next/src/features/store/lib/pending-edits.test.ts +125 -0
- package/src/console/ui-next/src/features/store/lib/pending-edits.ts +150 -0
- package/src/console/ui-next/src/features/store/lib/pending-sql.test.ts +108 -0
- package/src/console/ui-next/src/features/store/lib/pending-sql.ts +136 -0
- package/src/console/ui-next/src/features/store/lib/pg-extension-library.test.ts +117 -0
- package/src/console/ui-next/src/features/store/lib/pg-extension-library.ts +277 -0
- package/src/console/ui-next/src/features/store/lib/query-defaults.test.ts +78 -0
- package/src/console/ui-next/src/features/store/lib/query-defaults.ts +77 -0
- package/src/console/ui-next/src/features/store/lib/query-gate.test.ts +132 -0
- package/src/console/ui-next/src/features/store/lib/query-gate.ts +187 -0
- package/src/console/ui-next/src/features/store/lib/query-highlight.test.ts +103 -0
- package/src/console/ui-next/src/features/store/lib/query-highlight.ts +382 -0
- package/src/console/ui-next/src/features/store/lib/query-schema.test.ts +139 -0
- package/src/console/ui-next/src/features/store/lib/query-schema.ts +128 -0
- package/src/console/ui-next/src/features/store/lib/query-session.test.ts +91 -0
- package/src/console/ui-next/src/features/store/lib/query-session.ts +330 -0
- package/src/console/ui-next/src/features/store/lib/replica-lag.test.ts +101 -0
- package/src/console/ui-next/src/features/store/lib/replica-lag.ts +31 -0
- package/src/console/ui-next/src/features/store/lib/resource-effects.ts +12 -0
- package/src/console/ui-next/src/features/store/lib/rls-gate-catalog.test.ts +131 -0
- package/src/console/ui-next/src/features/store/lib/rls-gate-catalog.ts +274 -0
- package/src/console/ui-next/src/features/store/lib/rls-policy.test.ts +95 -0
- package/src/console/ui-next/src/features/store/lib/rls-policy.ts +290 -0
- package/src/console/ui-next/src/features/store/lib/rtl.test.ts +17 -0
- package/src/console/ui-next/src/features/store/lib/rtl.ts +15 -0
- package/src/console/ui-next/src/features/store/lib/schema-color.test.ts +91 -0
- package/src/console/ui-next/src/features/store/lib/schema-color.ts +216 -0
- package/src/console/ui-next/src/features/store/lib/schema-graph.test.ts +435 -0
- package/src/console/ui-next/src/features/store/lib/schema-graph.ts +566 -0
- package/src/console/ui-next/src/features/store/lib/sql-catalog.test.ts +60 -0
- package/src/console/ui-next/src/features/store/lib/sql-catalog.ts +98 -0
- package/src/console/ui-next/src/features/store/lib/sql-complete.test.ts +109 -0
- package/src/console/ui-next/src/features/store/lib/sql-complete.ts +385 -0
- package/src/console/ui-next/src/features/store/lib/sql-format.test.ts +35 -0
- package/src/console/ui-next/src/features/store/lib/sql-format.ts +85 -0
- package/src/console/ui-next/src/features/store/lib/sql-function.test.ts +141 -0
- package/src/console/ui-next/src/features/store/lib/sql-function.ts +195 -0
- package/src/console/ui-next/src/features/store/lib/sql-index.test.ts +101 -0
- package/src/console/ui-next/src/features/store/lib/sql-index.ts +151 -0
- package/src/console/ui-next/src/features/store/lib/sql-statements.test.ts +114 -0
- package/src/console/ui-next/src/features/store/lib/sql-statements.ts +205 -0
- package/src/console/ui-next/src/features/store/lib/sql-trigger.test.ts +125 -0
- package/src/console/ui-next/src/features/store/lib/sql-trigger.ts +210 -0
- package/src/console/ui-next/src/features/store/lib/store-tree.test.ts +220 -0
- package/src/console/ui-next/src/features/store/lib/store-tree.ts +314 -0
- package/src/console/ui-next/src/features/store/performance/advisor-enable.test.ts +16 -0
- package/src/console/ui-next/src/features/store/performance/advisor-enable.ts +26 -0
- package/src/console/ui-next/src/features/store/performance/kv-performance-panel.tsx +223 -0
- package/src/console/ui-next/src/features/store/performance/performance-panel.tsx +442 -0
- package/src/console/ui-next/src/features/store/query/query-complete.tsx +131 -0
- package/src/console/ui-next/src/features/store/query/query-console.tsx +1159 -0
- package/src/console/ui-next/src/features/store/query/query-editor.tsx +300 -0
- package/src/console/ui-next/src/features/store/query/query-gate-menu.tsx +178 -0
- package/src/console/ui-next/src/features/store/query/query-gate-parts.tsx +344 -0
- package/src/console/ui-next/src/features/store/query/query-gate-viz.tsx +166 -0
- package/src/console/ui-next/src/features/store/query/query-highlight-view.tsx +61 -0
- package/src/console/ui-next/src/features/store/query/query-results.tsx +369 -0
- package/src/console/ui-next/src/features/store/query/query-schema-panel.tsx +300 -0
- package/src/console/ui-next/src/features/store/query/sql-style-editor.tsx +73 -0
- package/src/console/ui-next/src/features/store/schema/schema-constraint-icon.tsx +108 -0
- package/src/console/ui-next/src/features/store/schema/schema-relation-edge.tsx +76 -0
- package/src/console/ui-next/src/features/store/schema/schema-relation-icon.tsx +84 -0
- package/src/console/ui-next/src/features/store/schema/schema-table-node.tsx +199 -0
- package/src/console/ui-next/src/features/store/schema/schema-visualizer.tsx +273 -0
- package/src/console/ui-next/src/features/store/state/store-selection.test.ts +38 -0
- package/src/console/ui-next/src/features/store/state/store-selection.ts +154 -0
- package/src/console/ui-next/src/features/store/store-page.tsx +180 -0
- package/src/console/ui-next/src/features/units/call/call-api-panel.tsx +1247 -0
- package/src/console/ui-next/src/features/units/call/call-identity-menu.tsx +226 -0
- package/src/console/ui-next/src/features/units/call/call-pii-button.tsx +60 -0
- package/src/console/ui-next/src/features/units/data/use-flows-invoke.ts +75 -0
- package/src/console/ui-next/src/features/units/detail/effects-summary.tsx +80 -0
- package/src/console/ui-next/src/features/units/detail/errors-section.tsx +64 -0
- package/src/console/ui-next/src/features/units/detail/flow-activity-strip.tsx +119 -0
- package/src/console/ui-next/src/features/units/detail/flow-contract-panel.tsx +335 -0
- package/src/console/ui-next/src/features/units/detail/schema-fields.tsx +149 -0
- package/src/console/ui-next/src/features/units/detail/validation-section.tsx +66 -0
- package/src/console/ui-next/src/features/units/explorer/units-tree.tsx +644 -0
- package/src/console/ui-next/src/features/units/lib/call-invoke-as.test.ts +40 -0
- package/src/console/ui-next/src/features/units/lib/call-read-safe.test.ts +38 -0
- package/src/console/ui-next/src/features/units/lib/call-read-safe.ts +32 -0
- package/src/console/ui-next/src/features/units/lib/call-timing.test.ts +28 -0
- package/src/console/ui-next/src/features/units/lib/call-timing.ts +34 -0
- package/src/console/ui-next/src/features/units/lib/contract-input.test.ts +47 -0
- package/src/console/ui-next/src/features/units/lib/contract-input.ts +68 -0
- package/src/console/ui-next/src/features/units/lib/fields-from-schema.test.ts +119 -0
- package/src/console/ui-next/src/features/units/lib/fields-from-schema.ts +329 -0
- package/src/console/ui-next/src/features/units/lib/fk-lookup.test.ts +103 -0
- package/src/console/ui-next/src/features/units/lib/fk-lookup.ts +175 -0
- package/src/console/ui-next/src/features/units/lib/flow-activity.test.ts +76 -0
- package/src/console/ui-next/src/features/units/lib/flow-activity.ts +68 -0
- package/src/console/ui-next/src/features/units/lib/flow-trigger.test.ts +63 -0
- package/src/console/ui-next/src/features/units/lib/flow-trigger.ts +120 -0
- package/src/console/ui-next/src/features/units/lib/invoke-cache.test.ts +31 -0
- package/src/console/ui-next/src/features/units/lib/invoke-cache.ts +22 -0
- package/src/console/ui-next/src/features/units/lib/invoke-response.test.ts +76 -0
- package/src/console/ui-next/src/features/units/lib/invoke-response.ts +70 -0
- package/src/console/ui-next/src/features/units/lib/path-params.test.ts +43 -0
- package/src/console/ui-next/src/features/units/lib/path-params.ts +75 -0
- package/src/console/ui-next/src/features/units/lib/resolve-clock.test.ts +106 -0
- package/src/console/ui-next/src/features/units/lib/resolve-clock.ts +79 -0
- package/src/console/ui-next/src/features/units/lib/schema-type-visual.ts +28 -0
- package/src/console/ui-next/src/features/units/lib/signal-delivery.test.ts +29 -0
- package/src/console/ui-next/src/features/units/lib/signal-delivery.ts +67 -0
- package/src/console/ui-next/src/features/units/lib/unit-tree.test.ts +289 -0
- package/src/console/ui-next/src/features/units/lib/unit-tree.ts +307 -0
- package/src/console/ui-next/src/features/units/lib/validate-contract.ts +103 -0
- package/src/console/ui-next/src/features/units/state/units-selection.ts +49 -0
- package/src/console/ui-next/src/features/units/units-page.tsx +120 -0
- package/src/console/ui-next/src/features/vault/data/use-vault-list.ts +27 -0
- package/src/console/ui-next/src/features/vault/detail/vault-detail.tsx +831 -0
- package/src/console/ui-next/src/features/vault/detail/vault-overview.tsx +71 -0
- package/src/console/ui-next/src/features/vault/explorer/vault-list.tsx +291 -0
- package/src/console/ui-next/src/features/vault/explorer/vault-posture-strip.tsx +131 -0
- package/src/console/ui-next/src/features/vault/explorer/vault-search.tsx +126 -0
- package/src/console/ui-next/src/features/vault/lib/backend.test.ts +147 -0
- package/src/console/ui-next/src/features/vault/lib/backend.ts +216 -0
- package/src/console/ui-next/src/features/vault/lib/blast-radius.ts +53 -0
- package/src/console/ui-next/src/features/vault/lib/confirmation.test.ts +41 -0
- package/src/console/ui-next/src/features/vault/lib/confirmation.ts +50 -0
- package/src/console/ui-next/src/features/vault/lib/contract-ops.test.ts +35 -0
- package/src/console/ui-next/src/features/vault/lib/contract-ops.ts +94 -0
- package/src/console/ui-next/src/features/vault/lib/dormant.ts +28 -0
- package/src/console/ui-next/src/features/vault/lib/export-safe.test.ts +25 -0
- package/src/console/ui-next/src/features/vault/lib/export-safe.ts +62 -0
- package/src/console/ui-next/src/features/vault/lib/fixture.ts +92 -0
- package/src/console/ui-next/src/features/vault/lib/group.test.ts +31 -0
- package/src/console/ui-next/src/features/vault/lib/group.ts +43 -0
- package/src/console/ui-next/src/features/vault/lib/posture.test.ts +137 -0
- package/src/console/ui-next/src/features/vault/lib/posture.ts +275 -0
- package/src/console/ui-next/src/features/vault/lib/progress.test.ts +36 -0
- package/src/console/ui-next/src/features/vault/lib/progress.ts +51 -0
- package/src/console/ui-next/src/features/vault/lib/search.test.ts +139 -0
- package/src/console/ui-next/src/features/vault/lib/search.ts +403 -0
- package/src/console/ui-next/src/features/vault/lib/theme.ts +14 -0
- package/src/console/ui-next/src/features/vault/lib/types.ts +114 -0
- package/src/console/ui-next/src/features/vault/lib/write-review.test.ts +139 -0
- package/src/console/ui-next/src/features/vault/lib/write-review.ts +115 -0
- package/src/console/ui-next/src/features/vault/sheets/vault-create-sheet.tsx +209 -0
- package/src/console/ui-next/src/features/vault/sheets/vault-master-key-sheet.tsx +87 -0
- package/src/console/ui-next/src/features/vault/sheets/vault-rotate-master-sheet.tsx +43 -0
- package/src/console/ui-next/src/features/vault/sheets/vault-security-sheet.tsx +205 -0
- package/src/console/ui-next/src/features/vault/sheets/vault-verify-sheet.tsx +103 -0
- package/src/console/ui-next/src/features/vault/sheets/vault-write-review-dialog.test.tsx +175 -0
- package/src/console/ui-next/src/features/vault/sheets/vault-write-review-dialog.tsx +135 -0
- package/src/console/ui-next/src/features/vault/sheets/vault-write-sheet.tsx +224 -0
- package/src/console/ui-next/src/features/vault/state/vault-selection.test.ts +20 -0
- package/src/console/ui-next/src/features/vault/state/vault-selection.ts +87 -0
- package/src/console/ui-next/src/features/vault/vault-page.tsx +439 -0
- package/src/console/ui-next/src/hooks/use-mobile.ts +22 -0
- package/src/console/ui-next/src/lib/document-meta.test.ts +43 -0
- package/src/console/ui-next/src/lib/document-meta.ts +34 -0
- package/src/console/ui-next/src/lib/ease.ts +59 -0
- package/src/console/ui-next/src/lib/element-icons.test.ts +38 -0
- package/src/console/ui-next/src/lib/element-icons.ts +75 -0
- package/src/console/ui-next/src/lib/highlight.test.ts +30 -0
- package/src/console/ui-next/src/lib/highlight.ts +39 -0
- package/src/console/ui-next/src/lib/hooks/use-hover-capable.ts +30 -0
- package/src/console/ui-next/src/lib/last-module-search.test.ts +47 -0
- package/src/console/ui-next/src/lib/last-module-search.ts +164 -0
- package/src/console/ui-next/src/lib/motion.ts +16 -0
- package/src/console/ui-next/src/lib/shiki.ts +42 -0
- package/src/console/ui-next/src/lib/shortcut-keys.tsx +47 -0
- package/src/console/ui-next/src/lib/shortcut.test.ts +70 -0
- package/src/console/ui-next/src/lib/shortcut.ts +111 -0
- package/src/console/ui-next/src/lib/use-console-shortcuts.ts +56 -0
- package/src/console/ui-next/src/lib/use-last-module-search.ts +37 -0
- package/src/console/ui-next/src/lib/utils.ts +15 -0
- package/src/console/ui-next/src/main.tsx +44 -0
- package/src/console/ui-next/src/router.tsx +175 -0
- package/src/console/ui-next/src/styles.css +384 -0
- package/src/console/ui-next/src/vite-env.d.ts +17 -0
- package/src/console/ui-next/tsconfig.json +25 -0
- package/src/console/ui-next/ui-next-dev-operator.test.ts +76 -0
- package/src/console/ui-next/ui-next-dev-operator.ts +81 -0
- package/src/console/ui-next/ui-next-seed-app-schema.ts +526 -0
- package/src/console/ui-next/ui-next-seed-manifest-surface.ts +882 -0
- package/src/console/ui-next/ui-next-seed-manifest.ts +635 -0
- package/src/console/ui-next/ui-next-seed-runs.ts +1429 -0
- package/src/console/ui-next/ui-next-seed-store.ts +1125 -0
- package/src/console/ui-next/ui-next-seed.test.ts +511 -0
- package/src/console/ui-next/ui-next-seed.ts +122 -0
- package/src/console/ui-next/vite-console-kernel-plugin.ts +195 -0
- package/src/console/ui-next/vite.config.ts +88 -0
- package/src/console/xss.gate.test.ts +21 -26
- package/src/docker/compose.ts +26 -7
- package/src/docker/derive.ts +67 -13
- package/src/docker/docker.test.ts +219 -27
- package/src/docker/helpers.ts +48 -0
- package/src/docker/images-config.test.ts +29 -22
- package/src/docker/index.ts +8 -0
- package/src/docker/postgres-advisor.integration.test.ts +163 -0
- package/src/docker/query-passthrough.integration.test.ts +212 -0
- package/src/docker/recipes/dragonfly.ts +3 -6
- package/src/docker/recipes/index.ts +13 -0
- package/src/docker/recipes/llama-cpp.ts +3 -3
- package/src/docker/recipes/nginx.ts +61 -0
- package/src/docker/recipes/ollama.ts +1 -1
- package/src/docker/recipes/postgres-advisor.ts +58 -0
- package/src/docker/recipes/postgres.ts +6 -2
- package/src/docker/recipes/redis.ts +2 -6
- package/src/docker/recipes/sglang.ts +1 -1
- package/src/docker/recipes/timescale.ts +6 -2
- package/src/docker/recipes/traefik.ts +1 -0
- package/src/docker/recipes/valkey.ts +2 -6
- package/src/docker/recipes/vllm.ts +1 -1
- package/src/docker/stack-id.test.ts +5 -14
- package/src/docker/stack-id.ts +15 -35
- package/src/docker/stack.integration.test.ts +2 -2
- package/src/docker/types.ts +16 -7
- package/src/drivers/ai-mock.ts +41 -1
- package/src/drivers/ai-openai-compatible.ts +19 -1
- package/src/drivers/index.ts +32 -0
- package/src/drivers/instances-postgres.ts +154 -0
- package/src/drivers/meilisearch.integration.test.ts +9 -0
- package/src/drivers/meilisearch.test.ts +134 -6
- package/src/drivers/meilisearch.ts +77 -8
- package/src/drivers/memory.ts +384 -24
- package/src/drivers/pg-extensions.test.ts +50 -0
- package/src/drivers/pg-extensions.ts +1054 -0
- package/src/drivers/pg-rls.test.ts +71 -0
- package/src/drivers/pg-rls.ts +234 -0
- package/src/drivers/pgvector.ts +24 -0
- package/src/drivers/redis.ts +12 -0
- package/src/drivers/s3-ensure-bucket.test.ts +88 -0
- package/src/drivers/s3-ensure-bucket.ts +152 -0
- package/src/drivers/s3.ts +34 -2
- package/src/drivers/types.ts +29 -1
- package/src/drivers/vault-1password.test.ts +164 -0
- package/src/drivers/vault-1password.ts +351 -0
- package/src/drivers/vault-aws-secrets-manager.ts +15 -94
- package/src/drivers/vault-azure-key-vault.test.ts +137 -0
- package/src/drivers/vault-azure-key-vault.ts +243 -0
- package/src/drivers/vault-doppler.test.ts +133 -0
- package/src/drivers/vault-doppler.ts +202 -0
- package/src/drivers/vault-dotenv-parse.ts +32 -0
- package/src/drivers/vault-env.ts +1 -1
- package/src/drivers/vault-gcp-secret-manager.test.ts +127 -0
- package/src/drivers/vault-gcp-secret-manager.ts +291 -0
- package/src/drivers/vault-managed.test.ts +23 -26
- package/src/drivers/vault-managed.ts +58 -20
- package/src/drivers/vault-remote-bag.ts +242 -0
- package/src/drivers/vault-types.ts +9 -7
- package/src/elements/ai/runtime.ts +100 -8
- package/src/elements/ai/schema.test.ts +133 -0
- package/src/elements/ai/schema.ts +156 -11
- package/src/elements/ai.test.ts +53 -0
- package/src/elements/ai.ts +1 -0
- package/src/elements/clock/runtime.ts +31 -13
- package/src/elements/clock.test.ts +49 -0
- package/src/elements/gate/config.ts +18 -3
- package/src/elements/gate/declare.ts +25 -5
- package/src/elements/gate/flatten.ts +74 -0
- package/src/elements/gate/permissions.ts +1 -0
- package/src/elements/gate/runtime.ts +19 -7
- package/src/elements/gate.test.ts +32 -0
- package/src/elements/gate.ts +9 -1
- package/src/elements/store/cache.test.ts +79 -0
- package/src/elements/store/cache.ts +176 -0
- package/src/elements/store/classify.ts +79 -4
- package/src/elements/store/declare.ts +7 -0
- package/src/elements/store/emit-drizzle.ts +3 -1
- package/src/elements/store/files-policy.test.ts +36 -1
- package/src/elements/store/files-policy.ts +151 -0
- package/src/elements/store/kv-sql.test.ts +86 -0
- package/src/elements/store/kv-sql.ts +178 -0
- package/src/elements/store/resource-list-docs.fixture.ts +0 -2
- package/src/elements/store/resource-list-docs.test.ts +3 -0
- package/src/elements/store/resource.test.ts +62 -2
- package/src/elements/store/resource.ts +279 -62
- package/src/elements/store/runtime.ts +88 -11
- package/src/elements/store/schema-decl.test.ts +49 -0
- package/src/elements/store/schema-decl.ts +29 -9
- package/src/elements/store/seed.test.ts +22 -1
- package/src/elements/store/seed.ts +46 -1
- package/src/elements/store/sql-session.ts +32 -7
- package/src/elements/store/table.ts +17 -1
- package/src/elements/store/upsert-app.test.ts +1 -1
- package/src/elements/store.test.ts +23 -0
- package/src/elements/store.ts +26 -3
- package/src/elements/vault/boot-chain.test.ts +108 -10
- package/src/elements/vault/boot-chain.ts +15 -15
- package/src/elements/vault/builtin-adapter.test.ts +1 -0
- package/src/elements/vault/builtin-adapter.ts +12 -0
- package/src/elements/vault/chain.ts +6 -20
- package/src/elements/vault/declare.ts +5 -2
- package/src/elements/vault/runtime.ts +47 -13
- package/src/elements/vault/storage.ts +35 -4
- package/src/elements/vault.test.ts +1 -0
- package/src/elements/vault.ts +2 -0
- package/src/full.ts +10 -0
- package/src/http.ts +1 -1
- package/src/index.ts +8 -0
- package/src/kernel/adopt-barrel-fresh.test.ts +1 -2
- package/src/kernel/app-auth.ts +8 -1
- package/src/kernel/app.ts +245 -25
- package/src/kernel/auth-resolve.ts +51 -0
- package/src/kernel/auto-cache.test.ts +270 -0
- package/src/kernel/boot-bind/ai.test.ts +34 -1
- package/src/kernel/boot-bind/ai.ts +15 -2
- package/src/kernel/boot-bind/channel.test.ts +1 -1
- package/src/kernel/boot-bind/channel.ts +1 -1
- package/src/kernel/boot-bind/clock.ts +9 -7
- package/src/kernel/boot-bind/gate.ts +1 -1
- package/src/kernel/boot-bind/honor-config.test.ts +70 -3
- package/src/kernel/boot-bind/instances.ts +58 -0
- package/src/kernel/boot-bind/journal.ts +3 -2
- package/src/kernel/boot-bind/runs.ts +63 -5
- package/src/kernel/boot-bind/signal.ts +1 -1
- package/src/kernel/boot-bind/store.test.ts +150 -1
- package/src/kernel/boot-bind/store.ts +70 -5
- package/src/kernel/boot.test.ts +9 -9
- package/src/kernel/boot.ts +115 -16
- package/src/kernel/capability.test.ts +42 -0
- package/src/kernel/capability.ts +44 -2
- package/src/kernel/compensate.test.ts +34 -1
- package/src/kernel/compensate.ts +19 -0
- package/src/kernel/effect-timing.test.ts +16 -0
- package/src/kernel/effects-stamping.test.ts +3 -3
- package/src/kernel/effects.test.ts +15 -0
- package/src/kernel/effects.ts +39 -5
- package/src/kernel/elapsed.test.ts +26 -0
- package/src/kernel/elapsed.ts +23 -0
- package/src/kernel/errors.ts +26 -3
- package/src/kernel/flow.ts +5 -1
- package/src/kernel/fx-ask-telemetry.test.ts +114 -0
- package/src/kernel/fx.test.ts +143 -2
- package/src/kernel/fx.ts +136 -19
- package/src/kernel/graceful-shutdown.test.ts +20 -0
- package/src/kernel/graceful-shutdown.ts +9 -3
- package/src/kernel/horizontal-child.ts +4 -4
- package/src/kernel/http-query.test.ts +184 -0
- package/src/kernel/http-resource.ts +55 -0
- package/src/kernel/index.ts +43 -0
- package/src/kernel/instance-id.ts +23 -0
- package/src/kernel/instances-chaos-child.ts +73 -0
- package/src/kernel/instances.chaos.test.ts +238 -0
- package/src/kernel/instances.test.ts +85 -0
- package/src/kernel/instances.ts +372 -0
- package/src/kernel/lazy-require.ts +20 -0
- package/src/kernel/list-page.test.ts +194 -0
- package/src/kernel/list-page.ts +515 -0
- package/src/kernel/list-query.ts +469 -0
- package/src/kernel/pipeline-api-key.test.ts +266 -0
- package/src/kernel/pipeline.test.ts +164 -2
- package/src/kernel/pipeline.ts +13 -1
- package/src/kernel/plugin-elements.test.ts +1 -1
- package/src/kernel/plugin-needs.test.ts +1 -1
- package/src/kernel/plugin.ts +5 -5
- package/src/kernel/ready.test.ts +22 -2
- package/src/kernel/registry.ts +8 -4
- package/src/kernel/resource-mount.test.ts +75 -0
- package/src/kernel/router/index.ts +2 -0
- package/src/kernel/router/linear.ts +7 -0
- package/src/kernel/router/regexp.ts +8 -0
- package/src/kernel/router/smart.ts +7 -3
- package/src/kernel/router/trie.ts +7 -0
- package/src/kernel/router/types.ts +41 -1
- package/src/kernel/router.test.ts +27 -0
- package/src/kernel/router.ts +2 -0
- package/src/kernel/run-duration.test.ts +92 -0
- package/src/kernel/run-telemetry.ts +8 -2
- package/src/kernel/triggers.ts +95 -74
- package/src/manifest/diff.test.ts +13 -0
- package/src/manifest/diff.ts +15 -0
- package/src/manifest/sql-resource.test.ts +29 -0
- package/src/manifest/sql-resource.ts +20 -4
- package/src/manifest/types.ts +13 -3
- package/src/plugins/auth-delivery.mailpit.integration.test.ts +1 -1
- package/src/plugins/auth-methods.security.test.ts +3 -3
- package/src/plugins/auth-methods.test.ts +2 -2
- package/src/plugins/cors.test.ts +4 -2
- package/src/plugins/cors.ts +11 -2
- package/src/plugins/csrf.test.ts +17 -0
- package/src/plugins/csrf.ts +1 -1
- package/src/plugins/username-policy.test.ts +8 -8
- package/src/plugins/username.ts +1 -1
- package/src/release/build-lib.ts +7 -1
- package/src/release/limits.ts +2 -2
- package/src/release/measure.ts +7 -10
- package/src/runs/bridge-to-console.ts +99 -0
- package/src/runs/collect.test.ts +68 -0
- package/src/runs/collect.ts +29 -2
- package/src/runs/drivers/clickhouse.ts +4 -1
- package/src/runs/drivers/files.ts +138 -33
- package/src/runs/drivers/memory.ts +46 -7
- package/src/runs/drivers/postgres.ts +4 -1
- package/src/runs/duckdb.test.ts +33 -0
- package/src/runs/duckdb.ts +41 -0
- package/src/runs/history.ts +61 -0
- package/src/runs/index.ts +29 -1
- package/src/runs/parquet.test.ts +110 -0
- package/src/runs/parquet.ts +129 -8
- package/src/runs/retention.test.ts +24 -0
- package/src/runs/retention.ts +42 -0
- package/src/runs/runs.test.ts +101 -0
- package/src/runs/runtime.ts +5 -3
- package/src/runs/types.ts +33 -4
- package/src/runtime/bun.ts +61 -4
- package/src/runtime/dev-request-log.test.ts +4 -0
- package/src/runtime/dev-request-log.ts +19 -2
- package/src/runtime/index.ts +8 -1
- package/src/runtime/json-code-block.test.ts +355 -0
- package/src/runtime/json-code-block.ts +961 -0
- package/src/runtime/serve.test.ts +49 -4
- package/src/term.test.ts +89 -1
- package/src/term.ts +103 -29
- package/src/test/create-test-app.ts +3 -1
- package/src/console/ui/access/AccessA11yView.tsx +0 -222
- package/src/console/ui/access/a11y.test.tsx +0 -113
- package/src/console/ui/access/acknowledgement.test.ts +0 -10
- package/src/console/ui/access/acknowledgement.ts +0 -33
- package/src/console/ui/access/blast-radius.test.ts +0 -26
- package/src/console/ui/access/blast-radius.ts +0 -38
- package/src/console/ui/access/confirmation.test.ts +0 -34
- package/src/console/ui/access/confirmation.ts +0 -33
- package/src/console/ui/access/fixture.ts +0 -199
- package/src/console/ui/access/grantable.test.ts +0 -15
- package/src/console/ui/access/grantable.ts +0 -31
- package/src/console/ui/access/hygiene.test.ts +0 -12
- package/src/console/ui/access/hygiene.ts +0 -39
- package/src/console/ui/access/index.ts +0 -47
- package/src/console/ui/access/provenance.test.ts +0 -10
- package/src/console/ui/access/provenance.ts +0 -25
- package/src/console/ui/access/search.test.ts +0 -13
- package/src/console/ui/access/search.ts +0 -68
- package/src/console/ui/access/types.ts +0 -111
- package/src/console/ui/ai/AiA11yView.tsx +0 -254
- package/src/console/ui/ai/a11y.test.tsx +0 -96
- package/src/console/ui/ai/findings.ts +0 -41
- package/src/console/ui/ai/fixture.ts +0 -177
- package/src/console/ui/ai/format.ts +0 -88
- package/src/console/ui/ai/group.test.ts +0 -35
- package/src/console/ui/ai/group.ts +0 -80
- package/src/console/ui/ai/index.ts +0 -59
- package/src/console/ui/ai/promotion.test.ts +0 -72
- package/src/console/ui/ai/promotion.ts +0 -141
- package/src/console/ui/ai/search.test.ts +0 -31
- package/src/console/ui/ai/search.ts +0 -79
- package/src/console/ui/ai/types.ts +0 -132
- package/src/console/ui/architecture/ArchitectureA11yView.tsx +0 -142
- package/src/console/ui/architecture/a11y.test.tsx +0 -96
- package/src/console/ui/architecture/boundary.ts +0 -42
- package/src/console/ui/architecture/declared.ts +0 -161
- package/src/console/ui/architecture/fixture.ts +0 -74
- package/src/console/ui/architecture/index.ts +0 -56
- package/src/console/ui/architecture/layers.ts +0 -64
- package/src/console/ui/architecture/layout.ts +0 -66
- package/src/console/ui/architecture/pathologies.ts +0 -251
- package/src/console/ui/architecture/search.ts +0 -136
- package/src/console/ui/architecture/traffic.ts +0 -92
- package/src/console/ui/architecture/types.ts +0 -136
- package/src/console/ui/architecture/view.test.ts +0 -153
- package/src/console/ui/architecture/view.ts +0 -489
- package/src/console/ui/channels/ChannelsA11yView.tsx +0 -171
- package/src/console/ui/channels/a11y.test.tsx +0 -95
- package/src/console/ui/channels/confirmation.test.ts +0 -34
- package/src/console/ui/channels/confirmation.ts +0 -24
- package/src/console/ui/channels/fallback.test.ts +0 -15
- package/src/console/ui/channels/fallback.ts +0 -20
- package/src/console/ui/channels/findings.ts +0 -34
- package/src/console/ui/channels/fixture.ts +0 -134
- package/src/console/ui/channels/group.ts +0 -25
- package/src/console/ui/channels/index.ts +0 -51
- package/src/console/ui/channels/locale.test.ts +0 -15
- package/src/console/ui/channels/locale.ts +0 -25
- package/src/console/ui/channels/mask.test.ts +0 -14
- package/src/console/ui/channels/mask.ts +0 -12
- package/src/console/ui/channels/search.ts +0 -49
- package/src/console/ui/channels/taxonomy.test.ts +0 -17
- package/src/console/ui/channels/taxonomy.ts +0 -47
- package/src/console/ui/channels/types.ts +0 -118
- package/src/console/ui/clock/ClockA11yView.tsx +0 -165
- package/src/console/ui/clock/a11y.test.tsx +0 -96
- package/src/console/ui/clock/confirmation.test.ts +0 -30
- package/src/console/ui/clock/confirmation.ts +0 -31
- package/src/console/ui/clock/findings.ts +0 -37
- package/src/console/ui/clock/fixture.ts +0 -111
- package/src/console/ui/clock/health.test.ts +0 -25
- package/src/console/ui/clock/health.ts +0 -56
- package/src/console/ui/clock/index.ts +0 -41
- package/src/console/ui/clock/search.test.ts +0 -37
- package/src/console/ui/clock/search.ts +0 -72
- package/src/console/ui/clock/timeline.test.ts +0 -42
- package/src/console/ui/clock/timeline.ts +0 -41
- package/src/console/ui/clock/types.ts +0 -79
- package/src/console/ui/clock/waiting-on.test.ts +0 -30
- package/src/console/ui/clock/waiting-on.ts +0 -78
- package/src/console/ui/confirmation.unify.test.ts +0 -92
- package/src/console/ui/diff/DiffA11yView.tsx +0 -76
- package/src/console/ui/diff/a11y.test.tsx +0 -96
- package/src/console/ui/diff/fixture.ts +0 -85
- package/src/console/ui/diff/group.test.ts +0 -48
- package/src/console/ui/diff/group.ts +0 -91
- package/src/console/ui/diff/index.ts +0 -32
- package/src/console/ui/diff/search.test.ts +0 -28
- package/src/console/ui/diff/search.ts +0 -63
- package/src/console/ui/diff/summary.ts +0 -73
- package/src/console/ui/diff/types.ts +0 -48
- package/src/console/ui/display.test.ts +0 -14
- package/src/console/ui/display.ts +0 -9
- package/src/console/ui/dist/assets/index--Y0Uaz-m.js +0 -10
- package/src/console/ui/dist/assets/panel-access-ri1X9Otj.js +0 -64
- package/src/console/ui/dist/assets/panel-ai-DLHjRoJk.js +0 -1
- package/src/console/ui/dist/assets/panel-architecture-DI3bQF3J.js +0 -1
- package/src/console/ui/dist/assets/panel-channels-BDYWX29p.js +0 -1
- package/src/console/ui/dist/assets/panel-clock-i-JpTjVB.js +0 -1
- package/src/console/ui/dist/assets/panel-diff-CFuWxiXy.js +0 -1
- package/src/console/ui/dist/assets/panel-flows-B8TRhcoe.js +0 -48
- package/src/console/ui/dist/assets/panel-gates-CfkBgco7.js +0 -1
- package/src/console/ui/dist/assets/panel-overview-CW0CQEc2.js +0 -1
- package/src/console/ui/dist/assets/panel-plugins-DDJwTehL.js +0 -1
- package/src/console/ui/dist/assets/panel-runs-BxuyDI3x.js +0 -1
- package/src/console/ui/dist/assets/panel-signals-BXofbj7v.js +0 -1
- package/src/console/ui/dist/assets/panel-store-B8mH-arU.js +0 -1
- package/src/console/ui/dist/assets/panel-traces-DSA-ZWnf.js +0 -1
- package/src/console/ui/dist/assets/panel-vault-BkZdJPX8.js +0 -1
- package/src/console/ui/dist/assets/rolldown-runtime-B0Z9INg1.js +0 -1
- package/src/console/ui/dist/assets/style-C3L349iZ.css +0 -3
- package/src/console/ui/dist/favicon.svg +0 -7
- package/src/console/ui/dist/index.html +0 -15
- package/src/console/ui/flows/FlowsA11yView.tsx +0 -140
- package/src/console/ui/flows/a11y.test.tsx +0 -99
- package/src/console/ui/flows/buffer.test.ts +0 -83
- package/src/console/ui/flows/buffer.ts +0 -111
- package/src/console/ui/flows/confirmation.ts +0 -129
- package/src/console/ui/flows/contract.test.ts +0 -85
- package/src/console/ui/flows/contract.ts +0 -329
- package/src/console/ui/flows/fixture.ts +0 -81
- package/src/console/ui/flows/graph.test.ts +0 -93
- package/src/console/ui/flows/graph.ts +0 -539
- package/src/console/ui/flows/index.ts +0 -82
- package/src/console/ui/flows/save-as-test.test.ts +0 -47
- package/src/console/ui/flows/save-as-test.ts +0 -97
- package/src/console/ui/flows/search.ts +0 -238
- package/src/console/ui/flows/tiers.ts +0 -133
- package/src/console/ui/gates/GatesA11yView.tsx +0 -183
- package/src/console/ui/gates/a11y.test.tsx +0 -113
- package/src/console/ui/gates/audit.test.ts +0 -40
- package/src/console/ui/gates/audit.ts +0 -61
- package/src/console/ui/gates/denial.test.ts +0 -34
- package/src/console/ui/gates/denial.ts +0 -43
- package/src/console/ui/gates/findings.ts +0 -17
- package/src/console/ui/gates/fixture.ts +0 -193
- package/src/console/ui/gates/group.test.ts +0 -30
- package/src/console/ui/gates/group.ts +0 -94
- package/src/console/ui/gates/index.ts +0 -39
- package/src/console/ui/gates/search.test.ts +0 -49
- package/src/console/ui/gates/search.ts +0 -108
- package/src/console/ui/gates/types.ts +0 -124
- package/src/console/ui/overview/OverviewA11yView.tsx +0 -134
- package/src/console/ui/overview/a11y.test.tsx +0 -112
- package/src/console/ui/overview/busiest.ts +0 -24
- package/src/console/ui/overview/compose.ts +0 -121
- package/src/console/ui/overview/cost.test.ts +0 -39
- package/src/console/ui/overview/cost.ts +0 -134
- package/src/console/ui/overview/fixture.ts +0 -156
- package/src/console/ui/overview/golden.ts +0 -47
- package/src/console/ui/overview/index.ts +0 -52
- package/src/console/ui/overview/rank.test.ts +0 -129
- package/src/console/ui/overview/rank.ts +0 -205
- package/src/console/ui/overview/slo.test.ts +0 -69
- package/src/console/ui/overview/slo.ts +0 -240
- package/src/console/ui/overview/types.ts +0 -127
- package/src/console/ui/overview/verdict.ts +0 -124
- package/src/console/ui/plugins/PluginsA11yView.tsx +0 -217
- package/src/console/ui/plugins/a11y.test.tsx +0 -96
- package/src/console/ui/plugins/command.test.ts +0 -22
- package/src/console/ui/plugins/command.ts +0 -27
- package/src/console/ui/plugins/findings.ts +0 -39
- package/src/console/ui/plugins/fixture.ts +0 -238
- package/src/console/ui/plugins/group.test.ts +0 -36
- package/src/console/ui/plugins/group.ts +0 -62
- package/src/console/ui/plugins/index.ts +0 -30
- package/src/console/ui/plugins/search.ts +0 -55
- package/src/console/ui/plugins/types.ts +0 -118
- package/src/console/ui/runs/RunsA11yView.tsx +0 -252
- package/src/console/ui/runs/a11y.test.tsx +0 -96
- package/src/console/ui/runs/errors.test.ts +0 -53
- package/src/console/ui/runs/errors.ts +0 -88
- package/src/console/ui/runs/explain.test.ts +0 -23
- package/src/console/ui/runs/explain.ts +0 -28
- package/src/console/ui/runs/fixture.ts +0 -189
- package/src/console/ui/runs/group.test.ts +0 -24
- package/src/console/ui/runs/group.ts +0 -76
- package/src/console/ui/runs/histogram.test.ts +0 -22
- package/src/console/ui/runs/histogram.ts +0 -82
- package/src/console/ui/runs/index.ts +0 -69
- package/src/console/ui/runs/project.ts +0 -118
- package/src/console/ui/runs/query.test.ts +0 -48
- package/src/console/ui/runs/query.ts +0 -260
- package/src/console/ui/runs/search.test.ts +0 -45
- package/src/console/ui/runs/search.ts +0 -143
- package/src/console/ui/runs/trace-link.test.ts +0 -26
- package/src/console/ui/runs/trace-link.ts +0 -87
- package/src/console/ui/runs/types.ts +0 -135
- package/src/console/ui/shell/App.tsx +0 -88
- package/src/console/ui/shell/client.ts +0 -1642
- package/src/console/ui/shell/components/oke-logo.tsx +0 -40
- package/src/console/ui/shell/components/ui.tsx +0 -111
- package/src/console/ui/shell/index.html +0 -13
- package/src/console/ui/shell/layout/Shell.tsx +0 -92
- package/src/console/ui/shell/main.tsx +0 -216
- package/src/console/ui/shell/panels/Access.tsx +0 -5
- package/src/console/ui/shell/panels/Ai.tsx +0 -5
- package/src/console/ui/shell/panels/Architecture.tsx +0 -5
- package/src/console/ui/shell/panels/Channels.tsx +0 -5
- package/src/console/ui/shell/panels/Clock.tsx +0 -5
- package/src/console/ui/shell/panels/Diff.tsx +0 -5
- package/src/console/ui/shell/panels/Flows.tsx +0 -5
- package/src/console/ui/shell/panels/Gates.tsx +0 -5
- package/src/console/ui/shell/panels/Overview.tsx +0 -6
- package/src/console/ui/shell/panels/Plugins.tsx +0 -5
- package/src/console/ui/shell/panels/Runs.tsx +0 -5
- package/src/console/ui/shell/panels/Signals.tsx +0 -5
- package/src/console/ui/shell/panels/Store.tsx +0 -5
- package/src/console/ui/shell/panels/Traces.tsx +0 -5
- package/src/console/ui/shell/panels/Vault.tsx +0 -5
- package/src/console/ui/shell/panels/access/AccessPanel.tsx +0 -749
- package/src/console/ui/shell/panels/ai/AiPanel.tsx +0 -492
- package/src/console/ui/shell/panels/architecture/ArchitecturePanel.tsx +0 -329
- package/src/console/ui/shell/panels/channels/ChannelsPanel.tsx +0 -422
- package/src/console/ui/shell/panels/clock/ClockPanel.tsx +0 -454
- package/src/console/ui/shell/panels/diff/DiffPanel.tsx +0 -234
- package/src/console/ui/shell/panels/flows/ContractEditor.tsx +0 -284
- package/src/console/ui/shell/panels/flows/FlowDrawer.tsx +0 -335
- package/src/console/ui/shell/panels/flows/FlowsPanel.tsx +0 -482
- package/src/console/ui/shell/panels/gates/GatesPanel.tsx +0 -433
- package/src/console/ui/shell/panels/overview/OverviewPanel.tsx +0 -398
- package/src/console/ui/shell/panels/plugins/PluginsPanel.tsx +0 -402
- package/src/console/ui/shell/panels/runs/RunsPanel.tsx +0 -652
- package/src/console/ui/shell/panels/signals/SignalsPanel.tsx +0 -788
- package/src/console/ui/shell/panels/store/StorePanel.tsx +0 -755
- package/src/console/ui/shell/panels/traces/TracesPanel.tsx +0 -478
- package/src/console/ui/shell/panels/vault/VaultPanel.tsx +0 -477
- package/src/console/ui/shell/plugin/Sandbox.tsx +0 -29
- package/src/console/ui/shell/public/favicon.svg +0 -7
- package/src/console/ui/shell/setup/Wizard.tsx +0 -211
- package/src/console/ui/shell/styles.css +0 -74
- package/src/console/ui/signals/SignalsA11yView.tsx +0 -252
- package/src/console/ui/signals/a11y.test.tsx +0 -96
- package/src/console/ui/signals/confirmation.test.ts +0 -35
- package/src/console/ui/signals/confirmation.ts +0 -59
- package/src/console/ui/signals/dry-run.test.ts +0 -18
- package/src/console/ui/signals/dry-run.ts +0 -34
- package/src/console/ui/signals/durable.test.ts +0 -22
- package/src/console/ui/signals/durable.ts +0 -39
- package/src/console/ui/signals/findings.ts +0 -31
- package/src/console/ui/signals/fixture.ts +0 -242
- package/src/console/ui/signals/group.test.ts +0 -26
- package/src/console/ui/signals/group.ts +0 -41
- package/src/console/ui/signals/index.ts +0 -49
- package/src/console/ui/signals/monitor.test.ts +0 -30
- package/src/console/ui/signals/monitor.ts +0 -74
- package/src/console/ui/signals/schema-form.test.ts +0 -23
- package/src/console/ui/signals/schema-form.ts +0 -109
- package/src/console/ui/signals/search.ts +0 -93
- package/src/console/ui/signals/types.ts +0 -72
- package/src/console/ui/store/StoreA11yView.tsx +0 -193
- package/src/console/ui/store/a11y.test.tsx +0 -96
- package/src/console/ui/store/cache-view.test.ts +0 -13
- package/src/console/ui/store/cache-view.ts +0 -36
- package/src/console/ui/store/confirmation.test.ts +0 -36
- package/src/console/ui/store/confirmation.ts +0 -52
- package/src/console/ui/store/dry-run.test.ts +0 -15
- package/src/console/ui/store/dry-run.ts +0 -26
- package/src/console/ui/store/fixture.ts +0 -167
- package/src/console/ui/store/group.test.ts +0 -16
- package/src/console/ui/store/group.ts +0 -38
- package/src/console/ui/store/index.ts +0 -36
- package/src/console/ui/store/search.ts +0 -74
- package/src/console/ui/store/types.ts +0 -67
- package/src/console/ui/store/will-not-fire.test.ts +0 -19
- package/src/console/ui/store/will-not-fire.ts +0 -39
- package/src/console/ui/traces/TracesA11yView.tsx +0 -181
- package/src/console/ui/traces/a11y.test.tsx +0 -96
- package/src/console/ui/traces/chain.test.ts +0 -47
- package/src/console/ui/traces/chain.ts +0 -142
- package/src/console/ui/traces/critical-path.test.ts +0 -22
- package/src/console/ui/traces/critical-path.ts +0 -55
- package/src/console/ui/traces/filter.test.ts +0 -74
- package/src/console/ui/traces/filter.ts +0 -104
- package/src/console/ui/traces/fixture.ts +0 -126
- package/src/console/ui/traces/fold.test.ts +0 -59
- package/src/console/ui/traces/fold.ts +0 -168
- package/src/console/ui/traces/index.ts +0 -64
- package/src/console/ui/traces/mini.ts +0 -63
- package/src/console/ui/traces/replay.test.ts +0 -22
- package/src/console/ui/traces/replay.ts +0 -33
- package/src/console/ui/traces/sampling.test.ts +0 -26
- package/src/console/ui/traces/sampling.ts +0 -63
- package/src/console/ui/traces/search.ts +0 -135
- package/src/console/ui/traces/tier.ts +0 -70
- package/src/console/ui/traces/types.ts +0 -125
- package/src/console/ui/tsconfig.json +0 -20
- package/src/console/ui/vault/VaultA11yView.tsx +0 -197
- package/src/console/ui/vault/a11y.test.tsx +0 -96
- package/src/console/ui/vault/backend.test.ts +0 -75
- package/src/console/ui/vault/backend.ts +0 -117
- package/src/console/ui/vault/blast-radius.ts +0 -53
- package/src/console/ui/vault/confirmation.test.ts +0 -37
- package/src/console/ui/vault/confirmation.ts +0 -36
- package/src/console/ui/vault/dormant.ts +0 -28
- package/src/console/ui/vault/export-safe.test.ts +0 -26
- package/src/console/ui/vault/export-safe.ts +0 -62
- package/src/console/ui/vault/fixture.ts +0 -94
- package/src/console/ui/vault/group.test.ts +0 -25
- package/src/console/ui/vault/group.ts +0 -49
- package/src/console/ui/vault/index.ts +0 -47
- package/src/console/ui/vault/search.ts +0 -58
- package/src/console/ui/vault/types.ts +0 -83
- package/src/console/ui/vite.config.ts +0 -84
- /package/src/console/{ui/vault → ui-next/src/features/vault/lib}/blast-radius.test.ts +0 -0
- /package/src/console/{ui/vault → ui-next/src/features/vault/lib}/dormant.test.ts +0 -0
|
@@ -0,0 +1,1844 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Store browse grid — beUI editable Table wired to the console store API.
|
|
3
|
+
*
|
|
4
|
+
* Inline cell edits stage locally (brown/tan) until Changes opens Pending Changes.
|
|
5
|
+
* Drag a cell range to multi-select; paste or type fills the range.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
useEffect,
|
|
10
|
+
useMemo,
|
|
11
|
+
useRef,
|
|
12
|
+
useState,
|
|
13
|
+
type ChangeEvent,
|
|
14
|
+
type ClipboardEvent,
|
|
15
|
+
type JSX,
|
|
16
|
+
type KeyboardEvent,
|
|
17
|
+
type ReactNode,
|
|
18
|
+
} from "react";
|
|
19
|
+
import {
|
|
20
|
+
Cancel01Icon,
|
|
21
|
+
Database01Icon,
|
|
22
|
+
Delete02Icon,
|
|
23
|
+
FileExportIcon,
|
|
24
|
+
FileImportIcon,
|
|
25
|
+
Key01Icon,
|
|
26
|
+
LeftToRightListBulletIcon,
|
|
27
|
+
LinkSquare02Icon,
|
|
28
|
+
PlusSignIcon,
|
|
29
|
+
PuzzleIcon,
|
|
30
|
+
Redo02Icon,
|
|
31
|
+
Search01Icon,
|
|
32
|
+
SecurityCheckIcon,
|
|
33
|
+
Tick02Icon,
|
|
34
|
+
Undo02Icon,
|
|
35
|
+
ViewIcon,
|
|
36
|
+
} from "@hugeicons/core-free-icons";
|
|
37
|
+
import { HugeiconsIcon } from "@hugeicons/react";
|
|
38
|
+
import { Switch } from "@/components/motion/switch.tsx";
|
|
39
|
+
import { Table, type SortState, type TableColumn } from "@/components/motion/table/index.tsx";
|
|
40
|
+
import { EditableCell } from "@/components/motion/table/editable-cell.tsx";
|
|
41
|
+
import { Badge } from "@/components/ui/badge";
|
|
42
|
+
import { Button } from "@/components/ui/button";
|
|
43
|
+
import {
|
|
44
|
+
DropdownMenu,
|
|
45
|
+
DropdownMenuCheckboxItem,
|
|
46
|
+
DropdownMenuContent,
|
|
47
|
+
DropdownMenuGroup,
|
|
48
|
+
DropdownMenuItem,
|
|
49
|
+
DropdownMenuLabel,
|
|
50
|
+
DropdownMenuRadioGroup,
|
|
51
|
+
DropdownMenuRadioItem,
|
|
52
|
+
DropdownMenuSeparator,
|
|
53
|
+
DropdownMenuTrigger,
|
|
54
|
+
} from "@/components/ui/dropdown-menu";
|
|
55
|
+
import { Input } from "@/components/ui/input";
|
|
56
|
+
import { Separator } from "@/components/ui/separator";
|
|
57
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
|
58
|
+
import { ShortcutKeys } from "@/lib/shortcut-keys.tsx";
|
|
59
|
+
import { modChord, modShiftChord } from "@/lib/shortcut.ts";
|
|
60
|
+
import { cn } from "@/lib/utils.ts";
|
|
61
|
+
import { useStoreEdit } from "../data/use-store-edit.ts";
|
|
62
|
+
import { JsonValueSheet } from "../detail/json-value-sheet.tsx";
|
|
63
|
+
import { RevealCell } from "../detail/reveal-cell.tsx";
|
|
64
|
+
import { asInspectableJson, jsonValueEqual } from "../lib/json-value.ts";
|
|
65
|
+
import { parseKvTtlDraft } from "../lib/kv-meta.ts";
|
|
66
|
+
import { KvAddSheet } from "./kv-add-sheet.tsx";
|
|
67
|
+
import { SqlInsertSheet } from "./sql-insert-sheet.tsx";
|
|
68
|
+
import { PendingChangesSheet } from "./pending-changes-sheet.tsx";
|
|
69
|
+
import { ToolbarTip } from "@/components/ui/toolbar-tip.tsx";
|
|
70
|
+
import {
|
|
71
|
+
EMPTY_EDIT_HISTORY,
|
|
72
|
+
invertEditBatch,
|
|
73
|
+
popRedo,
|
|
74
|
+
popUndo,
|
|
75
|
+
pushEditBatch,
|
|
76
|
+
type CellUpdate,
|
|
77
|
+
type EditHistory,
|
|
78
|
+
} from "../lib/edit-history.ts";
|
|
79
|
+
import {
|
|
80
|
+
formatGridCell,
|
|
81
|
+
formatStoreCell,
|
|
82
|
+
type StoreGridColumn,
|
|
83
|
+
type StoreGridModel,
|
|
84
|
+
type StoreGridRow,
|
|
85
|
+
} from "../lib/grid-model.ts";
|
|
86
|
+
import { kvValueSizeBytes } from "../lib/kv-meta.ts";
|
|
87
|
+
import { isStorePiiMask, parseStoreCellDraft, sanitizeStorePatch } from "../lib/patch.ts";
|
|
88
|
+
import {
|
|
89
|
+
fillHits,
|
|
90
|
+
pasteHits,
|
|
91
|
+
pendingKey,
|
|
92
|
+
pendingToUpdates,
|
|
93
|
+
popPending,
|
|
94
|
+
stagePending,
|
|
95
|
+
type PasteHit,
|
|
96
|
+
type PendingCell,
|
|
97
|
+
} from "../lib/pending-edits.ts";
|
|
98
|
+
import { isRtlText } from "../lib/rtl.ts";
|
|
99
|
+
import {
|
|
100
|
+
matrixToTsv,
|
|
101
|
+
rangeArea,
|
|
102
|
+
rangeBounds,
|
|
103
|
+
tsvToMatrix,
|
|
104
|
+
type CellRange,
|
|
105
|
+
} from "../lib/cell-selection.ts";
|
|
106
|
+
import { cellExportText, importHits, parseImportRecords, rowsToCsv } from "../lib/grid-transfer.ts";
|
|
107
|
+
|
|
108
|
+
/** Props for {@link StoreDataGrid}. */
|
|
109
|
+
export interface StoreDataGridProps {
|
|
110
|
+
readonly model: StoreGridModel;
|
|
111
|
+
readonly facet: "sql" | "kv" | "files" | "index";
|
|
112
|
+
readonly storeRef: string;
|
|
113
|
+
readonly childName: string;
|
|
114
|
+
readonly tenant?: string | null;
|
|
115
|
+
readonly masked?: boolean;
|
|
116
|
+
readonly routedRole?: "primary" | "replica";
|
|
117
|
+
/** Current browse limit (for honest find copy). */
|
|
118
|
+
readonly limit: number;
|
|
119
|
+
/** Toolbar controls rendered left of the find input (Refresh, Writers/Readers, …). */
|
|
120
|
+
readonly toolbarExtras?: ReactNode;
|
|
121
|
+
/**
|
|
122
|
+
* Server-side index query. When set, the toolbar find field queries the
|
|
123
|
+
* index (and shows topK) instead of filtering this page.
|
|
124
|
+
*/
|
|
125
|
+
readonly indexSearch?: {
|
|
126
|
+
readonly value: string;
|
|
127
|
+
readonly onChange: (value: string) => void;
|
|
128
|
+
readonly topK: number;
|
|
129
|
+
readonly onTopKChange: (topK: number) => void;
|
|
130
|
+
};
|
|
131
|
+
/** Controlled SQL insert sheet (button lives in {@link toolbarExtras}). */
|
|
132
|
+
readonly insertOpen?: boolean;
|
|
133
|
+
readonly onInsertOpenChange?: (open: boolean) => void;
|
|
134
|
+
readonly onDeleteRows?: (rows: readonly StoreGridRow[]) => void;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** Row height presets (px) for the height menu. */
|
|
138
|
+
const ROW_HEIGHTS = { short: 26, medium: 34, tall: 44, "extra-tall": 56 } as const;
|
|
139
|
+
type RowHeight = keyof typeof ROW_HEIGHTS;
|
|
140
|
+
|
|
141
|
+
/** Fixed column width (px) by cell variant. */
|
|
142
|
+
function columnWidthPx(type: StoreGridColumn["type"], key: string): number {
|
|
143
|
+
if (key === "id" || key === "key" || key === "name") return 192;
|
|
144
|
+
if (key === "title") return 300;
|
|
145
|
+
if (key === "version") return 72;
|
|
146
|
+
if (key === "ttl") return 88;
|
|
147
|
+
if (key === "size") return 80;
|
|
148
|
+
if (key === "enabled") return 88;
|
|
149
|
+
if (key === "source") return 112;
|
|
150
|
+
switch (type) {
|
|
151
|
+
case "boolean":
|
|
152
|
+
return 88;
|
|
153
|
+
case "integer":
|
|
154
|
+
case "number":
|
|
155
|
+
return 112;
|
|
156
|
+
case "json":
|
|
157
|
+
return 288;
|
|
158
|
+
default:
|
|
159
|
+
return 224;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** Tiny muted type glyph for the header (quiet alternative to pills). */
|
|
164
|
+
function typeGlyph(type: StoreGridColumn["type"]): string {
|
|
165
|
+
switch (type) {
|
|
166
|
+
case "integer":
|
|
167
|
+
case "number":
|
|
168
|
+
return "123";
|
|
169
|
+
case "json":
|
|
170
|
+
return "{ }";
|
|
171
|
+
case "boolean":
|
|
172
|
+
return "01";
|
|
173
|
+
default:
|
|
174
|
+
return "abc";
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function isNumericType(type: StoreGridColumn["type"]): boolean {
|
|
179
|
+
return type === "integer" || type === "number";
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function parseGridDraft(
|
|
183
|
+
col: StoreGridColumn,
|
|
184
|
+
text: string,
|
|
185
|
+
): { readonly ok: true; readonly next: unknown } | { readonly ok: false } {
|
|
186
|
+
if (col.format === "ttl") {
|
|
187
|
+
const parsed = parseKvTtlDraft(text);
|
|
188
|
+
if (parsed === undefined) return { ok: false };
|
|
189
|
+
return { ok: true, next: parsed };
|
|
190
|
+
}
|
|
191
|
+
return { ok: true, next: text.trim() === "" ? null : parseStoreCellDraft(col.type, text) };
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/** Serialize a raw cell value into the inline editor's draft text. */
|
|
195
|
+
function cellDraftText(col: StoreGridColumn, raw: unknown): string {
|
|
196
|
+
if (col.format === "ttl") return "";
|
|
197
|
+
if (raw === null || raw === undefined) return "";
|
|
198
|
+
if (col.type === "json") {
|
|
199
|
+
try {
|
|
200
|
+
return JSON.stringify(raw);
|
|
201
|
+
} catch {
|
|
202
|
+
return "";
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
if (typeof raw === "string" || typeof raw === "number" || typeof raw === "boolean") {
|
|
206
|
+
return String(raw);
|
|
207
|
+
}
|
|
208
|
+
try {
|
|
209
|
+
return JSON.stringify(raw);
|
|
210
|
+
} catch {
|
|
211
|
+
return "";
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Virtualized editable table for Store browse results.
|
|
217
|
+
*
|
|
218
|
+
* @param props - Normalized model + facet + callbacks
|
|
219
|
+
*/
|
|
220
|
+
export function StoreDataGrid({
|
|
221
|
+
model,
|
|
222
|
+
facet,
|
|
223
|
+
storeRef,
|
|
224
|
+
childName,
|
|
225
|
+
tenant,
|
|
226
|
+
masked = false,
|
|
227
|
+
routedRole,
|
|
228
|
+
limit,
|
|
229
|
+
toolbarExtras,
|
|
230
|
+
indexSearch,
|
|
231
|
+
insertOpen = false,
|
|
232
|
+
onInsertOpenChange,
|
|
233
|
+
onDeleteRows,
|
|
234
|
+
}: StoreDataGridProps): JSX.Element {
|
|
235
|
+
const [findText, setFindText] = useState("");
|
|
236
|
+
const [selected, setSelected] = useState<readonly string[]>([]);
|
|
237
|
+
const [hiddenCols, setHiddenCols] = useState<ReadonlySet<string>>(new Set());
|
|
238
|
+
const [rowHeight, setRowHeight] = useState<RowHeight>("medium");
|
|
239
|
+
const [sort, setSort] = useState<SortState | null>(null);
|
|
240
|
+
const [editError, setEditError] = useState<string | null>(null);
|
|
241
|
+
const [notice, setNotice] = useState<string | null>(null);
|
|
242
|
+
const [history, setHistory] = useState<EditHistory>(EMPTY_EDIT_HISTORY);
|
|
243
|
+
const [pending, setPending] = useState<ReadonlyMap<string, PendingCell>>(new Map());
|
|
244
|
+
const [lastFocus, setLastFocus] = useState<{ rowId: string; key: string } | null>(null);
|
|
245
|
+
const [cellRange, setCellRange] = useState<CellRange | null>(null);
|
|
246
|
+
const [editingCell, setEditingCell] = useState<{ rowId: string; key: string } | null>(null);
|
|
247
|
+
const [editSeed, setEditSeed] = useState<string | null>(null);
|
|
248
|
+
const [changesOpen, setChangesOpen] = useState(false);
|
|
249
|
+
const [inspect, setInspect] = useState<{
|
|
250
|
+
readonly rowId: string;
|
|
251
|
+
readonly column: string;
|
|
252
|
+
} | null>(null);
|
|
253
|
+
const [addOpen, setAddOpen] = useState(false);
|
|
254
|
+
const [saving, setSaving] = useState(false);
|
|
255
|
+
const [viewportHeight, setViewportHeight] = useState(440);
|
|
256
|
+
const viewportRef = useRef<HTMLDivElement>(null);
|
|
257
|
+
const findRef = useRef<HTMLInputElement>(null);
|
|
258
|
+
const importRef = useRef<HTMLInputElement>(null);
|
|
259
|
+
const pendingRef = useRef(pending);
|
|
260
|
+
const pendingLogRef = useRef<readonly string[]>([]);
|
|
261
|
+
pendingRef.current = pending;
|
|
262
|
+
const edit = useStoreEdit();
|
|
263
|
+
|
|
264
|
+
const hasSelect = onDeleteRows !== undefined;
|
|
265
|
+
const canInlineEdit = model.editable && (facet === "sql" || facet === "kv");
|
|
266
|
+
const rowHeightPx = ROW_HEIGHTS[rowHeight];
|
|
267
|
+
|
|
268
|
+
const visibleColumns = useMemo(
|
|
269
|
+
() => model.columns.filter((c) => !hiddenCols.has(c.key)),
|
|
270
|
+
[model.columns, hiddenCols],
|
|
271
|
+
);
|
|
272
|
+
|
|
273
|
+
const overlayValue = (row: StoreGridRow, key: string): unknown => {
|
|
274
|
+
if (facet === "kv" && key === "size") {
|
|
275
|
+
const val = pending.get(pendingKey(row.id, "value"))?.next ?? row.cells.value;
|
|
276
|
+
return kvValueSizeBytes(val);
|
|
277
|
+
}
|
|
278
|
+
return pending.get(pendingKey(row.id, key))?.next ?? row.cells[key];
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
const indexMode = indexSearch !== undefined;
|
|
282
|
+
const findValue = indexMode ? indexSearch.value : findText;
|
|
283
|
+
|
|
284
|
+
const filteredRows = useMemo(() => {
|
|
285
|
+
if (indexMode || !findText.trim()) return model.rows;
|
|
286
|
+
const q = findText.trim().toLowerCase();
|
|
287
|
+
return model.rows.filter((row) =>
|
|
288
|
+
model.columns.some((col) => {
|
|
289
|
+
const text = formatStoreCell(col, overlayValue(row, col.key)).toLowerCase();
|
|
290
|
+
if (text.includes(q)) return true;
|
|
291
|
+
if (col.format !== "name-key") return false;
|
|
292
|
+
const key = row.cells.name;
|
|
293
|
+
const version = row.cells.version;
|
|
294
|
+
return (
|
|
295
|
+
(typeof key === "string" && key.toLowerCase().includes(q)) ||
|
|
296
|
+
(version != null && String(version).toLowerCase().includes(q))
|
|
297
|
+
);
|
|
298
|
+
}),
|
|
299
|
+
);
|
|
300
|
+
}, [model.rows, model.columns, findText, pending, indexMode]);
|
|
301
|
+
|
|
302
|
+
const viewRows = useMemo(() => {
|
|
303
|
+
if (!sort) return filteredRows;
|
|
304
|
+
const column =
|
|
305
|
+
visibleColumns.find((c) => c.key === sort.key) ??
|
|
306
|
+
model.columns.find((c) => c.key === sort.key);
|
|
307
|
+
if (!column) return filteredRows;
|
|
308
|
+
const copy = [...filteredRows];
|
|
309
|
+
copy.sort((a, b) => {
|
|
310
|
+
const av = overlayValue(a, column.key);
|
|
311
|
+
const bv = overlayValue(b, column.key);
|
|
312
|
+
const cmp =
|
|
313
|
+
typeof av === "number" && typeof bv === "number"
|
|
314
|
+
? av - bv
|
|
315
|
+
: formatGridCell(av).localeCompare(formatGridCell(bv));
|
|
316
|
+
return sort.direction === "asc" ? cmp : -cmp;
|
|
317
|
+
});
|
|
318
|
+
return copy;
|
|
319
|
+
}, [filteredRows, sort, pending, visibleColumns, model.columns]);
|
|
320
|
+
|
|
321
|
+
useEffect(() => {
|
|
322
|
+
setSelected([]);
|
|
323
|
+
setHiddenCols(new Set());
|
|
324
|
+
setEditError(null);
|
|
325
|
+
setHistory(EMPTY_EDIT_HISTORY);
|
|
326
|
+
setPending(new Map());
|
|
327
|
+
pendingLogRef.current = [];
|
|
328
|
+
setLastFocus(null);
|
|
329
|
+
setCellRange(null);
|
|
330
|
+
setEditingCell(null);
|
|
331
|
+
setEditSeed(null);
|
|
332
|
+
setChangesOpen(false);
|
|
333
|
+
setInspect(null);
|
|
334
|
+
setAddOpen(false);
|
|
335
|
+
setSort(null);
|
|
336
|
+
setFindText("");
|
|
337
|
+
}, [facet, storeRef, childName, tenant]);
|
|
338
|
+
|
|
339
|
+
useEffect(() => {
|
|
340
|
+
if (!notice) return;
|
|
341
|
+
const t = setTimeout(() => setNotice(null), 2000);
|
|
342
|
+
return () => clearTimeout(t);
|
|
343
|
+
}, [notice]);
|
|
344
|
+
|
|
345
|
+
useEffect(() => {
|
|
346
|
+
const el = viewportRef.current;
|
|
347
|
+
if (!el) return;
|
|
348
|
+
const ro = new ResizeObserver((entries) => {
|
|
349
|
+
const h = entries[0]?.contentRect.height;
|
|
350
|
+
if (h) setViewportHeight(Math.max(120, Math.round(h)));
|
|
351
|
+
});
|
|
352
|
+
ro.observe(el);
|
|
353
|
+
return () => ro.disconnect();
|
|
354
|
+
}, []);
|
|
355
|
+
|
|
356
|
+
const selectedRows = useMemo(
|
|
357
|
+
() => model.rows.filter((r) => selected.includes(r.id)),
|
|
358
|
+
[model.rows, selected],
|
|
359
|
+
);
|
|
360
|
+
|
|
361
|
+
const isCellEditable = (col: StoreGridColumn, raw: unknown): boolean =>
|
|
362
|
+
canInlineEdit && col.editable && !(col.pii && masked && isStorePiiMask(raw));
|
|
363
|
+
|
|
364
|
+
const writePending = (
|
|
365
|
+
nextPending: ReadonlyMap<string, PendingCell>,
|
|
366
|
+
nextLog: readonly string[],
|
|
367
|
+
) => {
|
|
368
|
+
pendingRef.current = nextPending;
|
|
369
|
+
pendingLogRef.current = nextLog;
|
|
370
|
+
setPending(nextPending);
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
const writableCell = (rowId: string, key: string): boolean => {
|
|
374
|
+
const row = model.rows.find((r) => r.id === rowId);
|
|
375
|
+
const col = model.columns.find((c) => c.key === key);
|
|
376
|
+
if (!row || !col) return false;
|
|
377
|
+
return isCellEditable(col, row.cells[key]);
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
const applyHits = (hits: readonly PasteHit[]): number => {
|
|
381
|
+
if (hits.length === 0) return 0;
|
|
382
|
+
let nextPending = pendingRef.current;
|
|
383
|
+
let nextLog = pendingLogRef.current;
|
|
384
|
+
for (const hit of hits) {
|
|
385
|
+
const row = model.rows.find((r) => r.id === hit.rowId);
|
|
386
|
+
const col = model.columns.find((c) => c.key === hit.key);
|
|
387
|
+
if (!row || !col) continue;
|
|
388
|
+
const raw = row.cells[col.key];
|
|
389
|
+
const parsed = parseGridDraft(col, hit.text);
|
|
390
|
+
if (!parsed.ok) continue;
|
|
391
|
+
const next = parsed.next;
|
|
392
|
+
const staged = stagePending(nextPending, nextLog, {
|
|
393
|
+
rowId: row.id,
|
|
394
|
+
key: col.key,
|
|
395
|
+
prev: raw,
|
|
396
|
+
next,
|
|
397
|
+
});
|
|
398
|
+
nextPending = staged.pending;
|
|
399
|
+
nextLog = staged.log;
|
|
400
|
+
}
|
|
401
|
+
writePending(nextPending, nextLog);
|
|
402
|
+
return hits.length;
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
const exportRows = (format: "csv" | "json") => {
|
|
406
|
+
const rows =
|
|
407
|
+
selected.length > 0 ? viewRows.filter((row) => selected.includes(row.id)) : viewRows;
|
|
408
|
+
const keys = visibleColumns.map((col) => col.key);
|
|
409
|
+
if (rows.length === 0 || keys.length === 0) return;
|
|
410
|
+
const stamp = selected.length > 0 ? "selection" : "page";
|
|
411
|
+
const safeName = childName.replace(/[^\w.-]+/g, "_");
|
|
412
|
+
if (format === "csv") {
|
|
413
|
+
const body = rows.map((row) => keys.map((key) => cellExportText(overlayValue(row, key))));
|
|
414
|
+
downloadText(
|
|
415
|
+
`${safeName}-${stamp}.csv`,
|
|
416
|
+
`\uFEFF${rowsToCsv(keys, body)}`,
|
|
417
|
+
"text/csv;charset=utf-8",
|
|
418
|
+
);
|
|
419
|
+
} else {
|
|
420
|
+
const records = rows.map((row) => {
|
|
421
|
+
const rec: Record<string, unknown> = {};
|
|
422
|
+
for (const key of keys) rec[key] = overlayValue(row, key) ?? null;
|
|
423
|
+
return rec;
|
|
424
|
+
});
|
|
425
|
+
downloadText(
|
|
426
|
+
`${safeName}-${stamp}.json`,
|
|
427
|
+
`${JSON.stringify(records, null, 2)}\n`,
|
|
428
|
+
"application/json",
|
|
429
|
+
);
|
|
430
|
+
}
|
|
431
|
+
setNotice(`Exported ${rows.length} row(s)`);
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
const onImportFile = (event: ChangeEvent<HTMLInputElement>) => {
|
|
435
|
+
const file = event.target.files?.[0];
|
|
436
|
+
event.target.value = "";
|
|
437
|
+
if (!file || !canInlineEdit) return;
|
|
438
|
+
void file.text().then((text) => {
|
|
439
|
+
try {
|
|
440
|
+
const records = parseImportRecords(text);
|
|
441
|
+
if (records.length === 0) {
|
|
442
|
+
setNotice("No rows in import file");
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
const { hits, unmatched } = importHits({
|
|
446
|
+
records,
|
|
447
|
+
rowIds: new Set(model.rows.map((row) => row.id)),
|
|
448
|
+
writable: writableCell,
|
|
449
|
+
});
|
|
450
|
+
if (hits.length === 0) {
|
|
451
|
+
setEditError(
|
|
452
|
+
unmatched === records.length
|
|
453
|
+
? "No matching rows — import needs an id or key that exists on this page"
|
|
454
|
+
: "Nothing writable to import",
|
|
455
|
+
);
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
const n = applyHits(hits);
|
|
459
|
+
setEditError(null);
|
|
460
|
+
setNotice(
|
|
461
|
+
unmatched > 0
|
|
462
|
+
? `Imported ${n} cell(s) · ${unmatched} row(s) unmatched`
|
|
463
|
+
: `Imported ${n} cell(s)`,
|
|
464
|
+
);
|
|
465
|
+
} catch (err) {
|
|
466
|
+
setEditError(err instanceof Error ? err.message : "Could not parse import file");
|
|
467
|
+
}
|
|
468
|
+
});
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
const stageCell = (row: StoreGridRow, col: StoreGridColumn, text: string) => {
|
|
472
|
+
const raw = row.cells[col.key];
|
|
473
|
+
if (!isCellEditable(col, raw)) return;
|
|
474
|
+
const parsed = parseGridDraft(col, text);
|
|
475
|
+
if (!parsed.ok) {
|
|
476
|
+
setEditError("TTL must be a duration like 30m, 1h, or empty to clear");
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
setEditError(null);
|
|
480
|
+
const next = parsed.next;
|
|
481
|
+
const staged = stagePending(pendingRef.current, pendingLogRef.current, {
|
|
482
|
+
rowId: row.id,
|
|
483
|
+
key: col.key,
|
|
484
|
+
prev: raw,
|
|
485
|
+
next,
|
|
486
|
+
});
|
|
487
|
+
writePending(staged.pending, staged.log);
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
const stageRawCell = (rowId: string, key: string, next: unknown) => {
|
|
491
|
+
const row = model.rows.find((r) => r.id === rowId);
|
|
492
|
+
const col = model.columns.find((c) => c.key === key);
|
|
493
|
+
if (!row || !col) return;
|
|
494
|
+
const raw = row.cells[col.key];
|
|
495
|
+
if (!isCellEditable(col, raw)) return;
|
|
496
|
+
const staged = stagePending(pendingRef.current, pendingLogRef.current, {
|
|
497
|
+
rowId: row.id,
|
|
498
|
+
key: col.key,
|
|
499
|
+
prev: raw,
|
|
500
|
+
next: jsonValueEqual(raw, next) ? raw : next,
|
|
501
|
+
});
|
|
502
|
+
writePending(staged.pending, staged.log);
|
|
503
|
+
};
|
|
504
|
+
|
|
505
|
+
const undoPendingCell = (rowId: string, key: string) => {
|
|
506
|
+
const k = pendingKey(rowId, key);
|
|
507
|
+
const next = new Map(pendingRef.current);
|
|
508
|
+
next.delete(k);
|
|
509
|
+
writePending(
|
|
510
|
+
next,
|
|
511
|
+
pendingLogRef.current.filter((entry) => entry !== k),
|
|
512
|
+
);
|
|
513
|
+
};
|
|
514
|
+
|
|
515
|
+
const commitBatch = async (
|
|
516
|
+
updates: readonly CellUpdate[],
|
|
517
|
+
opts?: { track?: boolean; notice?: string },
|
|
518
|
+
): Promise<boolean> => {
|
|
519
|
+
if (updates.length === 0) return true;
|
|
520
|
+
const byRow = new Map<string, Record<string, unknown>>();
|
|
521
|
+
for (const u of updates) {
|
|
522
|
+
const patch = byRow.get(u.rowId) ?? {};
|
|
523
|
+
patch[u.key] = u.next;
|
|
524
|
+
byRow.set(u.rowId, patch);
|
|
525
|
+
}
|
|
526
|
+
setSaving(true);
|
|
527
|
+
setEditError(null);
|
|
528
|
+
let ok = true;
|
|
529
|
+
try {
|
|
530
|
+
await Promise.all(
|
|
531
|
+
[...byRow.entries()].map(([rowId, patch]) =>
|
|
532
|
+
edit.mutateAsync({
|
|
533
|
+
ref: storeRef,
|
|
534
|
+
...(facet === "sql" ? { child: childName, id: rowId } : { key: rowId }),
|
|
535
|
+
...(tenant ? { tenant } : {}),
|
|
536
|
+
patch: sanitizeStorePatch(patch),
|
|
537
|
+
commit: true,
|
|
538
|
+
}),
|
|
539
|
+
),
|
|
540
|
+
);
|
|
541
|
+
if (opts?.track !== false) {
|
|
542
|
+
setHistory((h) => pushEditBatch(h, { updates, at: Date.now() }));
|
|
543
|
+
}
|
|
544
|
+
if (opts?.notice) setNotice(opts.notice);
|
|
545
|
+
} catch (error) {
|
|
546
|
+
ok = false;
|
|
547
|
+
setEditError(error instanceof Error ? error.message : String(error));
|
|
548
|
+
} finally {
|
|
549
|
+
setSaving(false);
|
|
550
|
+
}
|
|
551
|
+
return ok;
|
|
552
|
+
};
|
|
553
|
+
|
|
554
|
+
const onUndo = () => {
|
|
555
|
+
if (saving) return;
|
|
556
|
+
if (pendingRef.current.size > 0) {
|
|
557
|
+
const popped = popPending(pendingRef.current, pendingLogRef.current);
|
|
558
|
+
writePending(popped.pending, popped.log);
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
const { history: next, batch } = popUndo(history);
|
|
562
|
+
if (!batch) return;
|
|
563
|
+
setHistory(next);
|
|
564
|
+
void commitBatch(invertEditBatch(batch).updates, {
|
|
565
|
+
track: false,
|
|
566
|
+
notice: `Undid ${batch.updates.length} cell(s)`,
|
|
567
|
+
});
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
const onRedo = () => {
|
|
571
|
+
if (saving || pending.size > 0) return;
|
|
572
|
+
const { history: next, batch } = popRedo(history);
|
|
573
|
+
if (!batch) return;
|
|
574
|
+
setHistory(next);
|
|
575
|
+
void commitBatch(batch.updates, {
|
|
576
|
+
track: false,
|
|
577
|
+
notice: `Redid ${batch.updates.length} cell(s)`,
|
|
578
|
+
});
|
|
579
|
+
};
|
|
580
|
+
|
|
581
|
+
const startEdit = (rowId: string, key: string, seed?: string) => {
|
|
582
|
+
if (saving) return;
|
|
583
|
+
const row = model.rows.find((r) => r.id === rowId);
|
|
584
|
+
const col = model.columns.find((c) => c.key === key);
|
|
585
|
+
if (!row || !col || !isCellEditable(col, row.cells[key])) return;
|
|
586
|
+
setLastFocus({ rowId, key });
|
|
587
|
+
setEditSeed(seed === undefined ? null : seed);
|
|
588
|
+
setEditingCell({ rowId, key });
|
|
589
|
+
};
|
|
590
|
+
|
|
591
|
+
const onCellEdit = (rowId: string, columnKey: string, value: string) => {
|
|
592
|
+
if (saving) return;
|
|
593
|
+
const row = model.rows.find((r) => r.id === rowId);
|
|
594
|
+
const col = model.columns.find((c) => c.key === columnKey);
|
|
595
|
+
if (!row || !col) return;
|
|
596
|
+
if (col.type === "boolean") {
|
|
597
|
+
const parsed = parseGridDraft(col, value);
|
|
598
|
+
if (!parsed.ok) return;
|
|
599
|
+
void commitBatch([{ rowId, key: columnKey, prev: row.cells[columnKey], next: parsed.next }], {
|
|
600
|
+
notice: parsed.next === true ? `Enabled ${rowId}` : `Disabled ${rowId}`,
|
|
601
|
+
});
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
604
|
+
if (cellRange && rangeArea(cellRange) > 1) {
|
|
605
|
+
applyHits(
|
|
606
|
+
fillHits({
|
|
607
|
+
range: cellRange,
|
|
608
|
+
rowIds: viewRows.map((r) => r.id),
|
|
609
|
+
columnKeys: visibleColumns.map((c) => c.key),
|
|
610
|
+
text: value,
|
|
611
|
+
writable: writableCell,
|
|
612
|
+
}),
|
|
613
|
+
);
|
|
614
|
+
return;
|
|
615
|
+
}
|
|
616
|
+
stageCell(row, col, value);
|
|
617
|
+
};
|
|
618
|
+
|
|
619
|
+
const openChanges = () => {
|
|
620
|
+
if (pendingRef.current.size === 0) return;
|
|
621
|
+
setChangesOpen(true);
|
|
622
|
+
};
|
|
623
|
+
|
|
624
|
+
const applyPending = () => {
|
|
625
|
+
if (saving || pendingRef.current.size === 0) return;
|
|
626
|
+
const updates = pendingToUpdates(pendingRef.current);
|
|
627
|
+
void commitBatch(updates, { notice: `Applied ${updates.length} change(s)` }).then((ok) => {
|
|
628
|
+
if (ok) {
|
|
629
|
+
writePending(new Map(), []);
|
|
630
|
+
setChangesOpen(false);
|
|
631
|
+
}
|
|
632
|
+
});
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
const discardPending = () => {
|
|
636
|
+
if (saving) return;
|
|
637
|
+
writePending(new Map(), []);
|
|
638
|
+
setChangesOpen(false);
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
useEffect(() => {
|
|
642
|
+
if (!changesOpen) return;
|
|
643
|
+
const onKey = (event: globalThis.KeyboardEvent) => {
|
|
644
|
+
if (!(event.metaKey || event.ctrlKey) || event.key.toLowerCase() !== "s") return;
|
|
645
|
+
event.preventDefault();
|
|
646
|
+
applyPending();
|
|
647
|
+
};
|
|
648
|
+
window.addEventListener("keydown", onKey);
|
|
649
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
650
|
+
}, [changesOpen]);
|
|
651
|
+
|
|
652
|
+
const pasteTargetRows = (): StoreGridRow[] => {
|
|
653
|
+
if (selected.length > 1) {
|
|
654
|
+
return viewRows.filter((r) => selected.includes(r.id));
|
|
655
|
+
}
|
|
656
|
+
const startId = lastFocus?.rowId ?? selected[0] ?? viewRows[0]?.id;
|
|
657
|
+
if (!startId) return [];
|
|
658
|
+
const start = viewRows.findIndex((r) => r.id === startId);
|
|
659
|
+
if (start < 0) return [];
|
|
660
|
+
return viewRows.slice(start);
|
|
661
|
+
};
|
|
662
|
+
|
|
663
|
+
const applyPasteMatrix = (matrix: string[][]) => {
|
|
664
|
+
if (!canInlineEdit || saving || matrix.length === 0) return;
|
|
665
|
+
const columnKeys = visibleColumns.map((c) => c.key);
|
|
666
|
+
let hits: PasteHit[] = [];
|
|
667
|
+
if (cellRange) {
|
|
668
|
+
const b = rangeBounds(cellRange);
|
|
669
|
+
const rowIds: string[] = [];
|
|
670
|
+
for (let r = b.minRow; r <= b.maxRow; r++) {
|
|
671
|
+
const row = viewRows[r];
|
|
672
|
+
if (row) rowIds.push(row.id);
|
|
673
|
+
}
|
|
674
|
+
hits = pasteHits({
|
|
675
|
+
matrix,
|
|
676
|
+
rowIds,
|
|
677
|
+
columnKeys,
|
|
678
|
+
startCol: b.minCol,
|
|
679
|
+
writable: writableCell,
|
|
680
|
+
});
|
|
681
|
+
} else {
|
|
682
|
+
const targets = pasteTargetRows();
|
|
683
|
+
if (targets.length === 0) return;
|
|
684
|
+
const startKey = lastFocus?.key;
|
|
685
|
+
const startCol = Math.max(
|
|
686
|
+
0,
|
|
687
|
+
startKey ? visibleColumns.findIndex((c) => c.key === startKey) : 0,
|
|
688
|
+
);
|
|
689
|
+
const rowIds =
|
|
690
|
+
selected.length > 1
|
|
691
|
+
? targets.map((r) => r.id)
|
|
692
|
+
: targets.slice(0, matrix.length).map((r) => r.id);
|
|
693
|
+
hits = pasteHits({
|
|
694
|
+
matrix,
|
|
695
|
+
rowIds,
|
|
696
|
+
columnKeys,
|
|
697
|
+
startCol,
|
|
698
|
+
writable: writableCell,
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
const n = applyHits(hits);
|
|
702
|
+
if (n > 0) setNotice(`Pasted ${n} cell(s)`);
|
|
703
|
+
};
|
|
704
|
+
|
|
705
|
+
const copySelection = async () => {
|
|
706
|
+
const matrix: string[][] = [];
|
|
707
|
+
if (cellRange) {
|
|
708
|
+
const b = rangeBounds(cellRange);
|
|
709
|
+
for (let r = b.minRow; r <= b.maxRow; r++) {
|
|
710
|
+
const row = viewRows[r];
|
|
711
|
+
if (!row) continue;
|
|
712
|
+
const line: string[] = [];
|
|
713
|
+
for (let c = b.minCol; c <= b.maxCol; c++) {
|
|
714
|
+
const col = visibleColumns[c];
|
|
715
|
+
line.push(col ? formatGridCell(overlayValue(row, col.key)) : "");
|
|
716
|
+
}
|
|
717
|
+
matrix.push(line);
|
|
718
|
+
}
|
|
719
|
+
} else {
|
|
720
|
+
const rows = selected.length > 0 ? viewRows.filter((r) => selected.includes(r.id)) : [];
|
|
721
|
+
if (rows.length > 0) {
|
|
722
|
+
for (const row of rows) {
|
|
723
|
+
matrix.push(visibleColumns.map((col) => formatGridCell(overlayValue(row, col.key))));
|
|
724
|
+
}
|
|
725
|
+
} else if (lastFocus) {
|
|
726
|
+
const row = model.rows.find((r) => r.id === lastFocus.rowId);
|
|
727
|
+
if (row) matrix.push([formatGridCell(overlayValue(row, lastFocus.key))]);
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
if (matrix.length === 0) return;
|
|
731
|
+
try {
|
|
732
|
+
await navigator.clipboard.writeText(matrixToTsv(matrix));
|
|
733
|
+
setNotice(`Copied ${matrix.length} row(s)`);
|
|
734
|
+
} catch {
|
|
735
|
+
setEditError("Clipboard write blocked — allow clipboard access in the browser prompt.");
|
|
736
|
+
}
|
|
737
|
+
};
|
|
738
|
+
|
|
739
|
+
const isFindInput = (target: EventTarget | null): boolean =>
|
|
740
|
+
target instanceof Node &&
|
|
741
|
+
(findRef.current === target || findRef.current?.contains(target) === true);
|
|
742
|
+
|
|
743
|
+
const isToolbarField = (target: EventTarget | null): boolean =>
|
|
744
|
+
target instanceof HTMLInputElement ||
|
|
745
|
+
target instanceof HTMLTextAreaElement ||
|
|
746
|
+
target instanceof HTMLSelectElement;
|
|
747
|
+
|
|
748
|
+
const nativeTextSelected = (target: EventTarget | null): boolean => {
|
|
749
|
+
if (!(target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement))
|
|
750
|
+
return false;
|
|
751
|
+
return target.selectionStart !== target.selectionEnd;
|
|
752
|
+
};
|
|
753
|
+
|
|
754
|
+
const tableColumns = useMemo<TableColumn<StoreGridRow>[]>(
|
|
755
|
+
() =>
|
|
756
|
+
visibleColumns.map((col) => ({
|
|
757
|
+
key: col.key,
|
|
758
|
+
header: <StoreColumnHeader col={col} />,
|
|
759
|
+
sortable: true,
|
|
760
|
+
align: isNumericType(col.type) ? "right" : "left",
|
|
761
|
+
width: col.key === "comment" ? undefined : `${columnWidthPx(col.type, col.key)}px`,
|
|
762
|
+
fill: col.key === "comment",
|
|
763
|
+
sortValue: (row) => {
|
|
764
|
+
const raw = overlayValue(row, col.key);
|
|
765
|
+
if (typeof raw === "number") return raw;
|
|
766
|
+
return formatGridCell(raw);
|
|
767
|
+
},
|
|
768
|
+
cell: (row) => {
|
|
769
|
+
const staged = pending.get(pendingKey(row.id, col.key));
|
|
770
|
+
const display = staged ? staged.next : row.cells[col.key];
|
|
771
|
+
return (
|
|
772
|
+
<StoreGridBodyCell
|
|
773
|
+
row={row}
|
|
774
|
+
col={col}
|
|
775
|
+
storeRef={storeRef}
|
|
776
|
+
childName={childName}
|
|
777
|
+
tenant={tenant}
|
|
778
|
+
masked={masked}
|
|
779
|
+
editable={
|
|
780
|
+
canInlineEdit &&
|
|
781
|
+
col.editable &&
|
|
782
|
+
!(col.pii && masked && isStorePiiMask(row.cells[col.key]))
|
|
783
|
+
}
|
|
784
|
+
saving={saving}
|
|
785
|
+
dirty={staged !== undefined}
|
|
786
|
+
editing={editingCell?.rowId === row.id && editingCell.key === col.key}
|
|
787
|
+
draftSeed={
|
|
788
|
+
editingCell?.rowId === row.id && editingCell.key === col.key ? editSeed : null
|
|
789
|
+
}
|
|
790
|
+
displayValue={display}
|
|
791
|
+
onFocus={() => setLastFocus({ rowId: row.id, key: col.key })}
|
|
792
|
+
onStartEdit={() => startEdit(row.id, col.key)}
|
|
793
|
+
onEditEnd={() => {
|
|
794
|
+
setEditingCell(null);
|
|
795
|
+
setEditSeed(null);
|
|
796
|
+
}}
|
|
797
|
+
onCommit={(next) => onCellEdit(row.id, col.key, next)}
|
|
798
|
+
onInspect={() => setInspect({ rowId: row.id, column: col.key })}
|
|
799
|
+
onUpgrade={
|
|
800
|
+
row.cells.upgrade === true
|
|
801
|
+
? () => {
|
|
802
|
+
void commitBatch(
|
|
803
|
+
[{ rowId: row.id, key: "upgrade", prev: row.cells.upgrade, next: true }],
|
|
804
|
+
{
|
|
805
|
+
notice: `Upgraded ${row.id}`,
|
|
806
|
+
track: false,
|
|
807
|
+
},
|
|
808
|
+
);
|
|
809
|
+
}
|
|
810
|
+
: undefined
|
|
811
|
+
}
|
|
812
|
+
/>
|
|
813
|
+
);
|
|
814
|
+
},
|
|
815
|
+
})),
|
|
816
|
+
[
|
|
817
|
+
visibleColumns,
|
|
818
|
+
storeRef,
|
|
819
|
+
childName,
|
|
820
|
+
tenant,
|
|
821
|
+
masked,
|
|
822
|
+
saving,
|
|
823
|
+
canInlineEdit,
|
|
824
|
+
pending,
|
|
825
|
+
editingCell,
|
|
826
|
+
editSeed,
|
|
827
|
+
commitBatch,
|
|
828
|
+
],
|
|
829
|
+
);
|
|
830
|
+
|
|
831
|
+
const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {
|
|
832
|
+
const meta = event.ctrlKey || event.metaKey;
|
|
833
|
+
if (meta && event.key.toLowerCase() === "f") {
|
|
834
|
+
event.preventDefault();
|
|
835
|
+
findRef.current?.focus();
|
|
836
|
+
return;
|
|
837
|
+
}
|
|
838
|
+
if (isFindInput(event.target) || isToolbarField(event.target)) return;
|
|
839
|
+
if (meta && event.key.toLowerCase() === "enter") {
|
|
840
|
+
if (pendingRef.current.size > 0) {
|
|
841
|
+
event.preventDefault();
|
|
842
|
+
if (changesOpen) applyPending();
|
|
843
|
+
else openChanges();
|
|
844
|
+
}
|
|
845
|
+
return;
|
|
846
|
+
}
|
|
847
|
+
if (meta && event.key.toLowerCase() === "s") {
|
|
848
|
+
if (pendingRef.current.size > 0) {
|
|
849
|
+
event.preventDefault();
|
|
850
|
+
if (changesOpen) applyPending();
|
|
851
|
+
else openChanges();
|
|
852
|
+
}
|
|
853
|
+
return;
|
|
854
|
+
}
|
|
855
|
+
if (meta && event.key.toLowerCase() === "z") {
|
|
856
|
+
event.preventDefault();
|
|
857
|
+
if (event.shiftKey) onRedo();
|
|
858
|
+
else onUndo();
|
|
859
|
+
return;
|
|
860
|
+
}
|
|
861
|
+
if (meta && event.key.toLowerCase() === "y") {
|
|
862
|
+
event.preventDefault();
|
|
863
|
+
onRedo();
|
|
864
|
+
return;
|
|
865
|
+
}
|
|
866
|
+
if (event.key === "Escape") {
|
|
867
|
+
if (isFindInput(event.target)) return;
|
|
868
|
+
if (!editingCell && !cellRange) return;
|
|
869
|
+
event.preventDefault();
|
|
870
|
+
setEditingCell(null);
|
|
871
|
+
setEditSeed(null);
|
|
872
|
+
setCellRange(null);
|
|
873
|
+
event.currentTarget.focus({ preventScroll: true });
|
|
874
|
+
return;
|
|
875
|
+
}
|
|
876
|
+
if (editingCell) return;
|
|
877
|
+
if (event.key === "Enter" && cellRange) {
|
|
878
|
+
event.preventDefault();
|
|
879
|
+
const row = viewRows[cellRange.head.row];
|
|
880
|
+
const col = visibleColumns[cellRange.head.col];
|
|
881
|
+
if (row && col) startEdit(row.id, col.key);
|
|
882
|
+
return;
|
|
883
|
+
}
|
|
884
|
+
if (
|
|
885
|
+
cellRange &&
|
|
886
|
+
canInlineEdit &&
|
|
887
|
+
event.key.length === 1 &&
|
|
888
|
+
!event.metaKey &&
|
|
889
|
+
!event.ctrlKey &&
|
|
890
|
+
!event.altKey
|
|
891
|
+
) {
|
|
892
|
+
const row = viewRows[cellRange.head.row];
|
|
893
|
+
const col = visibleColumns[cellRange.head.col];
|
|
894
|
+
if (row && col) {
|
|
895
|
+
event.preventDefault();
|
|
896
|
+
startEdit(row.id, col.key, event.key);
|
|
897
|
+
}
|
|
898
|
+
return;
|
|
899
|
+
}
|
|
900
|
+
if ((event.key === "Delete" || event.key === "Backspace") && cellRange && canInlineEdit) {
|
|
901
|
+
event.preventDefault();
|
|
902
|
+
const n = applyHits(
|
|
903
|
+
fillHits({
|
|
904
|
+
range: cellRange,
|
|
905
|
+
rowIds: viewRows.map((r) => r.id),
|
|
906
|
+
columnKeys: visibleColumns.map((c) => c.key),
|
|
907
|
+
text: "",
|
|
908
|
+
writable: writableCell,
|
|
909
|
+
}),
|
|
910
|
+
);
|
|
911
|
+
if (n > 0) setNotice(`Cleared ${n} cell(s)`);
|
|
912
|
+
}
|
|
913
|
+
};
|
|
914
|
+
|
|
915
|
+
const onCopy = (event: ClipboardEvent<HTMLDivElement>) => {
|
|
916
|
+
if (isFindInput(event.target) || nativeTextSelected(event.target)) return;
|
|
917
|
+
if (selected.length === 0 && !lastFocus && !cellRange) return;
|
|
918
|
+
event.preventDefault();
|
|
919
|
+
void copySelection();
|
|
920
|
+
};
|
|
921
|
+
|
|
922
|
+
const onPaste = (event: ClipboardEvent<HTMLDivElement>) => {
|
|
923
|
+
if (!canInlineEdit || isFindInput(event.target)) return;
|
|
924
|
+
const text = event.clipboardData.getData("text/plain");
|
|
925
|
+
const matrix = tsvToMatrix(text);
|
|
926
|
+
const bulk = selected.length > 1 || matrix.length > 1 || (matrix[0]?.length ?? 0) > 1;
|
|
927
|
+
if (!bulk && event.target instanceof HTMLInputElement) return;
|
|
928
|
+
if (matrix.length === 0) return;
|
|
929
|
+
event.preventDefault();
|
|
930
|
+
applyPasteMatrix(matrix);
|
|
931
|
+
};
|
|
932
|
+
|
|
933
|
+
const inspectRow = inspect ? model.rows.find((row) => row.id === inspect.rowId) : undefined;
|
|
934
|
+
const inspectCol = inspect ? model.columns.find((col) => col.key === inspect.column) : undefined;
|
|
935
|
+
const inspectValue =
|
|
936
|
+
inspectRow && inspectCol ? overlayValue(inspectRow, inspectCol.key) : undefined;
|
|
937
|
+
const inspectEditable =
|
|
938
|
+
inspectRow !== undefined &&
|
|
939
|
+
inspectCol !== undefined &&
|
|
940
|
+
!saving &&
|
|
941
|
+
isCellEditable(inspectCol, inspectRow.cells[inspectCol.key]);
|
|
942
|
+
|
|
943
|
+
return (
|
|
944
|
+
<div
|
|
945
|
+
className="flex h-full min-h-0 flex-col overflow-hidden outline-none"
|
|
946
|
+
data-slot="store-data-grid"
|
|
947
|
+
tabIndex={0}
|
|
948
|
+
onKeyDown={onKeyDown}
|
|
949
|
+
onCopy={onCopy}
|
|
950
|
+
onPaste={onPaste}
|
|
951
|
+
>
|
|
952
|
+
<div className="relative z-20 flex h-9 shrink-0 flex-nowrap items-center gap-1.5 overflow-x-auto border-b border-border/60 px-2">
|
|
953
|
+
{toolbarExtras}
|
|
954
|
+
{toolbarExtras ? (
|
|
955
|
+
<Separator orientation="vertical" className="mx-0.5 my-2 h-4 self-center" />
|
|
956
|
+
) : null}
|
|
957
|
+
<ToolbarTip
|
|
958
|
+
label={indexMode ? "Search this index" : "Find in this page"}
|
|
959
|
+
keys={modChord("F")}
|
|
960
|
+
className="relative min-w-40 flex-1"
|
|
961
|
+
>
|
|
962
|
+
<HugeiconsIcon
|
|
963
|
+
icon={Search01Icon}
|
|
964
|
+
className="pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-muted-foreground"
|
|
965
|
+
aria-hidden
|
|
966
|
+
/>
|
|
967
|
+
<Input
|
|
968
|
+
ref={findRef}
|
|
969
|
+
value={findValue}
|
|
970
|
+
onChange={(e) =>
|
|
971
|
+
indexMode ? indexSearch.onChange(e.target.value) : setFindText(e.target.value)
|
|
972
|
+
}
|
|
973
|
+
placeholder={indexMode ? "Find by title or id — or paste 1, 0, 0" : "Find in results…"}
|
|
974
|
+
aria-label={indexMode ? "Search this index" : "Find in results"}
|
|
975
|
+
data-slot={indexMode ? "index-search" : "grid-find"}
|
|
976
|
+
className="h-6 border-0 bg-transparent pl-7 text-[11px] shadow-none focus-visible:border-transparent focus-visible:bg-muted/40 focus-visible:ring-0 md:text-[11px] dark:bg-transparent"
|
|
977
|
+
/>
|
|
978
|
+
</ToolbarTip>
|
|
979
|
+
{indexMode ? (
|
|
980
|
+
<div className="flex items-center gap-1 text-[11px]" title="Hits to return">
|
|
981
|
+
<span className="text-muted-foreground">topK</span>
|
|
982
|
+
<Input
|
|
983
|
+
type="number"
|
|
984
|
+
min={1}
|
|
985
|
+
max={100}
|
|
986
|
+
aria-label="topK"
|
|
987
|
+
data-slot="index-topk"
|
|
988
|
+
className="h-6 w-10 border-0 bg-transparent px-1 text-center font-mono text-[11px] tabular-nums shadow-none focus-visible:border-transparent focus-visible:bg-muted/40 focus-visible:ring-0 md:text-[11px] dark:bg-transparent"
|
|
989
|
+
value={indexSearch.topK}
|
|
990
|
+
onChange={(e) => {
|
|
991
|
+
const n = Number(e.target.value);
|
|
992
|
+
if (Number.isFinite(n) && n >= 1 && n <= 100) indexSearch.onTopKChange(n);
|
|
993
|
+
}}
|
|
994
|
+
/>
|
|
995
|
+
</div>
|
|
996
|
+
) : null}
|
|
997
|
+
{sort ? (
|
|
998
|
+
<span
|
|
999
|
+
className="inline-flex items-center gap-1 rounded-md bg-muted/50 px-1.5 py-0.5 font-mono text-[10px] whitespace-nowrap text-muted-foreground"
|
|
1000
|
+
data-slot="sort-indicator"
|
|
1001
|
+
>
|
|
1002
|
+
{sort.key} {sort.direction === "desc" ? "↓" : "↑"}
|
|
1003
|
+
</span>
|
|
1004
|
+
) : null}
|
|
1005
|
+
|
|
1006
|
+
<Separator orientation="vertical" className="mx-0.5 my-2 ml-auto h-4 self-center" />
|
|
1007
|
+
<div className="flex items-center gap-0.5">
|
|
1008
|
+
{canInlineEdit && facet === "kv" ? (
|
|
1009
|
+
<GridIconButton
|
|
1010
|
+
label="Add key"
|
|
1011
|
+
disabled={saving}
|
|
1012
|
+
onClick={() => setAddOpen(true)}
|
|
1013
|
+
slot="add-kv-key"
|
|
1014
|
+
>
|
|
1015
|
+
<HugeiconsIcon icon={PlusSignIcon} className="size-3.5" aria-hidden />
|
|
1016
|
+
</GridIconButton>
|
|
1017
|
+
) : null}
|
|
1018
|
+
{canInlineEdit ? (
|
|
1019
|
+
<>
|
|
1020
|
+
<input
|
|
1021
|
+
ref={importRef}
|
|
1022
|
+
type="file"
|
|
1023
|
+
accept=".csv,.tsv,.txt,.json,text/csv,application/json"
|
|
1024
|
+
className="sr-only"
|
|
1025
|
+
tabIndex={-1}
|
|
1026
|
+
aria-hidden
|
|
1027
|
+
onChange={onImportFile}
|
|
1028
|
+
/>
|
|
1029
|
+
<GridIconButton
|
|
1030
|
+
label="Import CSV or JSON"
|
|
1031
|
+
disabled={saving}
|
|
1032
|
+
onClick={() => importRef.current?.click()}
|
|
1033
|
+
slot="import-rows"
|
|
1034
|
+
>
|
|
1035
|
+
<HugeiconsIcon icon={FileImportIcon} className="size-3.5" aria-hidden />
|
|
1036
|
+
</GridIconButton>
|
|
1037
|
+
</>
|
|
1038
|
+
) : null}
|
|
1039
|
+
<DropdownMenu>
|
|
1040
|
+
<ToolbarTip
|
|
1041
|
+
label={
|
|
1042
|
+
selected.length > 0
|
|
1043
|
+
? `Export ${selected.length} selected row${selected.length === 1 ? "" : "s"}`
|
|
1044
|
+
: "Export this page as CSV or JSON"
|
|
1045
|
+
}
|
|
1046
|
+
>
|
|
1047
|
+
<DropdownMenuTrigger
|
|
1048
|
+
disabled={viewRows.length === 0}
|
|
1049
|
+
render={(props) => (
|
|
1050
|
+
<Button
|
|
1051
|
+
{...props}
|
|
1052
|
+
type="button"
|
|
1053
|
+
variant="ghost"
|
|
1054
|
+
size="icon-xs"
|
|
1055
|
+
disabled={viewRows.length === 0}
|
|
1056
|
+
aria-label="Export rows"
|
|
1057
|
+
data-slot="export-rows"
|
|
1058
|
+
>
|
|
1059
|
+
<HugeiconsIcon icon={FileExportIcon} className="size-3.5" aria-hidden />
|
|
1060
|
+
</Button>
|
|
1061
|
+
)}
|
|
1062
|
+
/>
|
|
1063
|
+
</ToolbarTip>
|
|
1064
|
+
<DropdownMenuContent align="end" className="w-40">
|
|
1065
|
+
<DropdownMenuGroup>
|
|
1066
|
+
<DropdownMenuLabel>
|
|
1067
|
+
{selected.length > 0 ? "Export selection" : "Export page"}
|
|
1068
|
+
</DropdownMenuLabel>
|
|
1069
|
+
<DropdownMenuItem onClick={() => exportRows("csv")}>CSV</DropdownMenuItem>
|
|
1070
|
+
<DropdownMenuItem onClick={() => exportRows("json")}>JSON</DropdownMenuItem>
|
|
1071
|
+
</DropdownMenuGroup>
|
|
1072
|
+
</DropdownMenuContent>
|
|
1073
|
+
</DropdownMenu>
|
|
1074
|
+
{canInlineEdit ? (
|
|
1075
|
+
<>
|
|
1076
|
+
{pending.size > 0 ? (
|
|
1077
|
+
<GridIconButton
|
|
1078
|
+
label="Discard uncommitted changes"
|
|
1079
|
+
disabled={saving}
|
|
1080
|
+
onClick={discardPending}
|
|
1081
|
+
slot="discard-changes"
|
|
1082
|
+
>
|
|
1083
|
+
<HugeiconsIcon icon={Cancel01Icon} className="size-3.5" aria-hidden />
|
|
1084
|
+
</GridIconButton>
|
|
1085
|
+
) : null}
|
|
1086
|
+
<ToolbarTip
|
|
1087
|
+
label={
|
|
1088
|
+
pending.size > 0
|
|
1089
|
+
? `Review ${pending.size} uncommitted change${pending.size === 1 ? "" : "s"}`
|
|
1090
|
+
: "No uncommitted changes"
|
|
1091
|
+
}
|
|
1092
|
+
>
|
|
1093
|
+
<Button
|
|
1094
|
+
type="button"
|
|
1095
|
+
variant={pending.size > 0 ? "outline" : "ghost"}
|
|
1096
|
+
size="xs"
|
|
1097
|
+
disabled={pending.size === 0 || saving}
|
|
1098
|
+
onClick={openChanges}
|
|
1099
|
+
aria-label={
|
|
1100
|
+
pending.size > 0
|
|
1101
|
+
? `Review ${pending.size} uncommitted changes`
|
|
1102
|
+
: "Review changes"
|
|
1103
|
+
}
|
|
1104
|
+
data-slot="apply-changes"
|
|
1105
|
+
className={
|
|
1106
|
+
pending.size > 0
|
|
1107
|
+
? "relative h-6 gap-1 overflow-visible border-amber-500/25 bg-amber-500/10 text-amber-800 hover:bg-amber-500/15 dark:text-amber-300"
|
|
1108
|
+
: "h-6"
|
|
1109
|
+
}
|
|
1110
|
+
>
|
|
1111
|
+
{pending.size > 0 ? (
|
|
1112
|
+
<span
|
|
1113
|
+
aria-hidden
|
|
1114
|
+
className="oke-changes-border-run pointer-events-none absolute inset-0"
|
|
1115
|
+
/>
|
|
1116
|
+
) : null}
|
|
1117
|
+
<HugeiconsIcon icon={Tick02Icon} className="relative size-3.5" aria-hidden />
|
|
1118
|
+
<span className="relative">Changes</span>
|
|
1119
|
+
{pending.size > 0 ? (
|
|
1120
|
+
<span className="relative min-w-3.5 rounded-full border border-amber-500/25 bg-amber-500/10 px-1 font-mono text-[9px] leading-3">
|
|
1121
|
+
{pending.size}
|
|
1122
|
+
</span>
|
|
1123
|
+
) : null}
|
|
1124
|
+
</Button>
|
|
1125
|
+
</ToolbarTip>
|
|
1126
|
+
</>
|
|
1127
|
+
) : null}
|
|
1128
|
+
<GridIconButton
|
|
1129
|
+
label="Undo edit"
|
|
1130
|
+
keys={modChord("Z")}
|
|
1131
|
+
disabled={(pending.size === 0 && history.past.length === 0) || saving}
|
|
1132
|
+
onClick={onUndo}
|
|
1133
|
+
slot="undo-edit"
|
|
1134
|
+
>
|
|
1135
|
+
<HugeiconsIcon icon={Undo02Icon} className="size-3.5" aria-hidden />
|
|
1136
|
+
</GridIconButton>
|
|
1137
|
+
<GridIconButton
|
|
1138
|
+
label="Redo edit"
|
|
1139
|
+
keys={modShiftChord("Z")}
|
|
1140
|
+
disabled={history.future.length === 0 || saving || pending.size > 0}
|
|
1141
|
+
onClick={onRedo}
|
|
1142
|
+
slot="redo-edit"
|
|
1143
|
+
>
|
|
1144
|
+
<HugeiconsIcon icon={Redo02Icon} className="size-3.5" aria-hidden />
|
|
1145
|
+
</GridIconButton>
|
|
1146
|
+
|
|
1147
|
+
<DropdownMenu>
|
|
1148
|
+
<ToolbarTip label="Row height and columns">
|
|
1149
|
+
<DropdownMenuTrigger
|
|
1150
|
+
render={(props) => (
|
|
1151
|
+
<Button
|
|
1152
|
+
{...props}
|
|
1153
|
+
type="button"
|
|
1154
|
+
variant="ghost"
|
|
1155
|
+
size="icon-xs"
|
|
1156
|
+
aria-label="View options"
|
|
1157
|
+
data-slot="view-menu"
|
|
1158
|
+
>
|
|
1159
|
+
<HugeiconsIcon icon={ViewIcon} className="size-3.5" aria-hidden />
|
|
1160
|
+
</Button>
|
|
1161
|
+
)}
|
|
1162
|
+
/>
|
|
1163
|
+
</ToolbarTip>
|
|
1164
|
+
<DropdownMenuContent align="end" className="w-48">
|
|
1165
|
+
<DropdownMenuGroup>
|
|
1166
|
+
<DropdownMenuLabel>Row height</DropdownMenuLabel>
|
|
1167
|
+
<DropdownMenuRadioGroup
|
|
1168
|
+
value={rowHeight}
|
|
1169
|
+
onValueChange={(value) => setRowHeight(value as RowHeight)}
|
|
1170
|
+
>
|
|
1171
|
+
<DropdownMenuRadioItem value="short" data-slot="row-height-menu">
|
|
1172
|
+
Short
|
|
1173
|
+
</DropdownMenuRadioItem>
|
|
1174
|
+
<DropdownMenuRadioItem value="medium">Medium</DropdownMenuRadioItem>
|
|
1175
|
+
<DropdownMenuRadioItem value="tall">Tall</DropdownMenuRadioItem>
|
|
1176
|
+
<DropdownMenuRadioItem value="extra-tall">Extra tall</DropdownMenuRadioItem>
|
|
1177
|
+
</DropdownMenuRadioGroup>
|
|
1178
|
+
</DropdownMenuGroup>
|
|
1179
|
+
<DropdownMenuSeparator />
|
|
1180
|
+
<DropdownMenuGroup>
|
|
1181
|
+
<DropdownMenuLabel>Columns</DropdownMenuLabel>
|
|
1182
|
+
{model.columns.map((col) => {
|
|
1183
|
+
const visible = !hiddenCols.has(col.key);
|
|
1184
|
+
const lastVisible = visible && visibleColumns.length === 1;
|
|
1185
|
+
return (
|
|
1186
|
+
<DropdownMenuCheckboxItem
|
|
1187
|
+
key={col.key}
|
|
1188
|
+
checked={visible}
|
|
1189
|
+
disabled={lastVisible}
|
|
1190
|
+
onCheckedChange={(checked) => {
|
|
1191
|
+
setHiddenCols((prev) => {
|
|
1192
|
+
const next = new Set(prev);
|
|
1193
|
+
if (checked) next.delete(col.key);
|
|
1194
|
+
else next.add(col.key);
|
|
1195
|
+
return next;
|
|
1196
|
+
});
|
|
1197
|
+
}}
|
|
1198
|
+
>
|
|
1199
|
+
<span className="font-mono text-[11px]">{col.label ?? col.key}</span>
|
|
1200
|
+
</DropdownMenuCheckboxItem>
|
|
1201
|
+
);
|
|
1202
|
+
})}
|
|
1203
|
+
</DropdownMenuGroup>
|
|
1204
|
+
</DropdownMenuContent>
|
|
1205
|
+
</DropdownMenu>
|
|
1206
|
+
|
|
1207
|
+
{model.editable && onDeleteRows ? (
|
|
1208
|
+
<ToolbarTip
|
|
1209
|
+
label={
|
|
1210
|
+
selectedRows.length > 0
|
|
1211
|
+
? `Delete ${selectedRows.length} selected row${selectedRows.length === 1 ? "" : "s"}`
|
|
1212
|
+
: "Select rows to delete"
|
|
1213
|
+
}
|
|
1214
|
+
>
|
|
1215
|
+
<Button
|
|
1216
|
+
type="button"
|
|
1217
|
+
variant="destructive"
|
|
1218
|
+
size={selectedRows.length > 0 ? "xs" : "icon-xs"}
|
|
1219
|
+
className={selectedRows.length > 0 ? "ml-1 h-6" : "ml-1"}
|
|
1220
|
+
disabled={selectedRows.length === 0}
|
|
1221
|
+
onClick={() => onDeleteRows(selectedRows)}
|
|
1222
|
+
aria-label={
|
|
1223
|
+
selectedRows.length > 0
|
|
1224
|
+
? `Delete ${selectedRows.length} selected rows`
|
|
1225
|
+
: "Delete selected rows"
|
|
1226
|
+
}
|
|
1227
|
+
data-slot="delete-selected"
|
|
1228
|
+
>
|
|
1229
|
+
<HugeiconsIcon icon={Delete02Icon} className="size-3.5" aria-hidden />
|
|
1230
|
+
{selectedRows.length > 0 ? selectedRows.length : null}
|
|
1231
|
+
</Button>
|
|
1232
|
+
</ToolbarTip>
|
|
1233
|
+
) : null}
|
|
1234
|
+
</div>
|
|
1235
|
+
</div>
|
|
1236
|
+
|
|
1237
|
+
<div
|
|
1238
|
+
ref={viewportRef}
|
|
1239
|
+
className="min-h-0 flex-1"
|
|
1240
|
+
data-slot="grid-viewport"
|
|
1241
|
+
aria-label={`${childName} rows`}
|
|
1242
|
+
>
|
|
1243
|
+
<Table
|
|
1244
|
+
data={viewRows}
|
|
1245
|
+
columns={tableColumns}
|
|
1246
|
+
getRowId={(row) => row.id}
|
|
1247
|
+
selectable={hasSelect}
|
|
1248
|
+
selectedRowIds={selected}
|
|
1249
|
+
onSelectionChange={setSelected}
|
|
1250
|
+
sort={sort}
|
|
1251
|
+
onSortChange={setSort}
|
|
1252
|
+
resizable
|
|
1253
|
+
reorderable
|
|
1254
|
+
onCellEdit={canInlineEdit ? onCellEdit : undefined}
|
|
1255
|
+
onDeleteRow={
|
|
1256
|
+
model.editable && onDeleteRows
|
|
1257
|
+
? (rowId) => {
|
|
1258
|
+
const row = model.rows.find((r) => r.id === rowId);
|
|
1259
|
+
if (row) onDeleteRows([row]);
|
|
1260
|
+
}
|
|
1261
|
+
: undefined
|
|
1262
|
+
}
|
|
1263
|
+
cellRange={cellRange}
|
|
1264
|
+
onCellRangeChange={
|
|
1265
|
+
canInlineEdit
|
|
1266
|
+
? (range) => {
|
|
1267
|
+
setCellRange(range);
|
|
1268
|
+
if (!range) return;
|
|
1269
|
+
const row = viewRows[range.head.row];
|
|
1270
|
+
const col = visibleColumns[range.head.col];
|
|
1271
|
+
if (row && col) setLastFocus({ rowId: row.id, key: col.key });
|
|
1272
|
+
const root = viewportRef.current?.closest("[data-slot='store-data-grid']");
|
|
1273
|
+
if (
|
|
1274
|
+
root instanceof HTMLElement &&
|
|
1275
|
+
!(document.activeElement instanceof HTMLInputElement)
|
|
1276
|
+
) {
|
|
1277
|
+
root.focus({ preventScroll: true });
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
: undefined
|
|
1281
|
+
}
|
|
1282
|
+
onCellActivate={
|
|
1283
|
+
canInlineEdit
|
|
1284
|
+
? (row, col) => {
|
|
1285
|
+
const r = viewRows[row];
|
|
1286
|
+
const c = visibleColumns[col];
|
|
1287
|
+
if (r && c) startEdit(r.id, c.key);
|
|
1288
|
+
}
|
|
1289
|
+
: undefined
|
|
1290
|
+
}
|
|
1291
|
+
rowHeight={rowHeightPx}
|
|
1292
|
+
height={viewportHeight}
|
|
1293
|
+
emptyState={
|
|
1294
|
+
indexMode && findValue.trim()
|
|
1295
|
+
? "No hits — try a different query or raise topK."
|
|
1296
|
+
: findText.trim()
|
|
1297
|
+
? "No matches on this page — increase Limit to search more rows."
|
|
1298
|
+
: "No rows."
|
|
1299
|
+
}
|
|
1300
|
+
className="h-full rounded-none border-0"
|
|
1301
|
+
/>
|
|
1302
|
+
</div>
|
|
1303
|
+
|
|
1304
|
+
{canInlineEdit ? (
|
|
1305
|
+
<PendingChangesSheet
|
|
1306
|
+
open={changesOpen}
|
|
1307
|
+
onOpenChange={setChangesOpen}
|
|
1308
|
+
pending={pending}
|
|
1309
|
+
table={childName}
|
|
1310
|
+
facet={facet === "kv" ? "kv" : "sql"}
|
|
1311
|
+
saving={saving}
|
|
1312
|
+
error={editError}
|
|
1313
|
+
onUndoCell={undoPendingCell}
|
|
1314
|
+
onClearAll={discardPending}
|
|
1315
|
+
onCommitAll={applyPending}
|
|
1316
|
+
/>
|
|
1317
|
+
) : null}
|
|
1318
|
+
|
|
1319
|
+
{canInlineEdit && facet === "sql" && onInsertOpenChange ? (
|
|
1320
|
+
<SqlInsertSheet
|
|
1321
|
+
open={insertOpen}
|
|
1322
|
+
onOpenChange={onInsertOpenChange}
|
|
1323
|
+
storeRef={storeRef}
|
|
1324
|
+
childName={childName}
|
|
1325
|
+
tenant={tenant}
|
|
1326
|
+
columns={model.columns}
|
|
1327
|
+
/>
|
|
1328
|
+
) : null}
|
|
1329
|
+
|
|
1330
|
+
{canInlineEdit && facet === "kv" ? (
|
|
1331
|
+
<KvAddSheet
|
|
1332
|
+
open={addOpen}
|
|
1333
|
+
onOpenChange={setAddOpen}
|
|
1334
|
+
storeRef={storeRef}
|
|
1335
|
+
childName={childName}
|
|
1336
|
+
tenant={tenant}
|
|
1337
|
+
existingKeys={model.rows.map((row) => row.id)}
|
|
1338
|
+
/>
|
|
1339
|
+
) : null}
|
|
1340
|
+
|
|
1341
|
+
{inspect && inspectRow && inspectCol ? (
|
|
1342
|
+
<JsonValueSheet
|
|
1343
|
+
open
|
|
1344
|
+
onOpenChange={(open) => {
|
|
1345
|
+
if (!open) setInspect(null);
|
|
1346
|
+
}}
|
|
1347
|
+
rowId={inspect.rowId}
|
|
1348
|
+
column={inspect.column}
|
|
1349
|
+
storeRef={storeRef}
|
|
1350
|
+
value={inspectValue}
|
|
1351
|
+
originalValue={inspectRow.cells[inspectCol.key]}
|
|
1352
|
+
editable={inspectEditable}
|
|
1353
|
+
onChange={
|
|
1354
|
+
inspectEditable
|
|
1355
|
+
? (next) => stageRawCell(inspect.rowId, inspect.column, next)
|
|
1356
|
+
: undefined
|
|
1357
|
+
}
|
|
1358
|
+
/>
|
|
1359
|
+
) : null}
|
|
1360
|
+
|
|
1361
|
+
<div
|
|
1362
|
+
className="flex h-7 shrink-0 items-center gap-2 border-t border-border/60 px-2.5 font-mono text-[10px] tabular-nums text-muted-foreground"
|
|
1363
|
+
data-slot="grid-status"
|
|
1364
|
+
>
|
|
1365
|
+
<span>
|
|
1366
|
+
{filteredRows.length}
|
|
1367
|
+
{filteredRows.length !== model.rows.length ? ` of ${model.rows.length}` : ""}{" "}
|
|
1368
|
+
{model.rows.length === 1 ? "row" : "rows"}
|
|
1369
|
+
</span>
|
|
1370
|
+
{routedRole ? (
|
|
1371
|
+
<>
|
|
1372
|
+
<span aria-hidden className="text-border">
|
|
1373
|
+
·
|
|
1374
|
+
</span>
|
|
1375
|
+
<span>{routedRole}</span>
|
|
1376
|
+
</>
|
|
1377
|
+
) : null}
|
|
1378
|
+
{facet === "sql" && masked ? (
|
|
1379
|
+
<>
|
|
1380
|
+
<span aria-hidden className="text-border">
|
|
1381
|
+
·
|
|
1382
|
+
</span>
|
|
1383
|
+
<span className="text-sky-700 dark:text-sky-400">PII masked</span>
|
|
1384
|
+
</>
|
|
1385
|
+
) : facet === "sql" && model.columns.some((col) => col.pii) ? (
|
|
1386
|
+
<>
|
|
1387
|
+
<span aria-hidden className="text-border">
|
|
1388
|
+
·
|
|
1389
|
+
</span>
|
|
1390
|
+
<span className="text-amber-800 dark:text-amber-300">PII visible</span>
|
|
1391
|
+
</>
|
|
1392
|
+
) : null}
|
|
1393
|
+
{pending.size > 0 ? (
|
|
1394
|
+
<>
|
|
1395
|
+
<span aria-hidden className="text-border">
|
|
1396
|
+
·
|
|
1397
|
+
</span>
|
|
1398
|
+
<span
|
|
1399
|
+
className="text-amber-800 dark:text-amber-300"
|
|
1400
|
+
role="status"
|
|
1401
|
+
data-slot="pending-count"
|
|
1402
|
+
>
|
|
1403
|
+
{pending.size} uncommitted
|
|
1404
|
+
</span>
|
|
1405
|
+
</>
|
|
1406
|
+
) : null}
|
|
1407
|
+
{saving ? (
|
|
1408
|
+
<>
|
|
1409
|
+
<span aria-hidden className="text-border">
|
|
1410
|
+
·
|
|
1411
|
+
</span>
|
|
1412
|
+
<span role="status" data-slot="cell-edit-saving">
|
|
1413
|
+
Saving…
|
|
1414
|
+
</span>
|
|
1415
|
+
</>
|
|
1416
|
+
) : null}
|
|
1417
|
+
{notice ? (
|
|
1418
|
+
<>
|
|
1419
|
+
<span aria-hidden className="text-border">
|
|
1420
|
+
·
|
|
1421
|
+
</span>
|
|
1422
|
+
<span role="status" data-slot="grid-notice">
|
|
1423
|
+
{notice}
|
|
1424
|
+
</span>
|
|
1425
|
+
</>
|
|
1426
|
+
) : null}
|
|
1427
|
+
{editError ? (
|
|
1428
|
+
<span className="text-destructive" role="alert" data-slot="cell-edit-error">
|
|
1429
|
+
{editError}
|
|
1430
|
+
</span>
|
|
1431
|
+
) : null}
|
|
1432
|
+
{indexMode && findValue.trim() ? (
|
|
1433
|
+
<span className="ml-auto truncate" role="status" data-slot="find-scope">
|
|
1434
|
+
Index query · topK {indexSearch.topK}
|
|
1435
|
+
</span>
|
|
1436
|
+
) : findText.trim() ? (
|
|
1437
|
+
<span className="ml-auto truncate" role="status" data-slot="find-scope">
|
|
1438
|
+
This page only · limit {limit}
|
|
1439
|
+
</span>
|
|
1440
|
+
) : selectedRows.length > 0 ? (
|
|
1441
|
+
<span className="ml-auto">
|
|
1442
|
+
{selectedRows.length} row{selectedRows.length === 1 ? "" : "s"} checked
|
|
1443
|
+
</span>
|
|
1444
|
+
) : (
|
|
1445
|
+
<span className="ml-auto opacity-60">
|
|
1446
|
+
Click to select · drag a range · click again or type to edit · Changes to review
|
|
1447
|
+
</span>
|
|
1448
|
+
)}
|
|
1449
|
+
</div>
|
|
1450
|
+
</div>
|
|
1451
|
+
);
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
/** Header label with type / PK / PII glyphs. */
|
|
1455
|
+
function StoreColumnHeader({ col }: { readonly col: StoreGridColumn }): JSX.Element {
|
|
1456
|
+
return (
|
|
1457
|
+
<span className="inline-flex min-w-0 items-center gap-1" title={col.description ?? col.key}>
|
|
1458
|
+
{col.type !== "string" ? (
|
|
1459
|
+
<span className="shrink-0 font-mono text-[9px] text-muted-foreground/50">
|
|
1460
|
+
{typeGlyph(col.type)}
|
|
1461
|
+
</span>
|
|
1462
|
+
) : null}
|
|
1463
|
+
{col.primaryKey ? (
|
|
1464
|
+
<HugeiconsIcon
|
|
1465
|
+
icon={Key01Icon}
|
|
1466
|
+
className="size-3 shrink-0 text-amber-600 dark:text-amber-400"
|
|
1467
|
+
aria-label="Primary key"
|
|
1468
|
+
/>
|
|
1469
|
+
) : null}
|
|
1470
|
+
{col.pii ? (
|
|
1471
|
+
<HugeiconsIcon
|
|
1472
|
+
icon={SecurityCheckIcon}
|
|
1473
|
+
className="size-3 shrink-0 text-sky-600 dark:text-sky-400"
|
|
1474
|
+
aria-label="PII column"
|
|
1475
|
+
/>
|
|
1476
|
+
) : null}
|
|
1477
|
+
<span className="truncate font-mono text-[11px]">{col.label ?? col.key}</span>
|
|
1478
|
+
</span>
|
|
1479
|
+
);
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
/** Dirty fill lives on the `td`; this is only the tan pending text. */
|
|
1483
|
+
const DIRTY_TEXT = "text-[#9a5b12] dark:text-[#e8c48a]";
|
|
1484
|
+
|
|
1485
|
+
/** Stretch the cell chrome to the td edges so pending/selection fills the row. */
|
|
1486
|
+
const CELL_FILL =
|
|
1487
|
+
"absolute inset-0 flex min-w-0 items-center overflow-hidden px-4 font-mono text-[11px]";
|
|
1488
|
+
|
|
1489
|
+
/** Body cell: Reveal for masked PII, EditableCell when writable, otherwise formatted text. */
|
|
1490
|
+
function StoreGridBodyCell({
|
|
1491
|
+
row,
|
|
1492
|
+
col,
|
|
1493
|
+
storeRef,
|
|
1494
|
+
childName,
|
|
1495
|
+
tenant,
|
|
1496
|
+
masked,
|
|
1497
|
+
editable,
|
|
1498
|
+
saving,
|
|
1499
|
+
dirty,
|
|
1500
|
+
editing,
|
|
1501
|
+
draftSeed,
|
|
1502
|
+
displayValue,
|
|
1503
|
+
onFocus,
|
|
1504
|
+
onStartEdit,
|
|
1505
|
+
onEditEnd,
|
|
1506
|
+
onCommit,
|
|
1507
|
+
onInspect,
|
|
1508
|
+
onUpgrade,
|
|
1509
|
+
}: {
|
|
1510
|
+
readonly row: StoreGridRow;
|
|
1511
|
+
readonly col: StoreGridColumn;
|
|
1512
|
+
readonly storeRef: string;
|
|
1513
|
+
readonly childName: string;
|
|
1514
|
+
readonly tenant?: string | null;
|
|
1515
|
+
readonly masked: boolean;
|
|
1516
|
+
readonly editable: boolean;
|
|
1517
|
+
readonly saving: boolean;
|
|
1518
|
+
readonly dirty: boolean;
|
|
1519
|
+
readonly editing: boolean;
|
|
1520
|
+
readonly draftSeed: string | null;
|
|
1521
|
+
readonly displayValue: unknown;
|
|
1522
|
+
readonly onFocus: () => void;
|
|
1523
|
+
readonly onStartEdit: () => void;
|
|
1524
|
+
readonly onEditEnd: () => void;
|
|
1525
|
+
readonly onCommit: (next: string) => void;
|
|
1526
|
+
readonly onInspect: () => void;
|
|
1527
|
+
readonly onUpgrade?: () => void;
|
|
1528
|
+
}): JSX.Element {
|
|
1529
|
+
const value = displayValue;
|
|
1530
|
+
const numeric = isNumericType(col.type);
|
|
1531
|
+
const isNull = value === null || value === undefined;
|
|
1532
|
+
|
|
1533
|
+
if (col.pii && masked && isStorePiiMask(row.cells[col.key]) && !dirty) {
|
|
1534
|
+
return (
|
|
1535
|
+
<span className={CELL_FILL}>
|
|
1536
|
+
<RevealCell
|
|
1537
|
+
refName={storeRef}
|
|
1538
|
+
child={childName}
|
|
1539
|
+
{...(tenant ? { tenant } : {})}
|
|
1540
|
+
rowId={row.id}
|
|
1541
|
+
column={col.key}
|
|
1542
|
+
maskedValue={row.cells[col.key]}
|
|
1543
|
+
/>
|
|
1544
|
+
</span>
|
|
1545
|
+
);
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
if (col.type === "boolean") {
|
|
1549
|
+
const checked = displayValue === true;
|
|
1550
|
+
return (
|
|
1551
|
+
<span
|
|
1552
|
+
className={cn(CELL_FILL, "justify-center", dirty && DIRTY_TEXT)}
|
|
1553
|
+
data-slot={editable ? "cell-display" : undefined}
|
|
1554
|
+
data-pending={dirty ? "true" : undefined}
|
|
1555
|
+
onClick={(event) => event.stopPropagation()}
|
|
1556
|
+
>
|
|
1557
|
+
<Switch
|
|
1558
|
+
size="sm"
|
|
1559
|
+
checked={checked}
|
|
1560
|
+
disabled={!editable || saving}
|
|
1561
|
+
ariaLabel={checked ? `Disable ${row.id}` : `Enable ${row.id}`}
|
|
1562
|
+
onCheckedChange={(next) => {
|
|
1563
|
+
if (editable && !saving) onCommit(next ? "true" : "false");
|
|
1564
|
+
}}
|
|
1565
|
+
/>
|
|
1566
|
+
</span>
|
|
1567
|
+
);
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
if (editable && editing) {
|
|
1571
|
+
return (
|
|
1572
|
+
<span
|
|
1573
|
+
className={cn(CELL_FILL, dirty && DIRTY_TEXT, numeric && "tabular-nums")}
|
|
1574
|
+
data-slot="cell-editor"
|
|
1575
|
+
data-pending={dirty ? "true" : undefined}
|
|
1576
|
+
>
|
|
1577
|
+
<EditableCell
|
|
1578
|
+
value={draftSeed ?? cellDraftText(col, value)}
|
|
1579
|
+
label={`Edit ${col.key}`}
|
|
1580
|
+
dirty={dirty}
|
|
1581
|
+
autoFocus
|
|
1582
|
+
placeholder={col.format === "ttl" ? "30m" : undefined}
|
|
1583
|
+
onFocus={onFocus}
|
|
1584
|
+
onIdle={onEditEnd}
|
|
1585
|
+
onChange={(next) => {
|
|
1586
|
+
if (!saving) onCommit(next);
|
|
1587
|
+
}}
|
|
1588
|
+
className={cn(
|
|
1589
|
+
"h-full min-w-0 font-mono text-[11px]",
|
|
1590
|
+
numeric && "text-right tabular-nums",
|
|
1591
|
+
isRtlText(value) && "text-right",
|
|
1592
|
+
)}
|
|
1593
|
+
/>
|
|
1594
|
+
</span>
|
|
1595
|
+
);
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
const inspectable = asInspectableJson(value) !== null;
|
|
1599
|
+
const text = formatStoreCell(col, value);
|
|
1600
|
+
|
|
1601
|
+
return (
|
|
1602
|
+
<span
|
|
1603
|
+
role={editable ? "button" : undefined}
|
|
1604
|
+
tabIndex={editable ? -1 : undefined}
|
|
1605
|
+
data-slot={editable ? "cell-display" : undefined}
|
|
1606
|
+
data-pending={dirty ? "true" : undefined}
|
|
1607
|
+
className={cn(
|
|
1608
|
+
CELL_FILL,
|
|
1609
|
+
"group/cell gap-1",
|
|
1610
|
+
editable && "cursor-cell",
|
|
1611
|
+
dirty && DIRTY_TEXT,
|
|
1612
|
+
numeric && "tabular-nums",
|
|
1613
|
+
isNull && !dirty && "text-muted-foreground/40",
|
|
1614
|
+
col.type === "json" && !isNull && !dirty && "text-muted-foreground",
|
|
1615
|
+
)}
|
|
1616
|
+
title={col.format === "name-key" && typeof row.cells.url === "string" ? row.cells.url : text}
|
|
1617
|
+
onDoubleClick={
|
|
1618
|
+
editable
|
|
1619
|
+
? (event) => {
|
|
1620
|
+
event.stopPropagation();
|
|
1621
|
+
if (!saving) onStartEdit();
|
|
1622
|
+
}
|
|
1623
|
+
: undefined
|
|
1624
|
+
}
|
|
1625
|
+
>
|
|
1626
|
+
{col.format === "source" ? (
|
|
1627
|
+
<SourceBadge value={text} />
|
|
1628
|
+
) : col.format === "name-key" ? (
|
|
1629
|
+
<ExtensionTitle
|
|
1630
|
+
title={text}
|
|
1631
|
+
url={typeof row.cells.url === "string" ? row.cells.url : null}
|
|
1632
|
+
/>
|
|
1633
|
+
) : (
|
|
1634
|
+
<span className="min-w-0 flex-1 truncate" dir={isRtlText(value) ? "rtl" : "ltr"}>
|
|
1635
|
+
{text}
|
|
1636
|
+
</span>
|
|
1637
|
+
)}
|
|
1638
|
+
{col.format === "name-key" ? (
|
|
1639
|
+
<ExtensionIdChip
|
|
1640
|
+
name={typeof row.cells.name === "string" ? row.cells.name : ""}
|
|
1641
|
+
version={row.cells.version != null ? String(row.cells.version) : ""}
|
|
1642
|
+
available={row.cells.available != null ? String(row.cells.available) : ""}
|
|
1643
|
+
upgradeable={row.cells.upgrade === true}
|
|
1644
|
+
saving={saving}
|
|
1645
|
+
onUpgrade={onUpgrade}
|
|
1646
|
+
/>
|
|
1647
|
+
) : null}
|
|
1648
|
+
{inspectable ? <JsonInspectButton onInspect={onInspect} /> : null}
|
|
1649
|
+
</span>
|
|
1650
|
+
);
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1653
|
+
function ExtensionTitle({
|
|
1654
|
+
title,
|
|
1655
|
+
url,
|
|
1656
|
+
}: {
|
|
1657
|
+
readonly title: string;
|
|
1658
|
+
readonly url: string | null;
|
|
1659
|
+
}): JSX.Element {
|
|
1660
|
+
if (!url) {
|
|
1661
|
+
return <span className="min-w-0 flex-1 truncate">{title}</span>;
|
|
1662
|
+
}
|
|
1663
|
+
return (
|
|
1664
|
+
<a
|
|
1665
|
+
href={url}
|
|
1666
|
+
target="_blank"
|
|
1667
|
+
rel="noreferrer"
|
|
1668
|
+
className="group/ext-link inline-flex min-w-0 flex-1 items-center gap-1 truncate text-foreground underline-offset-2 hover:underline"
|
|
1669
|
+
onPointerDown={(event) => event.stopPropagation()}
|
|
1670
|
+
onDoubleClick={(event) => event.stopPropagation()}
|
|
1671
|
+
onClick={(event) => event.stopPropagation()}
|
|
1672
|
+
>
|
|
1673
|
+
<span className="truncate">{title}</span>
|
|
1674
|
+
<HugeiconsIcon
|
|
1675
|
+
icon={LinkSquare02Icon}
|
|
1676
|
+
className="size-3 shrink-0 text-muted-foreground/50 group-hover/ext-link:text-muted-foreground"
|
|
1677
|
+
aria-hidden
|
|
1678
|
+
/>
|
|
1679
|
+
</a>
|
|
1680
|
+
);
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
function ExtensionIdChip({
|
|
1684
|
+
name,
|
|
1685
|
+
version,
|
|
1686
|
+
available,
|
|
1687
|
+
upgradeable,
|
|
1688
|
+
saving,
|
|
1689
|
+
onUpgrade,
|
|
1690
|
+
}: {
|
|
1691
|
+
readonly name: string;
|
|
1692
|
+
readonly version: string;
|
|
1693
|
+
readonly available: string;
|
|
1694
|
+
readonly upgradeable: boolean;
|
|
1695
|
+
readonly saving: boolean;
|
|
1696
|
+
readonly onUpgrade?: () => void;
|
|
1697
|
+
}): JSX.Element | null {
|
|
1698
|
+
if (!name && !version) return null;
|
|
1699
|
+
return (
|
|
1700
|
+
<span className="inline-flex h-5 shrink-0 items-stretch overflow-hidden rounded-md border border-border/60 bg-muted/25 font-mono text-[9px] leading-none">
|
|
1701
|
+
{name ? (
|
|
1702
|
+
<span className="inline-flex items-center px-1.5 text-muted-foreground">{name}</span>
|
|
1703
|
+
) : null}
|
|
1704
|
+
{name && version ? <span className="w-px self-stretch bg-border/60" aria-hidden /> : null}
|
|
1705
|
+
{version ? (
|
|
1706
|
+
<span className="inline-flex items-center bg-amber-500/10 px-1.5 font-semibold tabular-nums text-amber-800 dark:text-amber-300">
|
|
1707
|
+
v{version}
|
|
1708
|
+
</span>
|
|
1709
|
+
) : null}
|
|
1710
|
+
{upgradeable && available && onUpgrade ? (
|
|
1711
|
+
<>
|
|
1712
|
+
<span className="w-px self-stretch bg-border/60" aria-hidden />
|
|
1713
|
+
<button
|
|
1714
|
+
type="button"
|
|
1715
|
+
disabled={saving}
|
|
1716
|
+
title={`Upgrade to ${available}`}
|
|
1717
|
+
aria-label={`Upgrade ${name} from ${version} to ${available}`}
|
|
1718
|
+
className="inline-flex items-center bg-emerald-500/15 px-1.5 font-semibold tracking-wide text-emerald-800 uppercase hover:bg-emerald-500/25 disabled:opacity-50 dark:text-emerald-300"
|
|
1719
|
+
onPointerDown={(event) => event.stopPropagation()}
|
|
1720
|
+
onDoubleClick={(event) => event.stopPropagation()}
|
|
1721
|
+
onClick={(event) => {
|
|
1722
|
+
event.stopPropagation();
|
|
1723
|
+
if (!saving) onUpgrade();
|
|
1724
|
+
}}
|
|
1725
|
+
>
|
|
1726
|
+
Upgrade
|
|
1727
|
+
</button>
|
|
1728
|
+
</>
|
|
1729
|
+
) : null}
|
|
1730
|
+
</span>
|
|
1731
|
+
);
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1734
|
+
function SourceBadge({ value }: { readonly value: string }): JSX.Element {
|
|
1735
|
+
const library = value === "library";
|
|
1736
|
+
return (
|
|
1737
|
+
<Badge
|
|
1738
|
+
variant="outline"
|
|
1739
|
+
className={cn(
|
|
1740
|
+
"h-5 gap-1 rounded-md px-1.5 font-mono text-[9px] font-semibold tracking-wide uppercase",
|
|
1741
|
+
library
|
|
1742
|
+
? "border-sky-500/35 bg-sky-500/10 text-sky-800 dark:text-sky-300"
|
|
1743
|
+
: "border-border/60 bg-muted/40 text-muted-foreground",
|
|
1744
|
+
)}
|
|
1745
|
+
>
|
|
1746
|
+
<HugeiconsIcon icon={library ? PuzzleIcon : Database01Icon} className="size-3" aria-hidden />
|
|
1747
|
+
{library ? "Library" : "Builtin"}
|
|
1748
|
+
</Badge>
|
|
1749
|
+
);
|
|
1750
|
+
}
|
|
1751
|
+
|
|
1752
|
+
/** Trailing affordance that opens the JSON inspect sheet without starting an edit. */
|
|
1753
|
+
function JsonInspectButton({ onInspect }: { readonly onInspect: () => void }): JSX.Element {
|
|
1754
|
+
return (
|
|
1755
|
+
<Tooltip>
|
|
1756
|
+
<TooltipTrigger
|
|
1757
|
+
render={(props) => (
|
|
1758
|
+
<button
|
|
1759
|
+
{...props}
|
|
1760
|
+
type="button"
|
|
1761
|
+
aria-label="Open as table"
|
|
1762
|
+
data-slot="json-inspect"
|
|
1763
|
+
className={cn(
|
|
1764
|
+
"flex size-5 shrink-0 items-center justify-center rounded-sm text-muted-foreground/40",
|
|
1765
|
+
"group-hover/cell:text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
1766
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",
|
|
1767
|
+
)}
|
|
1768
|
+
onPointerDown={(event) => {
|
|
1769
|
+
event.stopPropagation();
|
|
1770
|
+
props.onPointerDown?.(event);
|
|
1771
|
+
}}
|
|
1772
|
+
onDoubleClick={(event) => event.stopPropagation()}
|
|
1773
|
+
onClick={(event) => {
|
|
1774
|
+
event.stopPropagation();
|
|
1775
|
+
props.onClick?.(event);
|
|
1776
|
+
onInspect();
|
|
1777
|
+
}}
|
|
1778
|
+
>
|
|
1779
|
+
<HugeiconsIcon icon={LeftToRightListBulletIcon} className="size-3" aria-hidden />
|
|
1780
|
+
</button>
|
|
1781
|
+
)}
|
|
1782
|
+
/>
|
|
1783
|
+
<TooltipContent side="left" className="text-[11px]">
|
|
1784
|
+
Open as table
|
|
1785
|
+
</TooltipContent>
|
|
1786
|
+
</Tooltip>
|
|
1787
|
+
);
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
/** Trigger a browser download for a UTF-8 text payload. */
|
|
1791
|
+
function downloadText(filename: string, text: string, mime: string): void {
|
|
1792
|
+
const blob = new Blob([text], { type: mime });
|
|
1793
|
+
const url = URL.createObjectURL(blob);
|
|
1794
|
+
const anchor = document.createElement("a");
|
|
1795
|
+
anchor.href = url;
|
|
1796
|
+
anchor.download = filename;
|
|
1797
|
+
anchor.click();
|
|
1798
|
+
URL.revokeObjectURL(url);
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
/** Icon-only toolbar control with a tooltip. */
|
|
1802
|
+
function GridIconButton({
|
|
1803
|
+
label,
|
|
1804
|
+
keys,
|
|
1805
|
+
disabled,
|
|
1806
|
+
onClick,
|
|
1807
|
+
slot,
|
|
1808
|
+
children,
|
|
1809
|
+
}: {
|
|
1810
|
+
readonly label: string;
|
|
1811
|
+
readonly keys?: readonly string[];
|
|
1812
|
+
readonly disabled?: boolean;
|
|
1813
|
+
readonly onClick: () => void;
|
|
1814
|
+
readonly slot: string;
|
|
1815
|
+
readonly children: ReactNode;
|
|
1816
|
+
}): JSX.Element {
|
|
1817
|
+
return (
|
|
1818
|
+
<Tooltip>
|
|
1819
|
+
<TooltipTrigger
|
|
1820
|
+
render={(props) => (
|
|
1821
|
+
<Button
|
|
1822
|
+
{...props}
|
|
1823
|
+
type="button"
|
|
1824
|
+
variant="ghost"
|
|
1825
|
+
size="icon-xs"
|
|
1826
|
+
aria-label={label}
|
|
1827
|
+
disabled={disabled}
|
|
1828
|
+
onClick={(event) => {
|
|
1829
|
+
props.onClick?.(event);
|
|
1830
|
+
onClick();
|
|
1831
|
+
}}
|
|
1832
|
+
data-slot={slot}
|
|
1833
|
+
>
|
|
1834
|
+
{children}
|
|
1835
|
+
</Button>
|
|
1836
|
+
)}
|
|
1837
|
+
/>
|
|
1838
|
+
<TooltipContent side="bottom" className="text-[11px]">
|
|
1839
|
+
{label}
|
|
1840
|
+
{keys && keys.length > 0 ? <ShortcutKeys keys={keys} /> : null}
|
|
1841
|
+
</TooltipContent>
|
|
1842
|
+
</Tooltip>
|
|
1843
|
+
);
|
|
1844
|
+
}
|