@checkstack/api-docs-frontend 0.0.5 → 0.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,92 @@
1
1
  # @checkstack/api-docs-frontend
2
2
 
3
+ ## 0.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [7a23261]
8
+ - @checkstack/frontend-api@0.2.0
9
+ - @checkstack/common@0.3.0
10
+ - @checkstack/ui@0.2.1
11
+ - @checkstack/api-docs-common@0.1.1
12
+
13
+ ## 0.1.0
14
+
15
+ ### Minor Changes
16
+
17
+ - 9faec1f: # Unified AccessRule Terminology Refactoring
18
+
19
+ This release completes a comprehensive terminology refactoring from "permission" to "accessRule" across the entire codebase, establishing a consistent and modern access control vocabulary.
20
+
21
+ ## Changes
22
+
23
+ ### Core Infrastructure (`@checkstack/common`)
24
+
25
+ - Introduced `AccessRule` interface as the primary access control type
26
+ - Added `accessPair()` helper for creating read/manage access rule pairs
27
+ - Added `access()` builder for individual access rules
28
+ - Replaced `Permission` type with `AccessRule` throughout
29
+
30
+ ### API Changes
31
+
32
+ - `env.registerPermissions()` → `env.registerAccessRules()`
33
+ - `meta.permissions` → `meta.access` in RPC contracts
34
+ - `usePermission()` → `useAccess()` in frontend hooks
35
+ - Route `permission:` field → `accessRule:` field
36
+
37
+ ### UI Changes
38
+
39
+ - "Roles & Permissions" tab → "Roles & Access Rules"
40
+ - "You don't have permission..." → "You don't have access..."
41
+ - All permission-related UI text updated
42
+
43
+ ### Documentation & Templates
44
+
45
+ - Updated 18 documentation files with AccessRule terminology
46
+ - Updated 7 scaffolding templates with `accessPair()` pattern
47
+ - All code examples use new AccessRule API
48
+
49
+ ## Migration Guide
50
+
51
+ ### Backend Plugins
52
+
53
+ ```diff
54
+ - import { permissionList } from "./permissions";
55
+ - env.registerPermissions(permissionList);
56
+ + import { accessRules } from "./access";
57
+ + env.registerAccessRules(accessRules);
58
+ ```
59
+
60
+ ### RPC Contracts
61
+
62
+ ```diff
63
+ - .meta({ userType: "user", permissions: [permissions.read.id] })
64
+ + .meta({ userType: "user", access: [access.read] })
65
+ ```
66
+
67
+ ### Frontend Hooks
68
+
69
+ ```diff
70
+ - const canRead = accessApi.usePermission(permissions.read.id);
71
+ + const canRead = accessApi.useAccess(access.read);
72
+ ```
73
+
74
+ ### Routes
75
+
76
+ ```diff
77
+ - permission: permissions.entityRead.id,
78
+ + accessRule: access.read,
79
+ ```
80
+
81
+ ### Patch Changes
82
+
83
+ - Updated dependencies [9faec1f]
84
+ - Updated dependencies [f533141]
85
+ - @checkstack/api-docs-common@0.1.0
86
+ - @checkstack/common@0.2.0
87
+ - @checkstack/frontend-api@0.1.0
88
+ - @checkstack/ui@0.2.0
89
+
3
90
  ## 0.0.5
4
91
 
5
92
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/api-docs-frontend",
3
- "version": "0.0.5",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "main": "src/index.tsx",
6
6
  "scripts": {
@@ -2,25 +2,19 @@ import { useNavigate } from "react-router-dom";
2
2
  import { FileCode2 } from "lucide-react";
3
3
  import { DropdownMenuItem } from "@checkstack/ui";
4
4
  import type { UserMenuItemsContext } from "@checkstack/frontend-api";
5
- import { resolveRoute, qualifyPermissionId } from "@checkstack/common";
6
- import {
7
- pluginMetadata,
8
- permissions,
9
- } from "@checkstack/api-docs-common";
5
+ import { resolveRoute } from "@checkstack/common";
6
+ import { pluginMetadata, apiDocsAccess } from "@checkstack/api-docs-common";
10
7
  import { apiDocsRoutes } from "./index";
11
8
  import React from "react";
12
9
 
13
- const REQUIRED_PERMISSION = qualifyPermissionId(
14
- pluginMetadata,
15
- permissions.apiDocsView
16
- );
10
+ const REQUIRED_ACCESS_RULE = `${pluginMetadata.pluginId}.${apiDocsAccess.view.id}`;
17
11
 
18
12
  export function ApiDocsMenuItem({
19
- permissions: userPerms,
13
+ accessRules: userPerms,
20
14
  }: UserMenuItemsContext) {
21
15
  const navigate = useNavigate();
22
16
  const canView =
23
- userPerms.includes("*") || userPerms.includes(REQUIRED_PERMISSION);
17
+ userPerms.includes("*") || userPerms.includes(REQUIRED_ACCESS_RULE);
24
18
 
25
19
  if (!canView) return <React.Fragment />;
26
20
 
@@ -49,7 +49,7 @@ interface OperationObject {
49
49
  >;
50
50
  "x-orpc-meta"?: {
51
51
  userType?: string;
52
- permissions?: string[];
52
+ accessRules?: string[];
53
53
  };
54
54
  }
55
55
 
@@ -290,11 +290,11 @@ function EndpointCard({
290
290
  </p>
291
291
  )}
292
292
 
293
- {meta?.permissions && meta.permissions.length > 0 && (
293
+ {meta?.accessRules && meta.accessRules.length > 0 && (
294
294
  <div>
295
- <h4 className="text-sm font-medium mb-2">Required Permissions</h4>
295
+ <h4 className="text-sm font-medium mb-2">Required Access Rules</h4>
296
296
  <div className="flex flex-wrap gap-2">
297
- {meta.permissions.map((perm) => (
297
+ {meta.accessRules.map((perm) => (
298
298
  <Badge key={perm} variant="secondary">
299
299
  {perm}
300
300
  </Badge>
package/src/index.tsx CHANGED
@@ -4,10 +4,7 @@ import {
4
4
  UserMenuItemsSlot,
5
5
  } from "@checkstack/frontend-api";
6
6
  import { createRoutes } from "@checkstack/common";
7
- import {
8
- pluginMetadata,
9
- permissions,
10
- } from "@checkstack/api-docs-common";
7
+ import { pluginMetadata, apiDocsAccess } from "@checkstack/api-docs-common";
11
8
  import { ApiDocsPage } from "./ApiDocsPage";
12
9
  import { ApiDocsMenuItem } from "./ApiDocsMenuItem";
13
10
 
@@ -21,7 +18,7 @@ export const apiDocsPlugin = createFrontendPlugin({
21
18
  {
22
19
  route: apiDocsRoutes.routes.docs,
23
20
  element: <ApiDocsPage />,
24
- permission: permissions.apiDocsView,
21
+ accessRule: apiDocsAccess.view,
25
22
  },
26
23
  ],
27
24
  extensions: [