@checkstack/notification-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 CHANGED
@@ -1,5 +1,88 @@
1
1
  # @checkstack/notification-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
+ - @checkstack/signal-common@0.1.0
77
+
78
+ ## 0.0.4
79
+
80
+ ### Patch Changes
81
+
82
+ - Updated dependencies [8e43507]
83
+ - @checkstack/common@0.1.0
84
+ - @checkstack/signal-common@0.0.4
85
+
3
86
  ## 0.0.3
4
87
 
5
88
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/notification-common",
3
- "version": "0.0.3",
3
+ "version": "0.1.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
package/src/access.ts ADDED
@@ -0,0 +1,20 @@
1
+ import { access } from "@checkstack/common";
2
+
3
+ /**
4
+ * Access rules for the Notification plugin.
5
+ */
6
+ export const notificationAccess = {
7
+ /**
8
+ * Configure notification settings and send broadcasts.
9
+ */
10
+ admin: access(
11
+ "notification",
12
+ "manage",
13
+ "Configure notification settings and send broadcasts"
14
+ ),
15
+ };
16
+
17
+ /**
18
+ * All access rules for registration with the plugin system.
19
+ */
20
+ export const notificationAccessRules = [notificationAccess.admin];
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from "./schemas";
2
- export * from "./permissions";
2
+ export * from "./access";
3
3
  export * from "./rpc-contract";
4
4
  export * from "./signals";
5
5
  export * from "./plugin-metadata";
@@ -1,6 +1,6 @@
1
1
  import { oc } from "@orpc/contract";
2
2
  import { z } from "zod";
3
- import { permissions } from "./permissions";
3
+ import { notificationAccess } from "./access";
4
4
  import { pluginMetadata } from "./plugin-metadata";
5
5
  import {
6
6
  createClientDefinition,
@@ -14,7 +14,7 @@ import {
14
14
  PaginationInputSchema,
15
15
  } from "./schemas";
16
16
 
17
- // Base builder with full metadata support (userType + permissions)
17
+ // Base builder with full metadata support (userType + access)
18
18
  const _base = oc.$meta<ProcedureMetadata>({});
19
19
 
20
20
  // Notification RPC Contract
@@ -98,14 +98,14 @@ export const notificationContract = {
98
98
  .output(z.void()),
99
99
 
100
100
  // ==========================================================================
101
- // ADMIN SETTINGS ENDPOINTS (userType: "user" with admin permissions)
101
+ // ADMIN SETTINGS ENDPOINTS (userType: "user" with admin accesss)
102
102
  // ==========================================================================
103
103
 
104
104
  // Get retention schema for DynamicForm
105
105
  getRetentionSchema: _base
106
106
  .meta({
107
107
  userType: "user",
108
- permissions: [permissions.notificationAdmin.id],
108
+ access: [notificationAccess.admin],
109
109
  })
110
110
  .output(z.record(z.string(), z.unknown())),
111
111
 
@@ -113,7 +113,7 @@ export const notificationContract = {
113
113
  getRetentionSettings: _base
114
114
  .meta({
115
115
  userType: "user",
116
- permissions: [permissions.notificationAdmin.id],
116
+ access: [notificationAccess.admin],
117
117
  })
118
118
  .output(RetentionSettingsSchema),
119
119
 
@@ -121,7 +121,7 @@ export const notificationContract = {
121
121
  setRetentionSettings: _base
122
122
  .meta({
123
123
  userType: "user",
124
- permissions: [permissions.notificationAdmin.id],
124
+ access: [notificationAccess.admin],
125
125
  })
126
126
  .input(RetentionSettingsSchema)
127
127
  .output(z.void()),
@@ -256,14 +256,14 @@ export const notificationContract = {
256
256
  ),
257
257
 
258
258
  // ==========================================================================
259
- // DELIVERY STRATEGY ADMIN ENDPOINTS (userType: "user" with admin permissions)
259
+ // DELIVERY STRATEGY ADMIN ENDPOINTS (userType: "user" with admin accesss)
260
260
  // ==========================================================================
261
261
 
262
262
  // Get all registered delivery strategies with current config
263
263
  getDeliveryStrategies: _base
264
264
  .meta({
265
265
  userType: "user",
266
- permissions: [permissions.notificationAdmin.id],
266
+ access: [notificationAccess.admin],
267
267
  })
268
268
  .output(
269
269
  z.array(
@@ -304,7 +304,7 @@ export const notificationContract = {
304
304
  updateDeliveryStrategy: _base
305
305
  .meta({
306
306
  userType: "user",
307
- permissions: [permissions.notificationAdmin.id],
307
+ access: [notificationAccess.admin],
308
308
  })
309
309
  .input(
310
310
  z.object({
@@ -1,12 +0,0 @@
1
- import { createPermission } from "@checkstack/common";
2
-
3
- export const permissions = {
4
- /** Configure retention policy and send broadcasts */
5
- notificationAdmin: createPermission(
6
- "notification",
7
- "manage",
8
- "Configure notification settings and send broadcasts"
9
- ),
10
- };
11
-
12
- export const permissionList = Object.values(permissions);