@checkstack/catalog-common 0.0.3 → 1.0.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,104 @@
1
1
  # @checkstack/catalog-common
2
2
 
3
+ ## 1.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 8e43507: BREAKING: `getSystems` now returns `{ systems: [...] }` instead of plain array
8
+
9
+ This change enables resource-level access control filtering for the catalog plugin. The middleware needs a consistent object format with named keys to perform post-execution filtering on list endpoints.
10
+
11
+ ## Breaking Changes
12
+
13
+ - `getSystems()` now returns `{ systems: System[] }` instead of `System[]`
14
+ - All call sites must update to destructure: `const { systems } = await api.getSystems()`
15
+
16
+ ## New Features
17
+
18
+ - Added `resourceAccess` metadata to catalog endpoints:
19
+ - `getSystems`: List filtering by team access
20
+ - `getSystem`: Single resource pre-check by team access
21
+ - `getEntities`: List filtering for systems by team access
22
+
23
+ ## Migration
24
+
25
+ ```diff
26
+ - const systems = await catalogApi.getSystems();
27
+ + const { systems } = await catalogApi.getSystems();
28
+ ```
29
+
30
+ ### Minor Changes
31
+
32
+ - 8e43507: # Teams and Resource-Level Access Control
33
+
34
+ This release introduces a comprehensive Teams system for organizing users and controlling access to resources at a granular level.
35
+
36
+ ## Features
37
+
38
+ ### Team Management
39
+
40
+ - Create, update, and delete teams with name and description
41
+ - Add/remove users from teams
42
+ - Designate team managers with elevated privileges
43
+ - View team membership and manager status
44
+
45
+ ### Resource-Level Access Control
46
+
47
+ - Grant teams access to specific resources (systems, health checks, incidents, maintenances)
48
+ - Configure read-only or manage permissions per team
49
+ - Resource-level "Team Only" mode that restricts access exclusively to team members
50
+ - Separate `resourceAccessSettings` table for resource-level settings (not per-grant)
51
+ - Automatic cleanup of grants when teams are deleted (database cascade)
52
+
53
+ ### Middleware Integration
54
+
55
+ - Extended `autoAuthMiddleware` to support resource access checks
56
+ - Single-resource pre-handler validation for detail endpoints
57
+ - Automatic list filtering for collection endpoints
58
+ - S2S endpoints for access verification
59
+
60
+ ### Frontend Components
61
+
62
+ - `TeamsTab` component for managing teams in Auth Settings
63
+ - `TeamAccessEditor` component for assigning team access to resources
64
+ - Resource-level "Team Only" toggle in `TeamAccessEditor`
65
+ - Integration into System, Health Check, Incident, and Maintenance editors
66
+
67
+ ## Breaking Changes
68
+
69
+ ### API Response Format Changes
70
+
71
+ List endpoints now return objects with named keys instead of arrays directly:
72
+
73
+ ```typescript
74
+ // Before
75
+ const systems = await catalogApi.getSystems();
76
+
77
+ // After
78
+ const { systems } = await catalogApi.getSystems();
79
+ ```
80
+
81
+ Affected endpoints:
82
+
83
+ - `catalog.getSystems` → `{ systems: [...] }`
84
+ - `healthcheck.getConfigurations` → `{ configurations: [...] }`
85
+ - `incident.listIncidents` → `{ incidents: [...] }`
86
+ - `maintenance.listMaintenances` → `{ maintenances: [...] }`
87
+
88
+ ### User Identity Enrichment
89
+
90
+ `RealUser` and `ApplicationUser` types now include `teamIds: string[]` field with team memberships.
91
+
92
+ ## Documentation
93
+
94
+ See `docs/backend/teams.md` for complete API reference and integration guide.
95
+
96
+ ### Patch Changes
97
+
98
+ - Updated dependencies [8e43507]
99
+ - @checkstack/common@0.1.0
100
+ - @checkstack/frontend-api@0.0.4
101
+
3
102
  ## 0.0.3
4
103
 
5
104
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/catalog-common",
3
- "version": "0.0.3",
3
+ "version": "1.0.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,6 +1,8 @@
1
1
  import { oc } from "@orpc/contract";
2
2
  import {
3
3
  createClientDefinition,
4
+ createResourceAccess,
5
+ createResourceAccessList,
4
6
  type ProcedureMetadata,
5
7
  } from "@checkstack/common";
6
8
  import { pluginMetadata } from "./plugin-metadata";
@@ -11,6 +13,10 @@ import { permissions } from "./permissions";
11
13
  // Base builder with full metadata support
12
14
  const _base = oc.$meta<ProcedureMetadata>({});
13
15
 
16
+ // Resource access configurations for team-based access control
17
+ const systemAccess = createResourceAccess("system", "systemId");
18
+ const systemListAccess = createResourceAccessList("system", "systems");
19
+
14
20
  // Input schemas that match the service layer expectations
15
21
  const CreateSystemInputSchema = z.object({
16
22
  name: z.string(),
@@ -55,7 +61,11 @@ export const catalogContract = {
55
61
  // ==========================================================================
56
62
 
57
63
  getEntities: _base
58
- .meta({ userType: "public", permissions: [permissions.catalogRead.id] })
64
+ .meta({
65
+ userType: "public",
66
+ permissions: [permissions.catalogRead.id],
67
+ resourceAccess: [systemListAccess],
68
+ })
59
69
  .output(
60
70
  z.object({
61
71
  systems: z.array(SystemSchema),
@@ -64,11 +74,19 @@ export const catalogContract = {
64
74
  ),
65
75
 
66
76
  getSystems: _base
67
- .meta({ userType: "public", permissions: [permissions.catalogRead.id] })
68
- .output(z.array(SystemSchema)),
77
+ .meta({
78
+ userType: "public",
79
+ permissions: [permissions.catalogRead.id],
80
+ resourceAccess: [systemListAccess],
81
+ })
82
+ .output(z.object({ systems: z.array(SystemSchema) })),
69
83
 
70
84
  getSystem: _base
71
- .meta({ userType: "public", permissions: [permissions.catalogRead.id] })
85
+ .meta({
86
+ userType: "public",
87
+ permissions: [permissions.catalogRead.id],
88
+ resourceAccess: [systemAccess],
89
+ })
72
90
  .input(z.object({ systemId: z.string() }))
73
91
  .output(SystemSchema.nullable()),
74
92