@checkstack/integration-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/integration-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/integration-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 Integration plugin.
5
+ */
6
+ export const integrationAccess = {
7
+ /**
8
+ * Manage webhook integrations and view delivery logs.
9
+ */
10
+ manage: access(
11
+ "integration",
12
+ "manage",
13
+ "Manage webhook integrations and view delivery logs"
14
+ ),
15
+ };
16
+
17
+ /**
18
+ * All access rules for registration with the plugin system.
19
+ */
20
+ export const integrationAccessRules = [integrationAccess.manage];
package/src/index.ts CHANGED
@@ -48,8 +48,8 @@ export {
48
48
  // are defined in @checkstack/integration-backend/provider-types.
49
49
  // Frontend code should only use the Zod schemas above for API contracts.
50
50
 
51
- // Permissions
52
- export * from "./permissions";
51
+ // Access rules
52
+ export * from "./access";
53
53
 
54
54
  // RPC Contract
55
55
  export * from "./rpc-contract";
@@ -1,6 +1,6 @@
1
1
  import { oc } from "@orpc/contract";
2
2
  import { z } from "zod";
3
- import { permissions } from "./permissions";
3
+ import { integrationAccess } from "./access";
4
4
  import { pluginMetadata } from "./plugin-metadata";
5
5
  import {
6
6
  createClientDefinition,
@@ -23,7 +23,7 @@ import {
23
23
  EventPayloadSchemaOutputSchema,
24
24
  } from "./schemas";
25
25
 
26
- // Base builder with full metadata support (userType + permissions)
26
+ // Base builder with full metadata support (userType + access)
27
27
  const _base = oc.$meta<ProcedureMetadata>({});
28
28
 
29
29
  // Integration RPC Contract
@@ -36,7 +36,7 @@ export const integrationContract = {
36
36
  listSubscriptions: _base
37
37
  .meta({
38
38
  userType: "authenticated",
39
- permissions: [permissions.integrationManage.id],
39
+ access: [integrationAccess.manage],
40
40
  })
41
41
  .input(
42
42
  z.object({
@@ -58,7 +58,7 @@ export const integrationContract = {
58
58
  getSubscription: _base
59
59
  .meta({
60
60
  userType: "authenticated",
61
- permissions: [permissions.integrationManage.id],
61
+ access: [integrationAccess.manage],
62
62
  })
63
63
  .input(z.object({ id: z.string() }))
64
64
  .output(WebhookSubscriptionSchema),
@@ -67,7 +67,7 @@ export const integrationContract = {
67
67
  createSubscription: _base
68
68
  .meta({
69
69
  userType: "authenticated",
70
- permissions: [permissions.integrationManage.id],
70
+ access: [integrationAccess.manage],
71
71
  })
72
72
  .input(CreateSubscriptionInputSchema)
73
73
  .output(WebhookSubscriptionSchema),
@@ -76,7 +76,7 @@ export const integrationContract = {
76
76
  updateSubscription: _base
77
77
  .meta({
78
78
  userType: "authenticated",
79
- permissions: [permissions.integrationManage.id],
79
+ access: [integrationAccess.manage],
80
80
  })
81
81
  .input(UpdateSubscriptionInputSchema)
82
82
  .output(WebhookSubscriptionSchema),
@@ -85,7 +85,7 @@ export const integrationContract = {
85
85
  deleteSubscription: _base
86
86
  .meta({
87
87
  userType: "authenticated",
88
- permissions: [permissions.integrationManage.id],
88
+ access: [integrationAccess.manage],
89
89
  })
90
90
  .input(z.object({ id: z.string() }))
91
91
  .output(z.object({ success: z.boolean() })),
@@ -94,7 +94,7 @@ export const integrationContract = {
94
94
  toggleSubscription: _base
95
95
  .meta({
96
96
  userType: "authenticated",
97
- permissions: [permissions.integrationManage.id],
97
+ access: [integrationAccess.manage],
98
98
  })
99
99
  .input(z.object({ id: z.string(), enabled: z.boolean() }))
100
100
  .output(z.object({ success: z.boolean() })),
@@ -107,7 +107,7 @@ export const integrationContract = {
107
107
  listProviders: _base
108
108
  .meta({
109
109
  userType: "authenticated",
110
- permissions: [permissions.integrationManage.id],
110
+ access: [integrationAccess.manage],
111
111
  })
112
112
  .output(z.array(IntegrationProviderInfoSchema)),
113
113
 
@@ -115,7 +115,7 @@ export const integrationContract = {
115
115
  testProviderConnection: _base
116
116
  .meta({
117
117
  userType: "authenticated",
118
- permissions: [permissions.integrationManage.id],
118
+ access: [integrationAccess.manage],
119
119
  })
120
120
  .input(
121
121
  z.object({
@@ -134,7 +134,7 @@ export const integrationContract = {
134
134
  listConnections: _base
135
135
  .meta({
136
136
  userType: "authenticated",
137
- permissions: [permissions.integrationManage.id],
137
+ access: [integrationAccess.manage],
138
138
  })
139
139
  .input(z.object({ providerId: z.string() }))
140
140
  .output(z.array(ProviderConnectionRedactedSchema)),
@@ -143,7 +143,7 @@ export const integrationContract = {
143
143
  getConnection: _base
144
144
  .meta({
145
145
  userType: "authenticated",
146
- permissions: [permissions.integrationManage.id],
146
+ access: [integrationAccess.manage],
147
147
  })
148
148
  .input(z.object({ connectionId: z.string() }))
149
149
  .output(ProviderConnectionRedactedSchema),
@@ -152,7 +152,7 @@ export const integrationContract = {
152
152
  createConnection: _base
153
153
  .meta({
154
154
  userType: "authenticated",
155
- permissions: [permissions.integrationManage.id],
155
+ access: [integrationAccess.manage],
156
156
  })
157
157
  .input(CreateConnectionInputSchema)
158
158
  .output(ProviderConnectionRedactedSchema),
@@ -161,7 +161,7 @@ export const integrationContract = {
161
161
  updateConnection: _base
162
162
  .meta({
163
163
  userType: "authenticated",
164
- permissions: [permissions.integrationManage.id],
164
+ access: [integrationAccess.manage],
165
165
  })
166
166
  .input(UpdateConnectionInputSchema)
167
167
  .output(ProviderConnectionRedactedSchema),
@@ -170,7 +170,7 @@ export const integrationContract = {
170
170
  deleteConnection: _base
171
171
  .meta({
172
172
  userType: "authenticated",
173
- permissions: [permissions.integrationManage.id],
173
+ access: [integrationAccess.manage],
174
174
  })
175
175
  .input(z.object({ connectionId: z.string() }))
176
176
  .output(z.object({ success: z.boolean() })),
@@ -179,7 +179,7 @@ export const integrationContract = {
179
179
  testConnection: _base
180
180
  .meta({
181
181
  userType: "authenticated",
182
- permissions: [permissions.integrationManage.id],
182
+ access: [integrationAccess.manage],
183
183
  })
184
184
  .input(z.object({ connectionId: z.string() }))
185
185
  .output(TestConnectionResultSchema),
@@ -188,7 +188,7 @@ export const integrationContract = {
188
188
  getConnectionOptions: _base
189
189
  .meta({
190
190
  userType: "authenticated",
191
- permissions: [permissions.integrationManage.id],
191
+ access: [integrationAccess.manage],
192
192
  })
193
193
  .input(GetConnectionOptionsInputSchema)
194
194
  .output(z.array(ConnectionOptionSchema)),
@@ -201,7 +201,7 @@ export const integrationContract = {
201
201
  listEventTypes: _base
202
202
  .meta({
203
203
  userType: "authenticated",
204
- permissions: [permissions.integrationManage.id],
204
+ access: [integrationAccess.manage],
205
205
  })
206
206
  .output(z.array(IntegrationEventInfoSchema)),
207
207
 
@@ -209,7 +209,7 @@ export const integrationContract = {
209
209
  getEventsByCategory: _base
210
210
  .meta({
211
211
  userType: "authenticated",
212
- permissions: [permissions.integrationManage.id],
212
+ access: [integrationAccess.manage],
213
213
  })
214
214
  .output(
215
215
  z.array(
@@ -224,7 +224,7 @@ export const integrationContract = {
224
224
  getEventPayloadSchema: _base
225
225
  .meta({
226
226
  userType: "authenticated",
227
- permissions: [permissions.integrationManage.id],
227
+ access: [integrationAccess.manage],
228
228
  })
229
229
  .input(z.object({ eventId: z.string() }))
230
230
  .output(EventPayloadSchemaOutputSchema),
@@ -237,7 +237,7 @@ export const integrationContract = {
237
237
  getDeliveryLogs: _base
238
238
  .meta({
239
239
  userType: "authenticated",
240
- permissions: [permissions.integrationManage.id],
240
+ access: [integrationAccess.manage],
241
241
  })
242
242
  .input(DeliveryLogQueryInputSchema)
243
243
  .output(
@@ -251,7 +251,7 @@ export const integrationContract = {
251
251
  getDeliveryLog: _base
252
252
  .meta({
253
253
  userType: "authenticated",
254
- permissions: [permissions.integrationManage.id],
254
+ access: [integrationAccess.manage],
255
255
  })
256
256
  .input(z.object({ id: z.string() }))
257
257
  .output(DeliveryLogSchema),
@@ -260,7 +260,7 @@ export const integrationContract = {
260
260
  retryDelivery: _base
261
261
  .meta({
262
262
  userType: "authenticated",
263
- permissions: [permissions.integrationManage.id],
263
+ access: [integrationAccess.manage],
264
264
  })
265
265
  .input(z.object({ logId: z.string() }))
266
266
  .output(z.object({ success: z.boolean(), message: z.string().optional() })),
@@ -269,7 +269,7 @@ export const integrationContract = {
269
269
  getDeliveryStats: _base
270
270
  .meta({
271
271
  userType: "authenticated",
272
- permissions: [permissions.integrationManage.id],
272
+ access: [integrationAccess.manage],
273
273
  })
274
274
  .input(
275
275
  z.object({
@@ -1,12 +0,0 @@
1
- import { createPermission } from "@checkstack/common";
2
-
3
- export const permissions = {
4
- /** Manage webhook integrations and view delivery logs */
5
- integrationManage: createPermission(
6
- "integration",
7
- "manage",
8
- "Manage webhook integrations and view delivery logs"
9
- ),
10
- };
11
-
12
- export const permissionList = Object.values(permissions);