@checkstack/incident-backend 0.2.0 → 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 +74 -0
- package/package.json +1 -1
- package/src/router.ts +18 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,79 @@
|
|
|
1
1
|
# @checkstack/incident-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/incident-common@0.3.0
|
|
62
|
+
- @checkstack/integration-common@0.2.0
|
|
63
|
+
- @checkstack/integration-backend@0.1.2
|
|
64
|
+
- @checkstack/catalog-backend@0.2.2
|
|
65
|
+
- @checkstack/command-backend@0.1.2
|
|
66
|
+
- @checkstack/signal-common@0.1.1
|
|
67
|
+
|
|
68
|
+
## 0.2.1
|
|
69
|
+
|
|
70
|
+
### Patch Changes
|
|
71
|
+
|
|
72
|
+
- @checkstack/backend-api@0.3.1
|
|
73
|
+
- @checkstack/integration-backend@0.1.1
|
|
74
|
+
- @checkstack/catalog-backend@0.2.1
|
|
75
|
+
- @checkstack/command-backend@0.1.1
|
|
76
|
+
|
|
3
77
|
## 0.2.0
|
|
4
78
|
|
|
5
79
|
### Minor Changes
|
package/package.json
CHANGED
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;
|