@checkstack/incident-backend 0.2.1 → 0.2.3

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,78 @@
1
1
  # @checkstack/incident-backend
2
2
 
3
+ ## 0.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - @checkstack/catalog-common@1.2.1
8
+ - @checkstack/incident-common@0.3.1
9
+ - @checkstack/catalog-backend@0.2.3
10
+
11
+ ## 0.2.2
12
+
13
+ ### Patch Changes
14
+
15
+ - 7a23261: ## TanStack Query Integration
16
+
17
+ Migrated all frontend components to use `usePluginClient` hook with TanStack Query integration, replacing the legacy `forPlugin()` pattern.
18
+
19
+ ### New Features
20
+
21
+ - **`usePluginClient` hook**: Provides type-safe access to plugin APIs with `.useQuery()` and `.useMutation()` methods
22
+ - **Automatic request deduplication**: Multiple components requesting the same data share a single network request
23
+ - **Built-in caching**: Configurable stale time and cache duration per query
24
+ - **Loading/error states**: TanStack Query provides `isLoading`, `error`, `isRefetching` states automatically
25
+ - **Background refetching**: Stale data is automatically refreshed when components mount
26
+
27
+ ### Contract Changes
28
+
29
+ All RPC contracts now require `operationType: "query"` or `operationType: "mutation"` metadata:
30
+
31
+ ```typescript
32
+ const getItems = proc()
33
+ .meta({ operationType: "query", access: [access.read] })
34
+ .output(z.array(itemSchema))
35
+ .query();
36
+
37
+ const createItem = proc()
38
+ .meta({ operationType: "mutation", access: [access.manage] })
39
+ .input(createItemSchema)
40
+ .output(itemSchema)
41
+ .mutation();
42
+ ```
43
+
44
+ ### Migration
45
+
46
+ ```typescript
47
+ // Before (forPlugin pattern)
48
+ const api = useApi(myPluginApiRef);
49
+ const [items, setItems] = useState<Item[]>([]);
50
+ useEffect(() => {
51
+ api.getItems().then(setItems);
52
+ }, [api]);
53
+
54
+ // After (usePluginClient pattern)
55
+ const client = usePluginClient(MyPluginApi);
56
+ const { data: items, isLoading } = client.getItems.useQuery({});
57
+ ```
58
+
59
+ ### Bug Fixes
60
+
61
+ - Fixed `rpc.test.ts` test setup for middleware type inference
62
+ - Fixed `SearchDialog` to use `setQuery` instead of deprecated `search` method
63
+ - Fixed null→undefined warnings in notification and queue frontends
64
+
65
+ - Updated dependencies [7a23261]
66
+ - @checkstack/common@0.3.0
67
+ - @checkstack/backend-api@0.3.2
68
+ - @checkstack/catalog-common@1.2.0
69
+ - @checkstack/incident-common@0.3.0
70
+ - @checkstack/integration-common@0.2.0
71
+ - @checkstack/integration-backend@0.1.2
72
+ - @checkstack/catalog-backend@0.2.2
73
+ - @checkstack/command-backend@0.1.2
74
+ - @checkstack/signal-common@0.1.1
75
+
3
76
  ## 0.2.1
4
77
 
5
78
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/incident-backend",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "scripts": {
package/src/router.ts CHANGED
@@ -98,6 +98,24 @@ export function createRouter(
98
98
  }
99
99
  ),
100
100
 
101
+ getBulkIncidentsForSystems: os.getBulkIncidentsForSystems.handler(
102
+ async ({ input }) => {
103
+ const incidents: Record<
104
+ string,
105
+ Awaited<ReturnType<typeof service.getIncidentsForSystem>>
106
+ > = {};
107
+
108
+ // Fetch incidents for each system in parallel
109
+ await Promise.all(
110
+ input.systemIds.map(async (systemId) => {
111
+ incidents[systemId] = await service.getIncidentsForSystem(systemId);
112
+ })
113
+ );
114
+
115
+ return { incidents };
116
+ }
117
+ ),
118
+
101
119
  createIncident: os.createIncident.handler(async ({ input, context }) => {
102
120
  const userId =
103
121
  context.user && "id" in context.user ? context.user.id : undefined;