@checkstack/test-utils-backend 0.0.4 → 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/test-utils-backend
2
2
 
3
+ ## 0.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [9a27800]
8
+ - @checkstack/queue-api@0.0.6
9
+ - @checkstack/backend-api@0.3.1
10
+
11
+ ## 0.1.0
12
+
13
+ ### Minor Changes
14
+
15
+ - 9faec1f: # Unified AccessRule Terminology Refactoring
16
+
17
+ This release completes a comprehensive terminology refactoring from "permission" to "accessRule" across the entire codebase, establishing a consistent and modern access control vocabulary.
18
+
19
+ ## Changes
20
+
21
+ ### Core Infrastructure (`@checkstack/common`)
22
+
23
+ - Introduced `AccessRule` interface as the primary access control type
24
+ - Added `accessPair()` helper for creating read/manage access rule pairs
25
+ - Added `access()` builder for individual access rules
26
+ - Replaced `Permission` type with `AccessRule` throughout
27
+
28
+ ### API Changes
29
+
30
+ - `env.registerPermissions()` → `env.registerAccessRules()`
31
+ - `meta.permissions` → `meta.access` in RPC contracts
32
+ - `usePermission()` → `useAccess()` in frontend hooks
33
+ - Route `permission:` field → `accessRule:` field
34
+
35
+ ### UI Changes
36
+
37
+ - "Roles & Permissions" tab → "Roles & Access Rules"
38
+ - "You don't have permission..." → "You don't have access..."
39
+ - All permission-related UI text updated
40
+
41
+ ### Documentation & Templates
42
+
43
+ - Updated 18 documentation files with AccessRule terminology
44
+ - Updated 7 scaffolding templates with `accessPair()` pattern
45
+ - All code examples use new AccessRule API
46
+
47
+ ## Migration Guide
48
+
49
+ ### Backend Plugins
50
+
51
+ ```diff
52
+ - import { permissionList } from "./permissions";
53
+ - env.registerPermissions(permissionList);
54
+ + import { accessRules } from "./access";
55
+ + env.registerAccessRules(accessRules);
56
+ ```
57
+
58
+ ### RPC Contracts
59
+
60
+ ```diff
61
+ - .meta({ userType: "user", permissions: [permissions.read.id] })
62
+ + .meta({ userType: "user", access: [access.read] })
63
+ ```
64
+
65
+ ### Frontend Hooks
66
+
67
+ ```diff
68
+ - const canRead = accessApi.usePermission(permissions.read.id);
69
+ + const canRead = accessApi.useAccess(access.read);
70
+ ```
71
+
72
+ ### Routes
73
+
74
+ ```diff
75
+ - permission: permissions.entityRead.id,
76
+ + accessRule: access.read,
77
+ ```
78
+
79
+ ### Patch Changes
80
+
81
+ - Updated dependencies [9faec1f]
82
+ - Updated dependencies [827b286]
83
+ - Updated dependencies [f533141]
84
+ - Updated dependencies [aa4a8ab]
85
+ - @checkstack/backend-api@0.3.0
86
+ - @checkstack/common@0.2.0
87
+ - @checkstack/signal-common@0.1.0
88
+ - @checkstack/queue-api@0.0.5
89
+
3
90
  ## 0.0.4
4
91
 
5
92
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/test-utils-backend",
3
- "version": "0.0.4",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "scripts": {
@@ -1,4 +1,4 @@
1
- import { qualifyPermissionId } from "@checkstack/common";
1
+ import { qualifyAccessRuleId } from "@checkstack/common";
2
2
  import type { SignalService, Signal } from "@checkstack/signal-common";
3
3
 
4
4
  /**
@@ -9,7 +9,7 @@ export interface RecordedSignal<T = unknown> {
9
9
  payload: T;
10
10
  targetType: "broadcast" | "user" | "users" | "authorized";
11
11
  userIds?: string[];
12
- permission?: string; // For authorized signals
12
+ accessRule?: string; // For authorized signals
13
13
  timestamp: Date;
14
14
  }
15
15
 
@@ -48,11 +48,11 @@ export interface MockSignalService extends SignalService {
48
48
  wasSignalSentToUser(signalId: string, userId: string): boolean;
49
49
 
50
50
  /**
51
- * Set a permission filter function for sendToAuthorizedUsers testing.
51
+ * Set a access filter function for sendToAuthorizedUsers testing.
52
52
  * If not set, sendToAuthorizedUsers will pass through all users.
53
53
  */
54
- setPermissionFilter(
55
- filter: (userIds: string[], permission: string) => string[]
54
+ setAccessFilter(
55
+ filter: (userIds: string[], accessRule: string) => string[]
56
56
  ): void;
57
57
  }
58
58
 
@@ -79,8 +79,8 @@ export interface MockSignalService extends SignalService {
79
79
  */
80
80
  export function createMockSignalService(): MockSignalService {
81
81
  const recordedSignals: RecordedSignal[] = [];
82
- let permissionFilter:
83
- | ((userIds: string[], permission: string) => string[])
82
+ let accessFilter:
83
+ | ((userIds: string[], accessRule: string) => string[])
84
84
  | undefined;
85
85
 
86
86
  return {
@@ -157,17 +157,17 @@ export function createMockSignalService(): MockSignalService {
157
157
  userIds: string[],
158
158
  payload: T,
159
159
  pluginMetadata: { pluginId: string },
160
- permission: { id: string }
160
+ accessRule: { id: string }
161
161
  ): Promise<void> {
162
- // Construct fully-qualified permission ID
163
- const qualifiedPermission = qualifyPermissionId(
162
+ // Construct fully-qualified access rule ID
163
+ const qualifiedAccessRule = qualifyAccessRuleId(
164
164
  pluginMetadata,
165
- permission
165
+ accessRule
166
166
  );
167
167
 
168
- // Apply permission filter if set
169
- const filteredUserIds = permissionFilter
170
- ? permissionFilter(userIds, qualifiedPermission)
168
+ // Apply access filter if set
169
+ const filteredUserIds = accessFilter
170
+ ? accessFilter(userIds, qualifiedAccessRule)
171
171
  : userIds;
172
172
 
173
173
  recordedSignals.push({
@@ -175,15 +175,15 @@ export function createMockSignalService(): MockSignalService {
175
175
  payload,
176
176
  targetType: "authorized",
177
177
  userIds: filteredUserIds,
178
- permission: qualifiedPermission,
178
+ accessRule: qualifiedAccessRule,
179
179
  timestamp: new Date(),
180
180
  });
181
181
  },
182
182
 
183
- setPermissionFilter(
184
- filter: (userIds: string[], permission: string) => string[]
183
+ setAccessFilter(
184
+ filter: (userIds: string[], accessRule: string) => string[]
185
185
  ): void {
186
- permissionFilter = filter;
186
+ accessFilter = filter;
187
187
  },
188
188
  };
189
189
  }