@checkstack/frontend 0.0.4 → 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.
Files changed (3) hide show
  1. package/CHANGELOG.md +99 -0
  2. package/package.json +1 -1
  3. package/src/App.tsx +19 -20
package/CHANGELOG.md CHANGED
@@ -1,5 +1,104 @@
1
1
  # @checkstack/frontend
2
2
 
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 9faec1f: # Unified AccessRule Terminology Refactoring
8
+
9
+ This release completes a comprehensive terminology refactoring from "permission" to "accessRule" across the entire codebase, establishing a consistent and modern access control vocabulary.
10
+
11
+ ## Changes
12
+
13
+ ### Core Infrastructure (`@checkstack/common`)
14
+
15
+ - Introduced `AccessRule` interface as the primary access control type
16
+ - Added `accessPair()` helper for creating read/manage access rule pairs
17
+ - Added `access()` builder for individual access rules
18
+ - Replaced `Permission` type with `AccessRule` throughout
19
+
20
+ ### API Changes
21
+
22
+ - `env.registerPermissions()` → `env.registerAccessRules()`
23
+ - `meta.permissions` → `meta.access` in RPC contracts
24
+ - `usePermission()` → `useAccess()` in frontend hooks
25
+ - Route `permission:` field → `accessRule:` field
26
+
27
+ ### UI Changes
28
+
29
+ - "Roles & Permissions" tab → "Roles & Access Rules"
30
+ - "You don't have permission..." → "You don't have access..."
31
+ - All permission-related UI text updated
32
+
33
+ ### Documentation & Templates
34
+
35
+ - Updated 18 documentation files with AccessRule terminology
36
+ - Updated 7 scaffolding templates with `accessPair()` pattern
37
+ - All code examples use new AccessRule API
38
+
39
+ ## Migration Guide
40
+
41
+ ### Backend Plugins
42
+
43
+ ```diff
44
+ - import { permissionList } from "./permissions";
45
+ - env.registerPermissions(permissionList);
46
+ + import { accessRules } from "./access";
47
+ + env.registerAccessRules(accessRules);
48
+ ```
49
+
50
+ ### RPC Contracts
51
+
52
+ ```diff
53
+ - .meta({ userType: "user", permissions: [permissions.read.id] })
54
+ + .meta({ userType: "user", access: [access.read] })
55
+ ```
56
+
57
+ ### Frontend Hooks
58
+
59
+ ```diff
60
+ - const canRead = accessApi.usePermission(permissions.read.id);
61
+ + const canRead = accessApi.useAccess(access.read);
62
+ ```
63
+
64
+ ### Routes
65
+
66
+ ```diff
67
+ - permission: permissions.entityRead.id,
68
+ + accessRule: access.read,
69
+ ```
70
+
71
+ ### Patch Changes
72
+
73
+ - Updated dependencies [9faec1f]
74
+ - Updated dependencies [95eeec7]
75
+ - Updated dependencies [f533141]
76
+ - @checkstack/auth-frontend@0.2.0
77
+ - @checkstack/catalog-frontend@0.2.0
78
+ - @checkstack/command-frontend@0.1.0
79
+ - @checkstack/common@0.2.0
80
+ - @checkstack/frontend-api@0.1.0
81
+ - @checkstack/signal-common@0.1.0
82
+ - @checkstack/ui@0.2.0
83
+ - @checkstack/signal-frontend@0.0.6
84
+
85
+ ## 0.0.5
86
+
87
+ ### Patch Changes
88
+
89
+ - Updated dependencies [8e43507]
90
+ - Updated dependencies [97c5a6b]
91
+ - Updated dependencies [97c5a6b]
92
+ - Updated dependencies [8e43507]
93
+ - @checkstack/ui@0.1.0
94
+ - @checkstack/catalog-frontend@0.1.0
95
+ - @checkstack/auth-frontend@0.1.0
96
+ - @checkstack/command-frontend@0.0.5
97
+ - @checkstack/common@0.1.0
98
+ - @checkstack/frontend-api@0.0.4
99
+ - @checkstack/signal-common@0.0.4
100
+ - @checkstack/signal-frontend@0.0.5
101
+
3
102
  ## 0.0.4
4
103
 
