@checkstack/queue-common 0.0.3 → 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.
- package/CHANGELOG.md +81 -0
- package/package.json +1 -1
- package/src/access.ts +22 -0
- package/src/index.ts +2 -7
- package/src/rpc-contract.ts +21 -14
- package/src/permissions.ts +0 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,86 @@
|
|
|
1
1
|
# @checkstack/queue-common
|
|
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 [f533141]
|
|
75
|
+
- @checkstack/common@0.2.0
|
|
76
|
+
|
|
77
|
+
## 0.0.4
|
|
78
|
+
|
|
79
|
+
### Patch Changes
|
|
80
|
+
|
|
81
|
+
- Updated dependencies [8e43507]
|
|
82
|
+
- @checkstack/common@0.1.0
|
|
83
|
+
|
|
3
84
|
## 0.0.3
|
|
4
85
|
|
|
5
86
|
### Patch Changes
|
package/package.json
CHANGED
package/src/access.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { accessPair } from "@checkstack/common";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Access rules for the Queue plugin.
|
|
5
|
+
*/
|
|
6
|
+
export const queueAccess = {
|
|
7
|
+
/**
|
|
8
|
+
* Queue settings access.
|
|
9
|
+
*/
|
|
10
|
+
settings: accessPair("queue", {
|
|
11
|
+
read: "Read Queue Settings",
|
|
12
|
+
manage: "Update Queue Settings",
|
|
13
|
+
}),
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* All access rules for registration with the plugin system.
|
|
18
|
+
*/
|
|
19
|
+
export const queueAccessRules = [
|
|
20
|
+
queueAccess.settings.read,
|
|
21
|
+
queueAccess.settings.manage,
|
|
22
|
+
];
|
package/src/index.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
export * from "./schemas";
|
|
2
|
-
export * from "./
|
|
3
|
-
export {
|
|
4
|
-
queueContract,
|
|
5
|
-
QueueApi,
|
|
6
|
-
type QueueContract,
|
|
7
|
-
type QueueMetadata,
|
|
8
|
-
} from "./rpc-contract";
|
|
2
|
+
export * from "./access";
|
|
3
|
+
export { queueContract, QueueApi, type QueueContract } from "./rpc-contract";
|
|
9
4
|
export * from "./plugin-metadata";
|
|
10
5
|
export { queueRoutes } from "./routes";
|
package/src/rpc-contract.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { oc } from "@orpc/contract";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
createClientDefinition,
|
|
4
|
+
type ProcedureMetadata,
|
|
5
|
+
} from "@checkstack/common";
|
|
3
6
|
import { z } from "zod";
|
|
4
|
-
import {
|
|
7
|
+
import { queueAccess } from "./access";
|
|
5
8
|
import { pluginMetadata } from "./plugin-metadata";
|
|
6
9
|
import {
|
|
7
10
|
QueuePluginDtoSchema,
|
|
@@ -9,28 +12,32 @@ import {
|
|
|
9
12
|
UpdateQueueConfigurationSchema,
|
|
10
13
|
} from "./schemas";
|
|
11
14
|
|
|
12
|
-
// Permission metadata type
|
|
13
|
-
export interface QueueMetadata {
|
|
14
|
-
permissions?: string[];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
15
|
// Base builder with metadata support
|
|
18
|
-
const _base = oc.$meta<
|
|
16
|
+
const _base = oc.$meta<ProcedureMetadata>({});
|
|
19
17
|
|
|
20
|
-
// Queue RPC Contract with
|
|
18
|
+
// Queue RPC Contract with access metadata
|
|
21
19
|
export const queueContract = {
|
|
22
|
-
// Queue plugin queries - Read
|
|
20
|
+
// Queue plugin queries - Read access
|
|
23
21
|
getPlugins: _base
|
|
24
|
-
.meta({
|
|
22
|
+
.meta({
|
|
23
|
+
userType: "authenticated",
|
|
24
|
+
access: [queueAccess.settings.read],
|
|
25
|
+
})
|
|
25
26
|
.output(z.array(QueuePluginDtoSchema)),
|
|
26
27
|
|
|
27
28
|
getConfiguration: _base
|
|
28
|
-
.meta({
|
|
29
|
+
.meta({
|
|
30
|
+
userType: "authenticated",
|
|
31
|
+
access: [queueAccess.settings.read],
|
|
32
|
+
})
|
|
29
33
|
.output(QueueConfigurationDtoSchema),
|
|
30
34
|
|
|
31
|
-
// Queue configuration updates - Manage
|
|
35
|
+
// Queue configuration updates - Manage access
|
|
32
36
|
updateConfiguration: _base
|
|
33
|
-
.meta({
|
|
37
|
+
.meta({
|
|
38
|
+
userType: "authenticated",
|
|
39
|
+
access: [queueAccess.settings.manage],
|
|
40
|
+
})
|
|
34
41
|
.input(UpdateQueueConfigurationSchema)
|
|
35
42
|
.output(QueueConfigurationDtoSchema),
|
|
36
43
|
};
|
package/src/permissions.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { createPermission } from "@checkstack/common";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Permissions for queue settings
|
|
5
|
-
*/
|
|
6
|
-
export const permissions = {
|
|
7
|
-
queueRead: createPermission("queue", "read", "Read Queue Settings"),
|
|
8
|
-
queueManage: createPermission("queue", "manage", "Update Queue Settings"),
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const permissionList = Object.values(permissions);
|