@coreframe/dashboard 0.2.26 → 0.2.28
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/README.md +51 -57
- package/dist/package/app/empty.d.ts +2 -0
- package/dist/package/app/empty.js +1 -0
- package/dist/package/app/entry.client.d.ts +1 -0
- package/dist/package/app/entry.client.js +1 -0
- package/dist/package/app/index-route.d.ts +4 -0
- package/dist/package/app/index-route.js +1 -0
- package/dist/package/app/index.d.ts +5 -0
- package/dist/package/app/index.js +1 -0
- package/dist/package/app/not-found.d.ts +4 -0
- package/dist/package/app/not-found.js +1 -0
- package/dist/package/app/root.d.ts +12 -0
- package/dist/package/app/root.js +1 -0
- package/dist/package/app/routes.d.ts +6 -0
- package/dist/package/app/routes.js +1 -0
- package/dist/package/app/shell.d.ts +7 -0
- package/dist/package/app/shell.js +1 -0
- package/dist/package/build.d.ts +71 -0
- package/dist/package/build.js +3 -0
- package/dist/package/config.d.ts +52 -0
- package/dist/package/config.js +1 -0
- package/dist/package/index.d.ts +3 -3
- package/dist/package/index.js +1 -1
- package/dist/package/plugin-api.d.ts +59 -0
- package/dist/package/plugin-api.js +1 -0
- package/dist/package/plugins/diagnostics/api/client.d.ts +27 -0
- package/dist/package/plugins/diagnostics/api/client.js +1 -0
- package/dist/package/plugins/diagnostics/api/handlers.d.ts +14 -0
- package/dist/package/plugins/diagnostics/api/handlers.js +1 -0
- package/dist/package/plugins/diagnostics/api/local.d.ts +7 -0
- package/dist/package/plugins/diagnostics/api/local.js +1 -0
- package/dist/package/plugins/diagnostics/api/routes.d.ts +12 -0
- package/dist/package/plugins/diagnostics/api/routes.js +1 -0
- package/dist/package/plugins/diagnostics/api/worker.d.ts +7 -0
- package/dist/package/plugins/diagnostics/api/worker.js +1 -0
- package/dist/package/plugins/diagnostics/index.d.ts +36 -0
- package/dist/package/plugins/diagnostics/index.js +1 -0
- package/dist/package/plugins/diagnostics/web/queries.js +1 -0
- package/dist/package/plugins/diagnostics/web.d.ts +4 -0
- package/dist/package/plugins/diagnostics/web.js +1 -0
- package/dist/package/server.d.ts +5 -3
- package/dist/package/server.js +1 -1
- package/dist/package/shell.css +270 -0
- package/dist/package/styled-css.js +1 -0
- package/dist/package/types.d.ts +13 -12
- package/dist/package/web/dashboard/dashboard-page.js +1 -0
- package/dist/package/web/dashboard/dashboard-section.js +1 -0
- package/dist/package/web/dashboard/dashboard.style.js +1 -0
- package/dist/package/web/dashboard/deployed-dashboard-page.js +1 -0
- package/dist/package/web/dashboard/findings.js +1 -0
- package/dist/package/web/dashboard/worker-environment.js +1 -0
- package/dist/package/web/root.style.js +1 -0
- package/dist/package/web/styled-system/css/conditions.js +1 -0
- package/dist/package/web/styled-system/css/css.js +1 -0
- package/dist/package/web/styled-system/helpers.js +1 -0
- package/dist/package/web-shell/index.d.ts +2 -0
- package/dist/package/web-shell/index.js +1 -0
- package/dist/package/web-shell/shell.d.ts +16 -0
- package/dist/package/web-shell/shell.js +1 -0
- package/dist/package/worker.d.ts +7 -2
- package/dist/package/worker.js +1 -1
- package/package.json +59 -17
- package/dist/client/assets/QueryClientProvider-BCOOhPXt.js +0 -1
- package/dist/client/assets/dashboard-Ceg12i4Z.js +0 -64
- package/dist/client/assets/entry.client-DhCu-K7v.js +0 -9
- package/dist/client/assets/errorBoundaries-Dn4hVn2U.js +0 -16
- package/dist/client/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/dist/client/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/dist/client/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/dist/client/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/dist/client/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/dist/client/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/dist/client/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/dist/client/assets/jsx-runtime-CuoEKysV.js +0 -1
- package/dist/client/assets/lib-DciQAlmZ.js +0 -1
- package/dist/client/assets/manifest-f5748478.js +0 -1
- package/dist/client/assets/not-found-WOdQxFoc.js +0 -1
- package/dist/client/assets/root-DY00TyFV.js +0 -1
- package/dist/client/assets/root-DdUbMn9I.css +0 -1
- package/dist/client/assets/root.style-DmKiRSsP.js +0 -1
- package/dist/client/index.html +0 -6
- package/dist/package/api/router.js +0 -1
- package/dist/package/api/routes/dashboard.js +0 -1
- package/dist/package/api/routes/health.js +0 -1
- package/dist/package/api/routes/index.js +0 -1
- package/dist/server/index.js +0 -1
package/README.md
CHANGED
|
@@ -1,81 +1,75 @@
|
|
|
1
1
|
# Coreframe Dashboard
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Reusable composition, shell, plugin, and authenticated runtime boundaries for an app-owned
|
|
4
|
+
Coreframe dashboard.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
Generated applications own a second client-only React Router application under `dashboard`. Coreframe
|
|
7
|
+
provides the document, client bootstrap, route tree, shell adapters, and virtual build modules; the
|
|
8
|
+
application keeps its plugin selection and pages. The normal `pnpm dev`, `pnpm typecheck`, `pnpm
|
|
9
|
+
build`, and `pnpm preview` workflows supervise, generate, and build that application. Its production
|
|
10
|
+
assets are merged into `dist/client/__dashboard` and remain mounted at `/__dashboard`.
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
pnpm dev
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Architecture
|
|
12
|
+
## Configuration and pages
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
server. This keeps the dashboard on the same local origin as the application and avoids a separate
|
|
17
|
-
dashboard process.
|
|
14
|
+
`dashboard/dashboard.config.ts` explicitly registers trusted build-time plugins:
|
|
18
15
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
component styling. The dashboard keeps its own configs and generated `styled-system` output; it
|
|
23
|
-
does not import files from `template/`.
|
|
16
|
+
```ts
|
|
17
|
+
import { defineDashboardConfig } from "@coreframe/dashboard/config"
|
|
18
|
+
import { diagnostics } from "@coreframe/dashboard/plugins/diagnostics"
|
|
24
19
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
The backend exposes these routes:
|
|
20
|
+
export default defineDashboardConfig({
|
|
21
|
+
plugins: [diagnostics()],
|
|
22
|
+
})
|
|
23
|
+
```
|
|
31
24
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
secret presence; secret values never enter the response.
|
|
35
|
-
- `GET /__dashboard` and other non-API dashboard paths serve the compiled browser client from
|
|
36
|
-
`dist/client`.
|
|
25
|
+
Removing `diagnostics()` removes both its page and its local and deployed API registrations. Plugins
|
|
26
|
+
are never discovered or installed at runtime.
|
|
37
27
|
|
|
38
|
-
|
|
39
|
-
|
|
28
|
+
Add app-owned routes at `dashboard/pages/<slug>/route.tsx`. An optional adjacent `page.yaml` may
|
|
29
|
+
define `title` and `description`. Build-time composition validates slugs, metadata, route modules,
|
|
30
|
+
identifiers, and paths before generating the React Router route tree and navigation manifest.
|
|
40
31
|
|
|
41
|
-
The
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
contains environment values. The shared Vite preset serves the Node-backed dashboard locally and
|
|
46
|
-
copies its compiled client into deployed static assets.
|
|
32
|
+
The generated dashboard does not need route adapters, a document root, a query-client module, or an
|
|
33
|
+
entry file. Keep those defaults in the package unless the dashboard build contract itself must
|
|
34
|
+
change. The dashboard is intentionally configured with `ssr: false` and does not prerender pages or
|
|
35
|
+
ship an app-owned server entry.
|
|
47
36
|
|
|
48
|
-
|
|
37
|
+
Projects can opt into app-owned customization without copying the default scaffold:
|
|
49
38
|
|
|
50
|
-
|
|
39
|
+
- `dashboard/document.tsx`, referenced as `document` in `dashboard.config.ts`, can provide a custom
|
|
40
|
+
document `Layout` and optional `links` or `meta` exports;
|
|
41
|
+
- `dashboard/styles.css` is loaded after the package stylesheet, while `panda.config.ts` remains the
|
|
42
|
+
theme and generated-style override; and
|
|
43
|
+
- `vite.config.ts` and `react-router.config.ts` remain small tool-level adapters for build changes.
|
|
51
44
|
|
|
52
|
-
|
|
53
|
-
pnpm --dir dashboard build
|
|
54
|
-
```
|
|
45
|
+
## Runtime boundaries
|
|
55
46
|
|
|
56
|
-
|
|
47
|
+
The app dashboard uses the same React, React Router framework mode, React Compiler, PandaCSS,
|
|
48
|
+
Sculpted, Rouzer, Zod, TanStack Query, and Worker conventions as the main Coreframe application.
|
|
49
|
+
Coreframe contributes the responsive navigation shell and default client/query runtime without
|
|
50
|
+
imposing a page-content component API.
|
|
57
51
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
52
|
+
Plugin APIs are read-only and namespaced under
|
|
53
|
+
`/__dashboard/api/plugins/<plugin-id>/`. Build tooling creates separate registries so Node-only local
|
|
54
|
+
capabilities cannot enter browser or Worker bundles. The local Vite host admits authorized localhost
|
|
55
|
+
hosts only. Deployed documents, assets, and APIs remain behind HTTP Basic authentication; credentials
|
|
56
|
+
are consumed by the host before dispatch and plugin capabilities receive only sanitized release,
|
|
57
|
+
configuration-presence, and link data.
|
|
61
58
|
|
|
62
|
-
|
|
59
|
+
## Built-in diagnostics
|
|
63
60
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
The diagnostics plugin preserves the full local production-readiness inspection and provides a
|
|
62
|
+
reduced deployed view. Its page is a normal route module and its browser data uses a typed Rouzer
|
|
63
|
+
client with TanStack Query. Local collection may use Node.js through its narrow capability; deployed
|
|
64
|
+
collection never receives ambient Worker bindings or raw configuration values.
|
|
67
65
|
|
|
68
66
|
Useful package checks:
|
|
69
67
|
|
|
70
68
|
```bash
|
|
71
|
-
pnpm --dir dashboard test
|
|
72
|
-
pnpm --dir dashboard typecheck
|
|
73
|
-
pnpm --dir dashboard lint
|
|
69
|
+
pnpm --dir node/dashboard test
|
|
70
|
+
pnpm --dir node/dashboard typecheck
|
|
71
|
+
pnpm --dir node/dashboard lint
|
|
72
|
+
pnpm --dir node/dashboard build
|
|
74
73
|
```
|
|
75
74
|
|
|
76
|
-
The dashboard is a focused path from a new Coreframe project to its first production app. It
|
|
77
|
-
summarizes human-owned launch decisions, local/runtime problems, copyable agent tasks and commands,
|
|
78
|
-
configured links, and Worker environment readiness. Tests, typechecks, and app processes remain
|
|
79
|
-
agent-owned workflows rather than browser controls.
|
|
80
|
-
|
|
81
75
|
Design notes live in [`design/`](./design/).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DashboardEmptyState as e}from"../web-shell/shell.js";import"../web-shell/index.js";export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{StrictMode as e,startTransition as t}from"react";import{jsx as n}from"react/jsx-runtime";import{hydrateRoot as r}from"react-dom/client";import{HydratedRouter as i}from"react-router/dom";t(()=>{r(document,n(e,{children:n(i,{})}))});export{};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DashboardIndexRedirect as e}from"../web-shell/shell.js";import"../web-shell/index.js";import{jsx as t}from"react/jsx-runtime";import{dashboardManifest as n}from"virtual:coreframe-dashboard-manifest";function r(){return t(e,{pages:n})}export{r as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{fileURLToPath as e}from"node:url";const t=e(new URL(`./`,import.meta.url));export{t as dashboardAppDirectory};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Link as e}from"react-router";import{jsx as t,jsxs as n}from"react/jsx-runtime";function r(){return n(`section`,{className:`coreframe-dashboard__state`,"aria-labelledby":`dashboard-not-found-title`,children:[t(`p`,{className:`coreframe-dashboard__eyebrow`,children:`Coreframe Dashboard`}),t(`h1`,{id:`dashboard-not-found-title`,children:`Page not found`}),t(`p`,{children:`The requested dashboard page does not exist.`}),t(e,{className:`coreframe-dashboard__button`,to:`/`,prefetch:`intent`,viewTransition:!0,children:`Go to dashboard`})]})}export{r as default};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/app/root.d.ts
|
|
3
|
+
declare function Layout({
|
|
4
|
+
children
|
|
5
|
+
}: {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}): import("react").JSX.Element;
|
|
8
|
+
declare const links: any;
|
|
9
|
+
declare const meta: any;
|
|
10
|
+
declare function Root(): import("react").JSX.Element;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { Layout, Root as default, links, meta };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Links as e,Meta as t,Outlet as n,Scripts as r,ScrollRestoration as i}from"react-router";import{jsx as a,jsxs as o}from"react/jsx-runtime";import{QueryClient as s,QueryClientProvider as c}from"@tanstack/react-query";import*as l from"virtual:coreframe-dashboard-document";import"virtual:coreframe-dashboard-styles";const u=new s({defaultOptions:{queries:{retry:1,staleTime:3e4}}});function d({children:n}){let s=l.Layout,d=a(c,{client:u,children:n});return s?a(s,{children:d}):o(`html`,{lang:`en`,children:[o(`head`,{children:[a(`meta`,{charSet:`UTF-8`}),a(`meta`,{name:`viewport`,content:`width=device-width, initial-scale=1`}),a(`title`,{children:`Coreframe Dashboard`}),a(t,{}),a(e,{})]}),o(`body`,{children:[d,a(i,{}),a(r,{})]})]})}const f=l.links,p=l.meta;function m(){let e=l.default;return a(e||n,{})}export{d as Layout,m as default,f as links,p as meta};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{composeDashboardManifest as e,composeDashboardRoutes as t,discoverDashboardPages as n,resolveDashboardRouteModules as r}from"../build.js";import{join as i,resolve as a}from"node:path";import{fileURLToPath as o,pathToFileURL as s}from"node:url";const c=process.cwd(),l=a(c,`..`),u=r(e((await import(s(i(c,`dashboard.config.ts`)).href)).default,await n({dashboardDirectory:c}),{environment:process.env.DEPLOY_ENV?`deployed`:`local`}),{dashboardDirectory:c,projectRoot:l}),d=e=>o(new URL(`./${e}.js`,import.meta.url));var f=t(u,{shellRoute:d(`shell`),indexRoute:d(`index-route`),emptyRoute:d(`empty`),notFoundRoute:d(`not-found`)});export{f as default};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DashboardErrorBoundary } from "../web-shell/shell.js";
|
|
2
|
+
|
|
3
|
+
//#region src/app/shell.d.ts
|
|
4
|
+
declare const ErrorBoundary: typeof DashboardErrorBoundary;
|
|
5
|
+
declare function Shell(): import("react").JSX.Element;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { ErrorBoundary, Shell as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DashboardErrorBoundary as e,DashboardShell as t}from"../web-shell/shell.js";import"../web-shell/index.js";import{jsx as n}from"react/jsx-runtime";import{dashboardManifest as r}from"virtual:coreframe-dashboard-manifest";const i=e;function a(){return n(t,{pages:r})}export{i as ErrorBoundary,a as default};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { DashboardConfig, DashboardEnvironment, DashboardPageContribution, DashboardPageManifestEntry } from "./config.js";
|
|
2
|
+
|
|
3
|
+
//#region src/build.d.ts
|
|
4
|
+
interface DiscoverDashboardPagesOptions {
|
|
5
|
+
/** App-owned dashboard directory. Defaults to `<cwd>/dashboard`. */
|
|
6
|
+
dashboardDirectory?: string;
|
|
7
|
+
}
|
|
8
|
+
interface ComposeDashboardManifestOptions {
|
|
9
|
+
environment?: DashboardEnvironment;
|
|
10
|
+
}
|
|
11
|
+
interface DashboardRouteCompositionOptions {
|
|
12
|
+
/** App-owned route module that renders `DashboardShell`. */
|
|
13
|
+
shellRoute: string;
|
|
14
|
+
/** App-owned index route that redirects to the manifest's first page. */
|
|
15
|
+
indexRoute: string;
|
|
16
|
+
/** App-owned route shown when the manifest has no pages. */
|
|
17
|
+
emptyRoute: string;
|
|
18
|
+
/** Optional app-owned catch-all route. */
|
|
19
|
+
notFoundRoute?: string;
|
|
20
|
+
}
|
|
21
|
+
interface ResolveDashboardRouteModulesOptions {
|
|
22
|
+
/** App-owned dashboard directory containing `dashboard.config.ts` and `pages/`. */
|
|
23
|
+
dashboardDirectory?: string;
|
|
24
|
+
/** Project root used to resolve package-owned plugin route modules. */
|
|
25
|
+
projectRoot?: string;
|
|
26
|
+
}
|
|
27
|
+
/** Structural subset accepted by React Router's framework `RouteConfig`. */
|
|
28
|
+
interface DashboardRouteConfigEntry {
|
|
29
|
+
id?: string;
|
|
30
|
+
path?: string;
|
|
31
|
+
index?: boolean;
|
|
32
|
+
file: string;
|
|
33
|
+
children?: DashboardRouteConfigEntry[];
|
|
34
|
+
}
|
|
35
|
+
type DashboardApiRegistryTarget = "browser" | "local" | "worker";
|
|
36
|
+
interface DashboardBrowserApiRegistryEntry {
|
|
37
|
+
pluginId: string;
|
|
38
|
+
routesModule: string;
|
|
39
|
+
}
|
|
40
|
+
interface DashboardRuntimeApiRegistryEntry extends DashboardBrowserApiRegistryEntry {
|
|
41
|
+
handlersModule: string;
|
|
42
|
+
capabilityModule: string;
|
|
43
|
+
}
|
|
44
|
+
interface DashboardApiRegistries {
|
|
45
|
+
browser: DashboardBrowserApiRegistryEntry[];
|
|
46
|
+
local: DashboardRuntimeApiRegistryEntry[];
|
|
47
|
+
worker: DashboardRuntimeApiRegistryEntry[];
|
|
48
|
+
}
|
|
49
|
+
/** Discovers immediate `pages/<slug>/route.tsx` app contributions. */
|
|
50
|
+
declare function discoverDashboardPages(options?: DiscoverDashboardPagesOptions): Promise<DashboardPageContribution[]>;
|
|
51
|
+
/** Normalizes plugin and app contributions into deterministic navigation order. */
|
|
52
|
+
declare function composeDashboardManifest(config: DashboardConfig, appPages: readonly DashboardPageContribution[], options?: ComposeDashboardManifestOptions): DashboardPageManifestEntry[];
|
|
53
|
+
/** Creates import-only registries so target-specific capability modules cannot cross bundles. */
|
|
54
|
+
declare function composeDashboardApiRegistries(config: DashboardConfig): DashboardApiRegistries;
|
|
55
|
+
/** Renders a virtual module for exactly one dashboard API target. */
|
|
56
|
+
declare function renderDashboardApiRegistryModule(entries: readonly (DashboardBrowserApiRegistryEntry | DashboardRuntimeApiRegistryEntry)[], target: DashboardApiRegistryTarget): string;
|
|
57
|
+
/**
|
|
58
|
+
* Creates ordinary React Router framework-mode route config for an app-owned dashboard. All file
|
|
59
|
+
* references remain app-controlled route modules.
|
|
60
|
+
*/
|
|
61
|
+
declare function composeDashboardRoutes(pages: readonly DashboardPageManifestEntry[], options: DashboardRouteCompositionOptions): DashboardRouteConfigEntry[];
|
|
62
|
+
/** Resolves manifest route references to files that React Router can import from its route graph. */
|
|
63
|
+
declare function resolveDashboardRouteModules(pages: readonly DashboardPageManifestEntry[], options?: ResolveDashboardRouteModulesOptions): DashboardPageManifestEntry[];
|
|
64
|
+
/** Resolves a dashboard module from the app directory or the project's installed packages. */
|
|
65
|
+
declare function resolveDashboardModuleReference(moduleReference: string, options?: ResolveDashboardRouteModulesOptions): string;
|
|
66
|
+
declare class DashboardCompositionError extends Error {
|
|
67
|
+
readonly file: string;
|
|
68
|
+
constructor(file: string, message: string, cause?: unknown);
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
export { ComposeDashboardManifestOptions, DashboardApiRegistries, DashboardApiRegistryTarget, DashboardBrowserApiRegistryEntry, DashboardCompositionError, type DashboardPageManifestEntry, DashboardRouteCompositionOptions, DashboardRouteConfigEntry, DashboardRuntimeApiRegistryEntry, DiscoverDashboardPagesOptions, ResolveDashboardRouteModulesOptions, composeDashboardApiRegistries, composeDashboardManifest, composeDashboardRoutes, discoverDashboardPages, renderDashboardApiRegistryModule, resolveDashboardModuleReference, resolveDashboardRouteModules };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{createRequire as e}from"node:module";import{readFile as t,readdir as n}from"node:fs/promises";import{isAbsolute as r,join as i,resolve as a}from"node:path";import{parseDocument as o}from"yaml";import{z as s}from"zod";const c=/^[a-z0-9]+(?:-[a-z0-9]+)*$/u,l=s.object({title:s.string().trim().min(1,`title must not be empty`).optional(),description:s.string().trim().min(1,`description must not be empty`).optional()}).strict(),u=s.object({id:s.string(),path:s.string(),title:s.string(),description:s.string().optional(),routeModule:s.string(),environments:s.array(s.enum([`local`,`deployed`])).optional()}).strict(),d=s.string().trim().min(1,`module reference must not be empty`),f=s.object({routesModule:d,handlersModule:d,localCapabilityModule:d.optional(),workerCapabilityModule:d.optional()}).strict().refine(e=>e.localCapabilityModule!==void 0||e.workerCapabilityModule!==void 0,`an API must provide a localCapabilityModule, workerCapabilityModule, or both`),p=s.object({document:d.optional(),plugins:s.array(s.object({id:s.string(),pages:s.array(u).optional(),api:f.optional()}).strict()).optional()}).strict();async function m(e={}){let r=i(a(e.dashboardDirectory??i(process.cwd(),`dashboard`)),`pages`),o;try{o=await n(r,{withFileTypes:!0})}catch(e){if(A(e)&&e.code===`ENOENT`)return[];throw new x(r,`could not read the pages directory`,e)}let s=o.filter(e=>e.isDirectory()&&!e.name.startsWith(`.`)).sort((e,t)=>k(e.name,t.name));return Promise.all(s.map(async({name:e})=>{let n=i(r,e);D(e,n,`page directory`);let a=i(n,`route.tsx`);try{await t(a)}catch(e){throw A(e)&&e.code===`ENOENT`?new x(a,`missing required React Router route.tsx`):new x(a,`could not read route.tsx`,e)}let o=await S(i(n,`page.yaml`));return{id:e,path:e,title:o?.title??O(e),...o?.description?{description:o.description}:{},routeModule:`pages/${e}/route.tsx`}}))}function h(e,t,n={}){let r=n.environment??`local`,i=new Set,a=[],o=E(e);for(let e of o.plugins??[]){if(D(e.id,`dashboard.config.ts plugin "${e.id}"`,`plugin id`),i.has(e.id))throw new x(`dashboard.config.ts`,`duplicate plugin id "${e.id}"`);i.add(e.id);for(let t of e.pages??[]){let n=C(t,`plugin`,e.id);T(t,r,e)&&a.push(n)}}let s=t.map(e=>({page:e,normalizedPage:C(e,`app`)})).sort((e,t)=>k(e.normalizedPage.path,t.normalizedPage.path));for(let{page:e,normalizedPage:t}of s)T(e,r)&&a.push(t);return w(a),a}function g(e){let t=E(e),n=new Set,r={browser:[],local:[],worker:[]};for(let e of t.plugins??[]){if(D(e.id,`dashboard.config.ts plugin "${e.id}"`,`plugin id`),n.has(e.id))throw new x(`dashboard.config.ts`,`duplicate plugin id "${e.id}"`);if(n.add(e.id),!e.api)continue;let t={pluginId:e.id,routesModule:e.api.routesModule};r.browser.push(t),e.api.localCapabilityModule&&r.local.push({...t,handlersModule:e.api.handlersModule,capabilityModule:e.api.localCapabilityModule}),e.api.workerCapabilityModule&&r.worker.push({...t,handlersModule:e.api.handlersModule,capabilityModule:e.api.workerCapabilityModule})}return r}function _(e,t){let n=[],r=[];for(let[i,a]of e.entries()){if(n.push(`import { routes as routes${i} } from ${JSON.stringify(a.routesModule)}`),t===`browser`){r.push(`{ pluginId: ${JSON.stringify(a.pluginId)}, routes: routes${i} }`);continue}if(!(`handlersModule`in a)||!(`capabilityModule`in a))throw new x(`dashboard API registry`,`${t} registry entry "${a.pluginId}" is missing runtime modules`);n.push(`import { createHandlers as createHandlers${i} } from ${JSON.stringify(a.handlersModule)}`,`import { createCapability as createCapability${i} } from ${JSON.stringify(a.capabilityModule)}`),r.push(`{ pluginId: ${JSON.stringify(a.pluginId)}, routes: routes${i}, createHandlers: createHandlers${i}, createCapability: createCapability${i} }`)}let i=t===`browser`?`dashboardBrowserApiRegistry`:`dashboardPluginApiRegistry`;return`${n.join(`
|
|
2
|
+
`)}\n\nexport const ${i} = [\n${r.map(e=>` ${e},`).join(`
|
|
3
|
+
`)}\n]\n`}function v(e,t){let n=[e.length>0?{index:!0,file:t.indexRoute}:{index:!0,file:t.emptyRoute},...e.map(e=>({id:`dashboard-page-${e.id}`,path:e.path,file:e.routeModule})),...t.notFoundRoute?[{path:`*`,file:t.notFoundRoute}]:[]];return[{id:`dashboard-shell`,file:t.shellRoute,children:n}]}function y(e,t={}){let n=a(t.dashboardDirectory??i(process.cwd(),`dashboard`));return e.map(e=>({...e,routeModule:e.source===`app`?a(n,e.routeModule):b(e.routeModule,t)}))}function b(t,n={}){let o=a(n.dashboardDirectory??i(process.cwd(),`dashboard`)),s=e(i(a(n.projectRoot??i(o,`..`)),`package.json`));if(r(t)||t.startsWith(`.`))return a(o,t);try{return s.resolve(t)}catch(e){throw new x(t,`could not resolve dashboard module`,e)}}var x=class extends Error{file;constructor(e,t,n){super(`${e}: ${t}`,{cause:n}),this.name=`DashboardCompositionError`,this.file=e}};async function S(e){let n;try{n=await t(e,`utf8`)}catch(t){if(A(t)&&t.code===`ENOENT`)return;throw new x(e,`could not read page metadata`,t)}let r=o(n,{prettyErrors:!0,strict:!0,uniqueKeys:!0});if(r.errors.length>0)throw new x(e,r.errors[0]?.message??`invalid YAML`);let i=l.safeParse(r.toJS());if(!i.success)throw new x(e,s.prettifyError(i.error));return i.data}function C(e,t,n){let r=t===`plugin`?`dashboard.config.ts plugin "${n??`unknown`}" page "${e.id}"`:e.routeModule,i=u.safeParse(e);if(!i.success)throw new x(r,s.prettifyError(i.error));let a=i.data;D(a.id,r,`page id`),D(a.path,r,`page path`);let o=a.title.trim();if(!o)throw new x(r,`page title must not be empty`);if(!a.routeModule.trim())throw new x(r,`page routeModule must not be empty`);let c=a.description?.trim();if(a.description!==void 0&&!c)throw new x(r,`page description must not be empty`);return{id:a.id,path:a.path,title:o,...c?{description:c}:{},routeModule:a.routeModule,source:t,...n?{pluginId:n}:{}}}function w(e){let t=new Map,n=new Map;for(let r of e){let e=t.get(r.id);if(e)throw new x(r.routeModule,`duplicate page id "${r.id}" also contributed by ${e.routeModule}`);t.set(r.id,r);let i=n.get(r.path);if(i)throw new x(r.routeModule,`duplicate page path "${r.path}" also contributed by ${i.routeModule}`);n.set(r.path,r)}}function T(e,t,n){return e.environments?e.environments.includes(t):!(t===`deployed`&&n?.api&&!n.api.workerCapabilityModule)}function E(e){let t=p.safeParse(e);if(!t.success)throw new x(`dashboard.config.ts`,s.prettifyError(t.error));return t.data}function D(e,t,n){if(!c.test(e))throw new x(t,`${n} "${e}" must contain only lowercase letters, numbers, and single hyphens`)}function O(e){let t=e.split(`-`).join(` `);return`${t.charAt(0).toUpperCase()}${t.slice(1)}`}function k(e,t){return e<t?-1:+(e>t)}function A(e){return e instanceof Error&&`code`in e}export{x as DashboardCompositionError,g as composeDashboardApiRegistries,h as composeDashboardManifest,v as composeDashboardRoutes,m as discoverDashboardPages,_ as renderDashboardApiRegistryModule,b as resolveDashboardModuleReference,y as resolveDashboardRouteModules};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//#region src/config.d.ts
|
|
2
|
+
type DashboardEnvironment = "local" | "deployed";
|
|
3
|
+
interface DashboardPageContribution {
|
|
4
|
+
/** Stable page identity. It must be a lowercase, URL-safe slug. */
|
|
5
|
+
id: string;
|
|
6
|
+
/** Top-level URL segment below `/__dashboard/`. */
|
|
7
|
+
path: string;
|
|
8
|
+
title: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
/** React Router framework route module, resolved by the dashboard build. */
|
|
11
|
+
routeModule: string;
|
|
12
|
+
/** Environments where the page can be included. Defaults to both. */
|
|
13
|
+
environments?: readonly DashboardEnvironment[];
|
|
14
|
+
}
|
|
15
|
+
interface DashboardPluginApiContribution {
|
|
16
|
+
/** Shared Rouzer route tree imported by browser, local, and Worker targets. */
|
|
17
|
+
routesModule: string;
|
|
18
|
+
/** Runtime-neutral handler factory imported only by API targets. */
|
|
19
|
+
handlersModule: string;
|
|
20
|
+
/** Node.js capability factory imported only by the local API target. */
|
|
21
|
+
localCapabilityModule?: string;
|
|
22
|
+
/** Worker-safe capability factory imported only by the deployed API target. */
|
|
23
|
+
workerCapabilityModule?: string;
|
|
24
|
+
}
|
|
25
|
+
interface DashboardPlugin {
|
|
26
|
+
/** Stable plugin identity. It must be a lowercase, URL-safe slug. */
|
|
27
|
+
id: string;
|
|
28
|
+
pages?: readonly DashboardPageContribution[];
|
|
29
|
+
/** Optional read-only API mounted below `/__dashboard/api/plugins/<id>/`. */
|
|
30
|
+
api?: DashboardPluginApiContribution;
|
|
31
|
+
}
|
|
32
|
+
interface DashboardConfig {
|
|
33
|
+
plugins?: readonly DashboardPlugin[];
|
|
34
|
+
/** Optional app-owned document module that overrides the default dashboard document. */
|
|
35
|
+
document?: string;
|
|
36
|
+
}
|
|
37
|
+
/** Validated page metadata shared by build-time composition and the browser shell. */
|
|
38
|
+
interface DashboardPageManifestEntry {
|
|
39
|
+
id: string;
|
|
40
|
+
path: string;
|
|
41
|
+
title: string;
|
|
42
|
+
description?: string;
|
|
43
|
+
routeModule: string;
|
|
44
|
+
source: "app" | "plugin";
|
|
45
|
+
pluginId?: string;
|
|
46
|
+
}
|
|
47
|
+
/** Defines trusted dashboard composition evaluated by Coreframe at development and build time. */
|
|
48
|
+
declare function defineDashboardConfig<const Config extends DashboardConfig>(config: Config): Config;
|
|
49
|
+
/** Defines a reusable, build-time dashboard contribution. */
|
|
50
|
+
declare function defineDashboardPlugin<const Plugin extends DashboardPlugin>(plugin: Plugin): Plugin;
|
|
51
|
+
//#endregion
|
|
52
|
+
export { DashboardConfig, DashboardEnvironment, DashboardPageContribution, DashboardPageManifestEntry, DashboardPlugin, DashboardPluginApiContribution, defineDashboardConfig, defineDashboardPlugin };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){return e}function t(e){return e}export{e as defineDashboardConfig,t as defineDashboardPlugin};
|
package/dist/package/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export { type DashboardPayload, type DashboardRequestHandler, type DashboardServerOptions, type DeployedDashboardPayload, createDashboardRequestHandler, createDashboardServer
|
|
1
|
+
import { DashboardPayload, DashboardReleaseIdentity, DeployedDashboardPayload } from "./types.js";
|
|
2
|
+
import { DashboardRequestHandler, DashboardServerOptions, createDashboardRequestHandler, createDashboardServer } from "./server.js";
|
|
3
|
+
export { type DashboardPayload, type DashboardReleaseIdentity, type DashboardRequestHandler, type DashboardServerOptions, type DeployedDashboardPayload, createDashboardRequestHandler, createDashboardServer };
|
package/dist/package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createDashboardRequestHandler as e,createDashboardServer as t
|
|
1
|
+
import{createDashboardRequestHandler as e,createDashboardServer as t}from"./server.js";export{e as createDashboardRequestHandler,t as createDashboardServer};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { DashboardLink, DashboardReleaseIdentity, DeployedConfigurationEntry } from "./types.js";
|
|
2
|
+
import { RouteRequestHandlerMap, Router } from "rouzer";
|
|
3
|
+
import { HttpRouteTree } from "rouzer/http";
|
|
4
|
+
|
|
5
|
+
//#region src/plugin-api.d.ts
|
|
6
|
+
interface DashboardLocalCapabilityContext {
|
|
7
|
+
/** Root of the application the local dashboard is inspecting. */
|
|
8
|
+
projectRoot: string;
|
|
9
|
+
}
|
|
10
|
+
interface DashboardWorkerCapabilityContext {
|
|
11
|
+
/** Deployment tier selected by the Coreframe Worker host. */
|
|
12
|
+
environment: "production" | "staging";
|
|
13
|
+
/** Release identity deliberately derived by the authenticated dashboard host. */
|
|
14
|
+
release: DashboardReleaseIdentity;
|
|
15
|
+
/** Configuration names and presence only; never raw binding values. */
|
|
16
|
+
configuration: readonly DeployedConfigurationEntry[];
|
|
17
|
+
/** Non-secret links deliberately derived by the dashboard host. */
|
|
18
|
+
links: readonly DashboardLink[];
|
|
19
|
+
}
|
|
20
|
+
type DashboardPluginCapabilityFactory<Context, Capability> = (context: Readonly<Context>) => Capability | Promise<Capability>;
|
|
21
|
+
type DashboardPluginApiHandlersFactory<Routes extends HttpRouteTree, Capability> = (capability: Capability) => RouteRequestHandlerMap<Routes, Router>;
|
|
22
|
+
interface DashboardPluginApiRegistration<Context = unknown> {
|
|
23
|
+
pluginId: string;
|
|
24
|
+
routes: HttpRouteTree;
|
|
25
|
+
createHandlers: (capability: never) => RouteRequestHandlerMap<HttpRouteTree, Router>;
|
|
26
|
+
createCapability: DashboardPluginCapabilityFactory<Context, unknown>;
|
|
27
|
+
}
|
|
28
|
+
interface DashboardPluginApiHandlerOptions<Context> {
|
|
29
|
+
context: Readonly<Context>;
|
|
30
|
+
onError?: (pluginId: string, error: unknown) => void;
|
|
31
|
+
}
|
|
32
|
+
/** Preserves Rouzer handler-map inference while injecting one narrow capability object. */
|
|
33
|
+
declare function defineDashboardPluginApiHandlers<const Routes extends HttpRouteTree, Capability>(createHandlers: DashboardPluginApiHandlersFactory<Routes, Capability>): DashboardPluginApiHandlersFactory<Routes, Capability>;
|
|
34
|
+
/** Defines a target-specific capability factory without widening its host context. */
|
|
35
|
+
declare function defineDashboardPluginCapability<Context, Capability>(createCapability: DashboardPluginCapabilityFactory<Context, Capability>): DashboardPluginCapabilityFactory<Context, Capability>;
|
|
36
|
+
/** Creates the normal typed Rouzer browser client for one namespaced plugin route tree. */
|
|
37
|
+
declare function createDashboardPluginApiClient<const Routes extends HttpRouteTree>(options: {
|
|
38
|
+
pluginId: string;
|
|
39
|
+
routes: Routes;
|
|
40
|
+
baseURL?: string;
|
|
41
|
+
fetch?: typeof fetch;
|
|
42
|
+
}): import("rouzer").ClientTree<Routes, ""> & {
|
|
43
|
+
clientConfig: {
|
|
44
|
+
baseURL: string;
|
|
45
|
+
headers?: Record<string, string>;
|
|
46
|
+
routes: Routes;
|
|
47
|
+
plugins?: readonly import("rouzer").ClientResponsePlugin[];
|
|
48
|
+
onJsonError?: (response: Response) => unknown;
|
|
49
|
+
fetch?: typeof globalThis.fetch;
|
|
50
|
+
clientHook?: import("rouzer").RouzerClientHook;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Composes target-loaded plugin registrations behind one read-only Fetch boundary. Authentication
|
|
55
|
+
* remains the responsibility of the local or Worker host that invokes this handler.
|
|
56
|
+
*/
|
|
57
|
+
declare function createDashboardPluginApiFetchHandler<Context>(registrations: readonly DashboardPluginApiRegistration<Context>[], options: DashboardPluginApiHandlerOptions<Context>): (request: Request) => Promise<Response>;
|
|
58
|
+
//#endregion
|
|
59
|
+
export { DashboardLocalCapabilityContext, DashboardPluginApiHandlerOptions, DashboardPluginApiHandlersFactory, DashboardPluginApiRegistration, DashboardPluginCapabilityFactory, DashboardWorkerCapabilityContext, createDashboardPluginApiClient, createDashboardPluginApiFetchHandler, defineDashboardPluginApiHandlers, defineDashboardPluginCapability };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createClient as e,createRouter as t,toFetchHandler as n}from"rouzer";const r=`/__dashboard/api/plugins`,i=/^[a-z0-9]+(?:-[a-z0-9]+)*$/u;function a(e){return e}function o(e){return e}function s(t){return f(t.pluginId),e({baseURL:t.baseURL??new URL(`${r}/${t.pluginId}/`,globalThis.location?.origin).href,headers:{"content-type":`application/json`},onJsonError:m,routes:t.routes,fetch:t.fetch})}function c(e,t){let n=new Map;for(let r of e){if(f(r.pluginId),n.has(r.pluginId))throw Error(`Duplicate dashboard API plugin id "${r.pluginId}".`);n.set(r.pluginId,l(r,t))}return async e=>{let t=u(new URL(e.url).pathname),r=t?n.get(t):void 0;return r?e.method!==`GET`&&e.method!==`HEAD`?p({error:`Method not allowed`},405,{allow:`GET, HEAD`}):r.handle(d(e)):p({error:`Not found`},404)}}function l(e,i){let a;return{async handle(o){try{return a??=Promise.resolve(e.createCapability(i.context)).then(i=>{let a=e.createHandlers(i);return n(t({basePath:`${r}/${e.pluginId}/`}).use(e.routes,a))}),await(await a)(o)}catch(t){return i.onError?.(e.pluginId,t),p({error:`Plugin unavailable`},503)}}}}function u(e){if(!e.startsWith(`${r}/`))return;let t=e.slice(25),n=t.indexOf(`/`);return n>0?t.slice(0,n):void 0}function d(e){let t=new Headers(e.headers);return t.delete(`authorization`),t.delete(`cookie`),t.delete(`cf-access-jwt-assertion`),new Request(e,{headers:t})}function f(e){if(!i.test(e))throw Error(`Dashboard API plugin id "${e}" must contain only lowercase letters, numbers, and single hyphens.`)}function p(e,t,n){return Response.json(e,{headers:{"cache-control":`no-store`,...Object.fromEntries(new Headers(n))},status:t})}async function m(e){let t=Error(`Request failed with status ${e.status}.`);throw e.headers.get(`content-type`)?.includes(`application/json`)&&Object.assign(t,await e.json()),t.status=e.status,t}export{s as createDashboardPluginApiClient,c as createDashboardPluginApiFetchHandler,a as defineDashboardPluginApiHandlers,o as defineDashboardPluginCapability};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DashboardPayload } from "../../../types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/plugins/diagnostics/api/client.d.ts
|
|
4
|
+
declare function createDiagnosticsApiClient(options?: {
|
|
5
|
+
baseURL?: string;
|
|
6
|
+
fetch?: typeof fetch;
|
|
7
|
+
}): import("rouzer").ClientTree<{
|
|
8
|
+
dashboard: import("rouzer/http").HttpAction<"dashboard", {
|
|
9
|
+
readonly response: import("rouzer").Unchecked<DashboardPayload>;
|
|
10
|
+
}, "GET">;
|
|
11
|
+
}, ""> & {
|
|
12
|
+
clientConfig: {
|
|
13
|
+
baseURL: string;
|
|
14
|
+
headers?: Record<string, string>;
|
|
15
|
+
routes: {
|
|
16
|
+
dashboard: import("rouzer/http").HttpAction<"dashboard", {
|
|
17
|
+
readonly response: import("rouzer").Unchecked<DashboardPayload>;
|
|
18
|
+
}, "GET">;
|
|
19
|
+
};
|
|
20
|
+
plugins?: readonly import("rouzer").ClientResponsePlugin[];
|
|
21
|
+
onJsonError?: (response: Response) => unknown;
|
|
22
|
+
fetch?: typeof globalThis.fetch;
|
|
23
|
+
clientHook?: import("rouzer").RouzerClientHook;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
export { createDiagnosticsApiClient };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createDashboardPluginApiClient as e}from"../../../plugin-api.js";import{routes as t}from"./routes.js";function n(n={}){return e({pluginId:`diagnostics`,routes:t,...n})}export{n as createDiagnosticsApiClient};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DashboardPayload } from "../../../types.js";
|
|
2
|
+
import { DashboardPluginApiHandlersFactory } from "../../../plugin-api.js";
|
|
3
|
+
|
|
4
|
+
//#region src/plugins/diagnostics/api/handlers.d.ts
|
|
5
|
+
interface DiagnosticsCapability {
|
|
6
|
+
collect(): DashboardPayload | Promise<DashboardPayload>;
|
|
7
|
+
}
|
|
8
|
+
declare const createHandlers: DashboardPluginApiHandlersFactory<{
|
|
9
|
+
dashboard: import("rouzer/http").HttpAction<"dashboard", {
|
|
10
|
+
readonly response: import("rouzer").Unchecked<DashboardPayload>;
|
|
11
|
+
}, "GET">;
|
|
12
|
+
}, DiagnosticsCapability>;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { DiagnosticsCapability, createHandlers };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{defineDashboardPluginApiHandlers as e}from"../../../plugin-api.js";const t=e(e=>({dashboard(){return e.collect()}}));export{t as createHandlers};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DashboardLocalCapabilityContext } from "../../../plugin-api.js";
|
|
2
|
+
import { DiagnosticsCapability } from "./handlers.js";
|
|
3
|
+
|
|
4
|
+
//#region src/plugins/diagnostics/api/local.d.ts
|
|
5
|
+
declare function createCapability(context: DashboardLocalCapabilityContext): DiagnosticsCapability;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { createCapability };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{inspectWorkerEnvironment as e}from"@coreframe/deploy";import{runDiagnostics as t}from"@coreframe/diagnostics";function n(n){return{async collect(){let[r,i]=await Promise.all([t({projectRoot:n.projectRoot,environment:`development`,env:process.env}),e({cwd:n.projectRoot})]);return{mode:`local`,diagnostics:r,workerEnvironment:i}}}}export{n as createCapability};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DashboardPayload } from "../../../types.js";
|
|
2
|
+
import * as http from "rouzer/http";
|
|
3
|
+
|
|
4
|
+
//#region src/plugins/diagnostics/api/routes.d.ts
|
|
5
|
+
declare const routes: {
|
|
6
|
+
dashboard: http.HttpAction<"dashboard", {
|
|
7
|
+
readonly response: import("rouzer").Unchecked<DashboardPayload>;
|
|
8
|
+
}, "GET">;
|
|
9
|
+
};
|
|
10
|
+
type DiagnosticsRoutes = typeof routes;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { DiagnosticsRoutes, routes };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$type as e}from"rouzer";import*as t from"rouzer/http";const n={dashboard:t.get(`dashboard`,{response:e()})};export{n as routes};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DashboardWorkerCapabilityContext } from "../../../plugin-api.js";
|
|
2
|
+
import { DiagnosticsCapability } from "./handlers.js";
|
|
3
|
+
|
|
4
|
+
//#region src/plugins/diagnostics/api/worker.d.ts
|
|
5
|
+
declare function createCapability(context: DashboardWorkerCapabilityContext): DiagnosticsCapability;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { createCapability };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){return{collect(){return{mode:`deployed`,environment:e.environment,release:e.release,configuration:[...e.configuration],links:[...e.links]}}}}export{e as createCapability};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
//#region src/plugins/diagnostics/index.d.ts
|
|
2
|
+
declare const diagnosticsPlugin: {
|
|
3
|
+
readonly id: "diagnostics";
|
|
4
|
+
readonly pages: readonly [{
|
|
5
|
+
readonly id: "diagnostics";
|
|
6
|
+
readonly path: "diagnostics";
|
|
7
|
+
readonly title: "Production readiness";
|
|
8
|
+
readonly description: "Review launch readiness, deployment configuration, and project health.";
|
|
9
|
+
readonly routeModule: "@coreframe/dashboard/plugins/diagnostics/web";
|
|
10
|
+
}];
|
|
11
|
+
readonly api: {
|
|
12
|
+
readonly routesModule: "@coreframe/dashboard/plugins/diagnostics/api/routes";
|
|
13
|
+
readonly handlersModule: "@coreframe/dashboard/plugins/diagnostics/api/handlers";
|
|
14
|
+
readonly localCapabilityModule: "@coreframe/dashboard/plugins/diagnostics/api/local";
|
|
15
|
+
readonly workerCapabilityModule: "@coreframe/dashboard/plugins/diagnostics/api/worker";
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
/** Registers Coreframe's built-in production-readiness dashboard. */
|
|
19
|
+
declare function diagnostics(): {
|
|
20
|
+
readonly id: "diagnostics";
|
|
21
|
+
readonly pages: readonly [{
|
|
22
|
+
readonly id: "diagnostics";
|
|
23
|
+
readonly path: "diagnostics";
|
|
24
|
+
readonly title: "Production readiness";
|
|
25
|
+
readonly description: "Review launch readiness, deployment configuration, and project health.";
|
|
26
|
+
readonly routeModule: "@coreframe/dashboard/plugins/diagnostics/web";
|
|
27
|
+
}];
|
|
28
|
+
readonly api: {
|
|
29
|
+
readonly routesModule: "@coreframe/dashboard/plugins/diagnostics/api/routes";
|
|
30
|
+
readonly handlersModule: "@coreframe/dashboard/plugins/diagnostics/api/handlers";
|
|
31
|
+
readonly localCapabilityModule: "@coreframe/dashboard/plugins/diagnostics/api/local";
|
|
32
|
+
readonly workerCapabilityModule: "@coreframe/dashboard/plugins/diagnostics/api/worker";
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
//#endregion
|
|
36
|
+
export { diagnostics, diagnosticsPlugin };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{defineDashboardPlugin as e}from"../../config.js";const t=e({id:`diagnostics`,pages:[{id:`diagnostics`,path:`diagnostics`,title:`Production readiness`,description:`Review launch readiness, deployment configuration, and project health.`,routeModule:`@coreframe/dashboard/plugins/diagnostics/web`}],api:{routesModule:`@coreframe/dashboard/plugins/diagnostics/api/routes`,handlersModule:`@coreframe/dashboard/plugins/diagnostics/api/handlers`,localCapabilityModule:`@coreframe/dashboard/plugins/diagnostics/api/local`,workerCapabilityModule:`@coreframe/dashboard/plugins/diagnostics/api/worker`}});function n(){return t}export{n as diagnostics,t as diagnosticsPlugin};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createDiagnosticsApiClient as e}from"../api/client.js";import{queryOptions as t}from"@tanstack/react-query";const n={overview:()=>t({queryKey:[`dashboard`,`plugins`,`diagnostics`,`overview`],queryFn:()=>e().dashboard()})};export{n as diagnosticsQueries};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DashboardPage as e}from"../../web/dashboard/dashboard-page.js";import{DeployedDashboardPage as t}from"../../web/dashboard/deployed-dashboard-page.js";import n from"../../web/root.style.js";import{diagnosticsQueries as r}from"./web/queries.js";import{jsx as i,jsxs as a}from"react/jsx-runtime";import{useQuery as o}from"@tanstack/react-query";function s(){let a=o(r.overview());return a.isPending?i(c,{title:`Loading dashboard`,message:`Reading the latest project diagnostics.`}):a.isError?i(c,{title:`Dashboard unavailable`,message:a.error.message,action:i(`button`,{className:n.button,onClick:()=>void a.refetch(),children:`Retry`})}):a.data.mode===`deployed`?i(t,{payload:a.data,onRefresh:()=>void a.refetch()}):i(e,{payload:a.data,onRefresh:()=>void a.refetch()})}function c({title:e,message:t,action:r}){return a(`main`,{className:n.statePage,children:[i(`p`,{className:n.eyebrow,children:`Coreframe Dashboard`}),i(`h1`,{children:e}),i(`p`,{className:n.message,children:t}),r]})}export{s as default};
|