@checkstack/signal-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 +84 -0
- package/package.json +1 -1
- package/src/signal-service-impl.ts +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,89 @@
|
|
|
1
1
|
# @checkstack/signal-backend
|
|
2
2
|
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @checkstack/backend-api@0.3.1
|
|
8
|
+
|
|
9
|
+
## 0.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 9faec1f: # Unified AccessRule Terminology Refactoring
|
|
14
|
+
|
|
15
|
+
This release completes a comprehensive terminology refactoring from "permission" to "accessRule" across the entire codebase, establishing a consistent and modern access control vocabulary.
|
|
16
|
+
|
|
17
|
+
## Changes
|
|
18
|
+
|
|
19
|
+
### Core Infrastructure (`@checkstack/common`)
|
|
20
|
+
|
|
21
|
+
- Introduced `AccessRule` interface as the primary access control type
|
|
22
|
+
- Added `accessPair()` helper for creating read/manage access rule pairs
|
|
23
|
+
- Added `access()` builder for individual access rules
|
|
24
|
+
- Replaced `Permission` type with `AccessRule` throughout
|
|
25
|
+
|
|
26
|
+
### API Changes
|
|
27
|
+
|
|
28
|
+
- `env.registerPermissions()` → `env.registerAccessRules()`
|
|
29
|
+
- `meta.permissions` → `meta.access` in RPC contracts
|
|
30
|
+
- `usePermission()` → `useAccess()` in frontend hooks
|
|
31
|
+
- Route `permission:` field → `accessRule:` field
|
|
32
|
+
|
|
33
|
+
### UI Changes
|
|
34
|
+
|
|
35
|
+
- "Roles & Permissions" tab → "Roles & Access Rules"
|
|
36
|
+
- "You don't have permission..." → "You don't have access..."
|
|
37
|
+
- All permission-related UI text updated
|
|
38
|
+
|
|
39
|
+
### Documentation & Templates
|
|
40
|
+
|
|
41
|
+
- Updated 18 documentation files with AccessRule terminology
|
|
42
|
+
- Updated 7 scaffolding templates with `accessPair()` pattern
|
|
43
|
+
- All code examples use new AccessRule API
|
|
44
|
+
|
|
45
|
+
## Migration Guide
|
|
46
|
+
|
|
47
|
+
### Backend Plugins
|
|
48
|
+
|
|
49
|
+
```diff
|
|
50
|
+
- import { permissionList } from "./permissions";
|
|
51
|
+
- env.registerPermissions(permissionList);
|
|
52
|
+
+ import { accessRules } from "./access";
|
|
53
|
+
+ env.registerAccessRules(accessRules);
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### RPC Contracts
|
|
57
|
+
|
|
58
|
+
```diff
|
|
59
|
+
- .meta({ userType: "user", permissions: [permissions.read.id] })
|
|
60
|
+
+ .meta({ userType: "user", access: [access.read] })
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Frontend Hooks
|
|
64
|
+
|
|
65
|
+
```diff
|
|
66
|
+
- const canRead = accessApi.usePermission(permissions.read.id);
|
|
67
|
+
+ const canRead = accessApi.useAccess(access.read);
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Routes
|
|
71
|
+
|
|
72
|
+
```diff
|
|
73
|
+
- permission: permissions.entityRead.id,
|
|
74
|
+
+ accessRule: access.read,
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Patch Changes
|
|
78
|
+
|
|
79
|
+
- Updated dependencies [9faec1f]
|
|
80
|
+
- Updated dependencies [827b286]
|
|
81
|
+
- Updated dependencies [f533141]
|
|
82
|
+
- Updated dependencies [aa4a8ab]
|
|
83
|
+
- @checkstack/backend-api@0.3.0
|
|
84
|
+
- @checkstack/common@0.2.0
|
|
85
|
+
- @checkstack/signal-common@0.1.0
|
|
86
|
+
|
|
3
87
|
## 0.0.4
|
|
4
88
|
|
|
5
89
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EventBus, Logger } from "@checkstack/backend-api";
|
|
2
|
-
import {
|
|
2
|
+
import { qualifyAccessRuleId } from "@checkstack/common";
|
|
3
3
|
import type {
|
|
4
4
|
Signal,
|
|
5
5
|
SignalMessage,
|
|
@@ -12,9 +12,9 @@ import { SIGNAL_BROADCAST_HOOK, SIGNAL_USER_HOOK } from "./hooks";
|
|
|
12
12
|
* This is a subset of the AuthApi client to avoid circular dependencies.
|
|
13
13
|
*/
|
|
14
14
|
interface AuthClientForSignals {
|
|
15
|
-
|
|
15
|
+
filterUsersByAccessRule: (input: {
|
|
16
16
|
userIds: string[];
|
|
17
|
-
|
|
17
|
+
accessRule: string;
|
|
18
18
|
}) => Promise<string[]>;
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -30,7 +30,7 @@ export class SignalServiceImpl implements SignalService {
|
|
|
30
30
|
constructor(private eventBus: EventBus, private logger: Logger) {}
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* Set the auth client for
|
|
33
|
+
* Set the auth client for access-based signal filtering.
|
|
34
34
|
* This should be called after plugins have loaded.
|
|
35
35
|
*/
|
|
36
36
|
setAuthClient(client: AuthClientForSignals): void {
|
|
@@ -81,7 +81,7 @@ export class SignalServiceImpl implements SignalService {
|
|
|
81
81
|
userIds: string[],
|
|
82
82
|
payload: T,
|
|
83
83
|
pluginMetadata: { pluginId: string },
|
|
84
|
-
|
|
84
|
+
accessRule: { id: string }
|
|
85
85
|
): Promise<void> {
|
|
86
86
|
if (userIds.length === 0) return;
|
|
87
87
|
|
|
@@ -92,18 +92,18 @@ export class SignalServiceImpl implements SignalService {
|
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
// Construct fully-qualified
|
|
96
|
-
const
|
|
95
|
+
// Construct fully-qualified access rule ID: ${pluginMetadata.pluginId}.${accessRule.id}
|
|
96
|
+
const qualifiedAccessRule = qualifyAccessRuleId(pluginMetadata, accessRule);
|
|
97
97
|
|
|
98
98
|
// Filter users via auth RPC
|
|
99
|
-
const authorizedIds = await this.authClient.
|
|
99
|
+
const authorizedIds = await this.authClient.filterUsersByAccessRule({
|
|
100
100
|
userIds,
|
|
101
|
-
|
|
101
|
+
accessRule: qualifiedAccessRule,
|
|
102
102
|
});
|
|
103
103
|
|
|
104
104
|
if (authorizedIds.length === 0) {
|
|
105
105
|
this.logger.debug(
|
|
106
|
-
`No users authorized for signal ${signal.id} with
|
|
106
|
+
`No users authorized for signal ${signal.id} with access ${qualifiedAccessRule}`
|
|
107
107
|
);
|
|
108
108
|
return;
|
|
109
109
|
}
|