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.
Files changed (47) hide show
  1. package/CHANGE_LOG.md +17 -0
  2. package/README.md +72 -4
  3. package/SETUP_CHECKLIST.md +9 -1
  4. package/dist/api/index.d.ts.map +1 -1
  5. package/dist/api/index.js +109 -5
  6. package/dist/components/admin_app.d.ts.map +1 -1
  7. package/dist/components/admin_app.js +26 -0
  8. package/dist/components/admin_kinds.d.ts +15 -0
  9. package/dist/components/admin_kinds.d.ts.map +1 -0
  10. package/dist/components/admin_kinds.js +120 -0
  11. package/dist/components/admin_layout.d.ts.map +1 -1
  12. package/dist/components/admin_layout.js +18 -20
  13. package/dist/components/admin_nav.d.ts +17 -2
  14. package/dist/components/admin_nav.d.ts.map +1 -1
  15. package/dist/components/admin_nav.js +111 -1
  16. package/dist/components/api_keys_panel.d.ts +5 -0
  17. package/dist/components/api_keys_panel.d.ts.map +1 -0
  18. package/dist/components/api_keys_panel.js +21 -0
  19. package/dist/components/audit_panel.d.ts +5 -0
  20. package/dist/components/audit_panel.d.ts.map +1 -0
  21. package/dist/components/audit_panel.js +19 -0
  22. package/dist/components/blog_panel.d.ts +5 -0
  23. package/dist/components/blog_panel.d.ts.map +1 -0
  24. package/dist/components/blog_panel.js +23 -0
  25. package/dist/components/env_migration_panel.d.ts.map +1 -1
  26. package/dist/components/env_migration_panel.js +6 -8
  27. package/dist/components/feedback_panel.d.ts +5 -0
  28. package/dist/components/feedback_panel.d.ts.map +1 -0
  29. package/dist/components/feedback_panel.js +24 -0
  30. package/dist/components/files_panel.d.ts +5 -0
  31. package/dist/components/files_panel.d.ts.map +1 -0
  32. package/dist/components/files_panel.js +22 -0
  33. package/dist/components/masking_panel.d.ts +5 -0
  34. package/dist/components/masking_panel.d.ts.map +1 -0
  35. package/dist/components/masking_panel.js +65 -0
  36. package/dist/components/settings_panel.d.ts +5 -0
  37. package/dist/components/settings_panel.d.ts.map +1 -0
  38. package/dist/components/settings_panel.js +19 -0
  39. package/dist/index.client.d.ts +8 -0
  40. package/dist/index.client.d.ts.map +1 -1
  41. package/dist/index.client.js +8 -0
  42. package/dist/index.ui.d.ts +2 -0
  43. package/dist/index.ui.d.ts.map +1 -1
  44. package/dist/index.ui.js +1 -0
  45. package/dist/preset/page_factory.d.ts.map +1 -1
  46. package/dist/preset/page_factory.js +9 -13
  47. 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", { style: { color: '#6b7280' }, children: reason === 'unauthenticated'
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
- return false;
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.1.1",
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.2.1",
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": "^9.1.2",
58
+ "hazo_auth": "^10.1.0",
51
59
  "hazo_logs": "^2.0.2",
52
60
  "hazo_debug": "^3.1.1",
53
- "hazo_connect": "^3.4.1",
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.1.1",
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.2.1",
122
- "hazo_auth": "^9.1.2",
123
- "hazo_testing": "^0.1.1",
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",