5
104
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/frontend",
3
- "version": "0.0.4",
3
+ "version": "0.1.0",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",
package/src/App.tsx CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  ApiProvider,
11
11
  ApiRegistryBuilder,
12
12
  loggerApiRef,
13
- permissionApiRef,
13
+ accessApiRef,
14
14
  fetchApiRef,
15
15
  rpcApiRef,
16
16
  useApi,
@@ -28,17 +28,14 @@ import { ConsoleLoggerApi } from "./apis/logger-api";
28
28
  import { CoreFetchApi } from "./apis/fetch-api";
29
29
  import { CoreRpcApi } from "./apis/rpc-api";
30
30
  import {
31
- PermissionDenied,
31
+ AccessDenied,
32
32
  LoadingSpinner,
33
33
  ToastProvider,
34
34
  AmbientBackground,
35
35
  } from "@checkstack/ui";
36
36
  import { SignalProvider } from "@checkstack/signal-frontend";
37
37
  import { usePluginLifecycle } from "./hooks/usePluginLifecycle";
38
- import {
39
- useCommands,
40
- useGlobalShortcuts,
41
- } from "@checkstack/command-frontend";
38
+ import { useCommands, useGlobalShortcuts } from "@checkstack/command-frontend";
42
39
 
43
40
  /**
44
41
  * Component that registers global keyboard shortcuts for all commands.
@@ -48,7 +45,7 @@ function GlobalShortcuts() {
48
45
  const { commands } = useCommands();
49
46
  const navigate = useNavigate();
50
47
 
51
- // Pass "*" as permission since backend already filters by permission
48
+ // Pass "*" as access since backend already filters by access
52
49
  useGlobalShortcuts(commands, navigate, ["*"]);
53
50
 
54
51
  // This component renders nothing - it only registers event listeners
@@ -57,10 +54,16 @@ function GlobalShortcuts() {
57
54
 
58
55
  const RouteGuard: React.FC<{
59
56
  children: React.ReactNode;
60
- permission?: string;
61
- }> = ({ children, permission }) => {
62
- const permissionApi = useApi(permissionApiRef);
63
- const { allowed, loading } = permissionApi.usePermission(permission || "");
57
+ accessRule?: string;
58
+ }> = ({ children, accessRule }) => {
59
+ const accessApi = useApi(accessApiRef);
60
+ // If there's an access rule requirement, use useAccess with a minimal AccessRule-like object
61
+ // the route.accessRule is already the qualified access rule ID string
62
+ const { allowed, loading } = accessRule
63
+ ? accessApi.useAccess({ id: accessRule } as Parameters<
64
+ typeof accessApi.useAccess
65
+ >[0])
66
+ : { allowed: true, loading: false };
64
67
 
65
68
  if (loading) {
66
69
  return (
@@ -70,10 +73,8 @@ const RouteGuard: React.FC<{
70
73
  );
71
74
  }
72
75
 
73
- const isAllowed = permission ? allowed : true;
74
-
75
- if (!isAllowed) {
76
- return <PermissionDenied />;
76
+ if (!allowed) {
77
+ return <AccessDenied />;
77
78
  }
78
79
 
79
80
  return <>{children}</>;
@@ -130,7 +131,7 @@ function AppContent() {
130
131
  key={route.path}
131
132
  path={route.path}
132
133
  element={
133
- <RouteGuard permission={route.permission}>
134
+ <RouteGuard accessRule={route.accessRule}>
134
135
  {route.element}
135
136
  </RouteGuard>
136
137
  }
@@ -154,10 +155,8 @@ function AppWithApis() {
154
155
  // Initialize API Registry with core apiRefs
155
156
  const registryBuilder = new ApiRegistryBuilder()
156
157
  .register(loggerApiRef, new ConsoleLoggerApi())
157
- .register(permissionApiRef, {
158
- usePermission: () => ({ loading: false, allowed: true }), // Default to allow all if no auth plugin present
159
- useResourcePermission: () => ({ loading: false, allowed: true }),
160
- useManagePermission: () => ({ loading: false, allowed: true }),
158
+ .register(accessApiRef, {
159
+ useAccess: () => ({ loading: false, allowed: true }), // Default to allow all if no auth plugin present
161
160
  })
162
161
  .registerFactory(fetchApiRef, (_registry) => {
163
162
  return new CoreFetchApi(baseUrl);