@coreframe/dashboard 0.0.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +93 -0
- package/dist/client/assets/QueryClientProvider-BCOOhPXt.js +1 -0
- package/dist/client/assets/dashboard-0D3-ZE5r.js +64 -0
- package/dist/client/assets/entry.client-CommjN-q.js +9 -0
- package/dist/client/assets/errorBoundaries-BpDxkXkc.js +16 -0
- 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 +1 -0
- package/dist/client/assets/lib-DzJLXgd6.js +1 -0
- package/dist/client/assets/manifest-23693f57.js +1 -0
- package/dist/client/assets/not-found-BgheKh02.js +1 -0
- package/dist/client/assets/root-B6xtHGyN.js +1 -0
- package/dist/client/assets/root-CGZxmauM.css +1 -0
- package/dist/client/assets/root.style-DmKiRSsP.js +1 -0
- package/dist/client/index.html +6 -0
- package/dist/server/index.js +1 -0
- package/dist/src/api/router.js +1 -0
- package/dist/src/api/routes/dashboard.js +1 -0
- package/dist/src/api/routes/development.js +1 -0
- package/dist/src/api/routes/health.js +1 -0
- package/dist/src/api/routes/index.js +1 -0
- package/dist/src/cli.d.ts +1 -0
- package/dist/src/cli.js +8 -0
- package/dist/src/development.d.ts +12 -0
- package/dist/src/development.js +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.js +1 -0
- package/dist/src/node-fetch-adapter.js +1 -0
- package/dist/src/server.d.ts +24 -0
- package/dist/src/server.js +1 -0
- package/dist/src/types.d.ts +68 -0
- package/dist/src/worker.d.ts +30 -0
- package/dist/src/worker.js +1 -0
- package/package.json +71 -10
- package/readme.md +0 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { DiagnosticResult } from "@coreframe/diagnostics";
|
|
2
|
+
import { WorkerEnvironmentStatus } from "@coreframe/scripts/worker-environment";
|
|
3
|
+
import { DevPlatform } from "@coreframe/scripts/dev";
|
|
4
|
+
|
|
5
|
+
//#region src/types.d.ts
|
|
6
|
+
type DevelopmentTarget = {
|
|
7
|
+
platform: DevPlatform;
|
|
8
|
+
label: string;
|
|
9
|
+
available: boolean;
|
|
10
|
+
unavailableReason?: string;
|
|
11
|
+
};
|
|
12
|
+
type DevelopmentSessionStatus = "starting" | "running" | "stopping" | "stopped" | "failed";
|
|
13
|
+
type DevelopmentSession = {
|
|
14
|
+
platform: DevPlatform;
|
|
15
|
+
status: DevelopmentSessionStatus;
|
|
16
|
+
startedAt: string;
|
|
17
|
+
url?: string;
|
|
18
|
+
readyAt?: string;
|
|
19
|
+
exitCode?: number;
|
|
20
|
+
message?: string;
|
|
21
|
+
};
|
|
22
|
+
type DevelopmentLogEntry = {
|
|
23
|
+
sequence: number;
|
|
24
|
+
stream: "stdout" | "stderr";
|
|
25
|
+
text: string;
|
|
26
|
+
};
|
|
27
|
+
type DevelopmentState = {
|
|
28
|
+
targets: DevelopmentTarget[];
|
|
29
|
+
logs: DevelopmentLogEntry[];
|
|
30
|
+
session?: DevelopmentSession;
|
|
31
|
+
};
|
|
32
|
+
type LocalDashboardPayload = {
|
|
33
|
+
mode: "local";
|
|
34
|
+
diagnostics: DiagnosticResult;
|
|
35
|
+
development: DevelopmentState;
|
|
36
|
+
mutationToken: string;
|
|
37
|
+
workerEnvironment: WorkerEnvironmentStatus;
|
|
38
|
+
};
|
|
39
|
+
type DeployedConfigurationEntry = {
|
|
40
|
+
description: string;
|
|
41
|
+
kind: "secret" | "variable";
|
|
42
|
+
name: string;
|
|
43
|
+
status: "configured" | "missing";
|
|
44
|
+
};
|
|
45
|
+
type DashboardLink = {
|
|
46
|
+
href: string;
|
|
47
|
+
id: string;
|
|
48
|
+
label: string;
|
|
49
|
+
};
|
|
50
|
+
type DeployedDashboardPayload = {
|
|
51
|
+
mode: "deployed";
|
|
52
|
+
environment: "production" | "staging";
|
|
53
|
+
release: {
|
|
54
|
+
applicationName: string;
|
|
55
|
+
applicationVersion?: string;
|
|
56
|
+
cloudflareVersionId?: string;
|
|
57
|
+
cloudflareVersionTag?: string;
|
|
58
|
+
cloudflareVersionTimestamp?: string;
|
|
59
|
+
commit?: string;
|
|
60
|
+
coreframeVersion?: string;
|
|
61
|
+
releaseName?: string;
|
|
62
|
+
};
|
|
63
|
+
configuration: DeployedConfigurationEntry[];
|
|
64
|
+
links: DashboardLink[];
|
|
65
|
+
};
|
|
66
|
+
type DashboardPayload = LocalDashboardPayload | DeployedDashboardPayload;
|
|
67
|
+
//#endregion
|
|
68
|
+
export { DashboardLink, DashboardPayload, DeployedConfigurationEntry, DeployedDashboardPayload, DevelopmentLogEntry, DevelopmentSession, DevelopmentSessionStatus, DevelopmentState, DevelopmentTarget, LocalDashboardPayload };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/worker.d.ts
|
|
2
|
+
type DashboardWorkerEnv = {
|
|
3
|
+
ASSETS?: {
|
|
4
|
+
fetch(request: Request): Promise<Response>;
|
|
5
|
+
};
|
|
6
|
+
CF_VERSION_METADATA?: {
|
|
7
|
+
id?: string;
|
|
8
|
+
tag?: string;
|
|
9
|
+
timestamp?: string;
|
|
10
|
+
};
|
|
11
|
+
DASHBOARD_PASSWORD?: string;
|
|
12
|
+
DEPLOY_ENV?: "production" | "staging";
|
|
13
|
+
POSTHOG_RELEASE?: string;
|
|
14
|
+
};
|
|
15
|
+
type DashboardBuildMetadata = {
|
|
16
|
+
applicationName: string;
|
|
17
|
+
applicationVersion?: string;
|
|
18
|
+
commit?: string;
|
|
19
|
+
configuration: Array<{
|
|
20
|
+
description: string;
|
|
21
|
+
kind: "secret" | "variable";
|
|
22
|
+
name: string;
|
|
23
|
+
requiredIn: Array<"production" | "staging">;
|
|
24
|
+
}>;
|
|
25
|
+
coreframeVersion?: string;
|
|
26
|
+
deployUrls: Partial<Record<"production" | "staging", string>>;
|
|
27
|
+
};
|
|
28
|
+
declare function handleDashboardRequest<Env extends DashboardWorkerEnv>(request: Request, env: Env): Promise<Response> | null;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { DashboardBuildMetadata, DashboardWorkerEnv, handleDashboardRequest };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=`/__dashboard`,t=`${e}/api`;function n(e,t){let n=new URL(e.url);return!o(n.pathname)||!t.DEPLOY_ENV?null:r(e,t,n,t.DEPLOY_ENV)}async function r(n,r,a,o){if(!r.DASHBOARD_PASSWORD)return new Response(`Dashboard unavailable`,{headers:{"cache-control":`no-store`},status:503});let s=l(n.headers.get(`authorization`));if(!s||!await u(s,r.DASHBOARD_PASSWORD))return new Response(`Authentication required`,{headers:{"cache-control":`no-store`,"www-authenticate":`Basic realm="Coreframe dashboard", charset="UTF-8"`},status:401});if(a.pathname===`${t}/dashboard`)return n.method===`GET`?c(i(n,r,o)):c({error:`Method not allowed`},405);if(a.pathname===t||a.pathname.startsWith(`${t}/`))return c({error:`Not found`},404);if(a.pathname===e)return a.pathname=`${e}/`,Response.redirect(a,302);if(n.method!==`GET`&&n.method!==`HEAD`)return new Response(`Method not allowed`,{headers:{"cache-control":`no-store`},status:405});if(!r.ASSETS)return new Response(`Dashboard unavailable`,{headers:{"cache-control":`no-store`},status:503});(a.pathname===`${e}/`||!a.pathname.slice(13).includes(`.`))&&(a.pathname=`${e}/index.html`);let d=await r.ASSETS.fetch(new Request(a,n)),f=new Headers(d.headers);return f.set(`cache-control`,a.pathname.endsWith(`/index.html`)?`no-store`:`public, max-age=31536000, immutable`),new Response(n.method===`HEAD`?null:d.body,{headers:f,status:d.status,statusText:d.statusText})}function i(e,t,n){let r=a(),i=t,o=r.configuration.filter(e=>e.requiredIn.includes(n)).map(e=>({description:e.description,kind:e.kind,name:e.name,status:s(i[e.name])?`configured`:`missing`})),c=[],l=r.deployUrls[n];return l?c.push({href:l,id:`application`,label:`Application`}):c.push({href:new URL(`/`,e.url).href,id:`application`,label:`Application`}),{mode:`deployed`,environment:n,release:{applicationName:r.applicationName,applicationVersion:r.applicationVersion,cloudflareVersionId:t.CF_VERSION_METADATA?.id,cloudflareVersionTag:t.CF_VERSION_METADATA?.tag,cloudflareVersionTimestamp:t.CF_VERSION_METADATA?.timestamp,commit:r.commit,coreframeVersion:r.coreframeVersion,releaseName:t.POSTHOG_RELEASE},configuration:o,links:c}}function a(){return typeof __COREFRAME_DASHBOARD_BUILD__<`u`?__COREFRAME_DASHBOARD_BUILD__:{applicationName:`Coreframe application`,configuration:[],deployUrls:{}}}function o(t){return t===e||t.startsWith(`${e}/`)}function s(e){return typeof e==`string`?e.trim().length>0:e!=null}function c(e,t=200){return Response.json(e,{headers:{"cache-control":`no-store`},status:t})}function l(e){if(e?.startsWith(`Basic `))try{let t=Uint8Array.from(atob(e.slice(6)),e=>e.charCodeAt(0)),n=new TextDecoder().decode(t),r=n.indexOf(`:`);return r===-1||n.slice(0,r)!==`coreframe`?void 0:n.slice(r+1)}catch{return}}async function u(e,t){let n=new TextEncoder,[r,i]=await Promise.all([crypto.subtle.digest(`SHA-256`,n.encode(e)),crypto.subtle.digest(`SHA-256`,n.encode(t))]),a=new Uint8Array(r),o=new Uint8Array(i),s=0;for(let e=0;e<a.length;e+=1)s|=a[e]^o[e];return s===0}export{n as handleDashboardRequest};
|
package/package.json
CHANGED
|
@@ -1,13 +1,74 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coreframe/dashboard",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/airlock-labs/coreframe.git",
|
|
7
|
+
"directory": "dashboard"
|
|
8
|
+
},
|
|
9
|
+
"bin": {
|
|
10
|
+
"coreframe-dashboard": "./dist/src/cli.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist/"
|
|
14
|
+
],
|
|
15
|
+
"type": "module",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/src/index.d.ts",
|
|
19
|
+
"default": "./dist/src/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./server": {
|
|
22
|
+
"types": "./dist/src/server.d.ts",
|
|
23
|
+
"default": "./dist/src/server.js"
|
|
24
|
+
},
|
|
25
|
+
"./worker": {
|
|
26
|
+
"types": "./dist/src/worker.d.ts",
|
|
27
|
+
"default": "./dist/src/worker.js"
|
|
28
|
+
}
|
|
8
29
|
},
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@fontsource-variable/inter": "^5.2.8",
|
|
32
|
+
"@tanstack/react-query": "^5.101.2",
|
|
33
|
+
"nanoreset": "^7.0.0",
|
|
34
|
+
"portless": "^0.15.1",
|
|
35
|
+
"react": "^19.2.7",
|
|
36
|
+
"react-dom": "^19.2.7",
|
|
37
|
+
"react-router": "^8.2.0",
|
|
38
|
+
"rouzer": "6.0.0",
|
|
39
|
+
"zod": "^4.4.3",
|
|
40
|
+
"@coreframe/diagnostics": "0.1.0",
|
|
41
|
+
"@coreframe/scripts": "0.1.19"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@pandacss/dev": "2.0.0-beta.5",
|
|
45
|
+
"@pandacss/preset-base": "2.0.0-beta.8",
|
|
46
|
+
"@pandacss/preset-panda": "2.0.0-beta.8",
|
|
47
|
+
"@pandacss/vite": "2.0.0-beta.8",
|
|
48
|
+
"@react-router/dev": "^8.2.0",
|
|
49
|
+
"@rolldown/plugin-babel": "^0.2.3",
|
|
50
|
+
"@types/node": "^26.1.0",
|
|
51
|
+
"@types/react": "^19.2.17",
|
|
52
|
+
"@types/react-dom": "^19.2.3",
|
|
53
|
+
"@vitejs/plugin-react": "^6.0.3",
|
|
54
|
+
"babel-plugin-react-compiler": "^1.0.0",
|
|
55
|
+
"jsdom": "^29.1.1",
|
|
56
|
+
"sculpted": "^0.3.16",
|
|
57
|
+
"tsdown": "0.22.3",
|
|
58
|
+
"typescript": "6.0.3",
|
|
59
|
+
"vite": "^8.1.3",
|
|
60
|
+
"vitest": "^4.1.9"
|
|
61
|
+
},
|
|
62
|
+
"scripts": {
|
|
63
|
+
"build": "pnpm --dir ../diagnostics build && pnpm build:client && pnpm build:server && pnpm build:check",
|
|
64
|
+
"build:check": "node scripts/verify-build.mjs",
|
|
65
|
+
"build:client": "react-router build",
|
|
66
|
+
"codegen": "panda codegen",
|
|
67
|
+
"build:server": "tsdown",
|
|
68
|
+
"dev": "pnpm build && node dist/src/cli.js",
|
|
69
|
+
"test": "vitest run",
|
|
70
|
+
"typecheck": "react-router typegen && tsc --noEmit -p tsconfig.json",
|
|
71
|
+
"format": "oxfmt",
|
|
72
|
+
"lint": "oxlint"
|
|
73
|
+
}
|
|
74
|
+
}
|
package/readme.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Coming soon...
|