@checkstack/maintenance-backend 0.2.1 → 0.2.2

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