hazo_admin 0.1.1 → 0.3.1
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/CHANGE_LOG.md +17 -0
- package/README.md +72 -4
- package/SETUP_CHECKLIST.md +9 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +109 -5
- package/dist/components/admin_app.d.ts.map +1 -1
- package/dist/components/admin_app.js +26 -0
- package/dist/components/admin_kinds.d.ts +15 -0
- package/dist/components/admin_kinds.d.ts.map +1 -0
- package/dist/components/admin_kinds.js +120 -0
- package/dist/components/admin_layout.d.ts.map +1 -1
- package/dist/components/admin_layout.js +18 -20
- package/dist/components/admin_nav.d.ts +17 -2
- package/dist/components/admin_nav.d.ts.map +1 -1
- package/dist/components/admin_nav.js +111 -1
- package/dist/components/api_keys_panel.d.ts +5 -0
- package/dist/components/api_keys_panel.d.ts.map +1 -0
- package/dist/components/api_keys_panel.js +21 -0
- package/dist/components/audit_panel.d.ts +5 -0
- package/dist/components/audit_panel.d.ts.map +1 -0
- package/dist/components/audit_panel.js +19 -0
- package/dist/components/blog_panel.d.ts +5 -0
- package/dist/components/blog_panel.d.ts.map +1 -0
- package/dist/components/blog_panel.js +23 -0
- package/dist/components/env_migration_panel.d.ts.map +1 -1
- package/dist/components/env_migration_panel.js +6 -8
- package/dist/components/feedback_panel.d.ts +5 -0
- package/dist/components/feedback_panel.d.ts.map +1 -0
- package/dist/components/feedback_panel.js +24 -0
- package/dist/components/files_panel.d.ts +5 -0
- package/dist/components/files_panel.d.ts.map +1 -0
- package/dist/components/files_panel.js +22 -0
- package/dist/components/masking_panel.d.ts +5 -0
- package/dist/components/masking_panel.d.ts.map +1 -0
- package/dist/components/masking_panel.js +65 -0
- package/dist/components/settings_panel.d.ts +5 -0
- package/dist/components/settings_panel.d.ts.map +1 -0
- package/dist/components/settings_panel.js +19 -0
- package/dist/index.client.d.ts +8 -0
- package/dist/index.client.d.ts.map +1 -1
- package/dist/index.client.js +8 -0
- package/dist/index.ui.d.ts +2 -0
- package/dist/index.ui.d.ts.map +1 -1
- package/dist/index.ui.js +1 -0
- package/dist/preset/page_factory.d.ts.map +1 -1
- package/dist/preset/page_factory.js +9 -13
- package/package.json +18 -8
|
@@ -3,8 +3,11 @@ import 'server-only';
|
|
|
3
3
|
import { cookies, headers } from 'next/headers';
|
|
4
4
|
import { adminGate } from '../lib/admin_gate.server.js';
|
|
5
5
|
import { defaultPermissionForKind } from '../components/admin_nav.js';
|
|
6
|
+
import { ADMIN_KINDS } from '../components/admin_kinds.js';
|
|
7
|
+
// Derived from the kind registry — slug → required permission
|
|
8
|
+
const slugToPermission = Object.fromEntries(ADMIN_KINDS.map((k) => [k.slug, k.defaultPermission]));
|
|
6
9
|
function Forbidden({ reason }) {
|
|
7
|
-
return (_jsx("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'center', minHeight: '100vh', fontFamily: 'system-ui' }, children: _jsxs("div", { style: { textAlign: 'center', maxWidth: 400 }, children: [_jsx("div", { style: { fontSize: '3rem' }, children: "\uD83D\uDD12" }), _jsx("h1", { style: { fontSize: '1.5rem', fontWeight: 600, marginBottom: '0.5rem' }, children: "Access Denied" }), _jsx("p", {
|
|
10
|
+
return (_jsx("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'center', minHeight: '100vh', fontFamily: 'system-ui' }, children: _jsxs("div", { style: { textAlign: 'center', maxWidth: 400 }, children: [_jsx("div", { style: { fontSize: '3rem' }, children: "\uD83D\uDD12" }), _jsx("h1", { style: { fontSize: '1.5rem', fontWeight: 600, marginBottom: '0.5rem' }, children: "Access Denied" }), _jsx("p", { className: "text-muted-foreground", children: reason === 'unauthenticated'
|
|
8
11
|
? 'You must be logged in to access this area.'
|
|
9
12
|
: reason === 'forbidden'
|
|
10
13
|
? 'You do not have permission to access this area.'
|
|
@@ -17,21 +20,14 @@ export function AdminPresetPage(manifest, _cfg) {
|
|
|
17
20
|
if (slug.length === 0)
|
|
18
21
|
return 'admin_system';
|
|
19
22
|
const section = manifest.sections.find((s) => {
|
|
20
|
-
if (s.kind === 'users')
|
|
21
|
-
return slug[0] === 'users';
|
|
22
|
-
if (s.kind === 'jobs')
|
|
23
|
-
return slug[0] === 'jobs';
|
|
24
|
-
if (s.kind === 'logs')
|
|
25
|
-
return slug[0] === 'logs';
|
|
26
|
-
if (s.kind === 'env_migration')
|
|
27
|
-
return slug[0] === 'env-migration';
|
|
28
|
-
if (s.kind === 'health')
|
|
29
|
-
return slug[0] === 'health';
|
|
30
23
|
if (s.kind === 'custom')
|
|
31
24
|
return s.path.endsWith(`/${slug[0]}`);
|
|
32
|
-
|
|
25
|
+
// Look up the slug for this kind in the registry
|
|
26
|
+
return slugToPermission[slug[0]] !== undefined
|
|
27
|
+
? ADMIN_KINDS.find((k) => k.kind === s.kind)?.slug === slug[0]
|
|
28
|
+
: false;
|
|
33
29
|
});
|
|
34
|
-
return section?.permission ?? defaultPermissionForKind(section?.kind ?? '');
|
|
30
|
+
return section?.permission ?? slugToPermission[slug[0]] ?? defaultPermissionForKind(section?.kind ?? '');
|
|
35
31
|
})();
|
|
36
32
|
const cookieStore = await cookies();
|
|
37
33
|
const headerStore = await headers();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hazo_admin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Standard site-admin package — auth-gated admin shell + panel kit + drop-in /admin preset",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -18,10 +18,18 @@
|
|
|
18
18
|
"types": "./dist/api/index.d.ts",
|
|
19
19
|
"import": "./dist/api/index.js"
|
|
20
20
|
},
|
|
21
|
+
"./jobs": {
|
|
22
|
+
"types": "./dist/api/env_migrate_handler.d.ts",
|
|
23
|
+
"import": "./dist/api/env_migrate_handler.js"
|
|
24
|
+
},
|
|
21
25
|
"./ui": {
|
|
22
26
|
"types": "./dist/index.ui.d.ts",
|
|
23
27
|
"import": "./dist/index.ui.js"
|
|
24
28
|
},
|
|
29
|
+
"./ui/*": {
|
|
30
|
+
"types": "./dist/components/*.d.ts",
|
|
31
|
+
"import": "./dist/components/*.js"
|
|
32
|
+
},
|
|
25
33
|
"./preset": {
|
|
26
34
|
"types": "./dist/preset/index.d.ts",
|
|
27
35
|
"import": "./dist/preset/index.js"
|
|
@@ -43,14 +51,14 @@
|
|
|
43
51
|
},
|
|
44
52
|
"peerDependencies": {
|
|
45
53
|
"hazo_core": "^1.1.0",
|
|
46
|
-
"hazo_ui": "^3.
|
|
54
|
+
"hazo_ui": "^3.5.0",
|
|
47
55
|
"react": "^18.0.0 || ^19.0.0",
|
|
48
56
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
49
57
|
"next": "^14.0.0 || ^16.0.0",
|
|
50
|
-
"hazo_auth": "^
|
|
58
|
+
"hazo_auth": "^10.1.0",
|
|
51
59
|
"hazo_logs": "^2.0.2",
|
|
52
60
|
"hazo_debug": "^3.1.1",
|
|
53
|
-
"hazo_connect": "^3.
|
|
61
|
+
"hazo_connect": "^3.5.1",
|
|
54
62
|
"hazo_config": "^2.1.7",
|
|
55
63
|
"hazo_api": "^2.3.1",
|
|
56
64
|
"hazo_files": "^3.0.0",
|
|
@@ -60,7 +68,7 @@
|
|
|
60
68
|
"hazo_feedback": "^2.2.0",
|
|
61
69
|
"hazo_secure": "^1.2.0",
|
|
62
70
|
"hazo_blog": "^0.2.0",
|
|
63
|
-
"hazo_testing": "^0.
|
|
71
|
+
"hazo_testing": "^0.3.0",
|
|
64
72
|
"lucide-react": "^0.553.0"
|
|
65
73
|
},
|
|
66
74
|
"peerDependenciesMeta": {
|
|
@@ -118,9 +126,11 @@
|
|
|
118
126
|
"@types/react": "^19.0.0",
|
|
119
127
|
"@types/react-dom": "^19.0.0",
|
|
120
128
|
"hazo_core": "^1.1.0",
|
|
121
|
-
"hazo_ui": "^3.
|
|
122
|
-
"hazo_auth": "^
|
|
123
|
-
"hazo_testing": "^0.
|
|
129
|
+
"hazo_ui": "^3.5.0",
|
|
130
|
+
"hazo_auth": "^10.1.0",
|
|
131
|
+
"hazo_testing": "^0.3.0",
|
|
132
|
+
"react": "^19.0.0",
|
|
133
|
+
"react-dom": "^19.0.0",
|
|
124
134
|
"next": "^16.0.10",
|
|
125
135
|
"server-only": "^0.0.1",
|
|
126
136
|
"tailwindcss": "^4.2.4",
|