@checkstack/command-common 0.1.0 → 0.2.1

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,71 @@
1
1
  # @checkstack/command-common
2
2
 
3
+ ## 0.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [83557c7]
8
+ - @checkstack/common@0.4.0
9
+
10
+ ## 0.2.0
11
+
12
+ ### Minor Changes
13
+
14
+ - 7a23261: ## TanStack Query Integration
15
+
16
+ Migrated all frontend components to use `usePluginClient` hook with TanStack Query integration, replacing the legacy `forPlugin()` pattern.
17
+
18
+ ### New Features
19
+
20
+ - **`usePluginClient` hook**: Provides type-safe access to plugin APIs with `.useQuery()` and `.useMutation()` methods
21
+ - **Automatic request deduplication**: Multiple components requesting the same data share a single network request
22
+ - **Built-in caching**: Configurable stale time and cache duration per query
23
+ - **Loading/error states**: TanStack Query provides `isLoading`, `error`, `isRefetching` states automatically
24
+ - **Background refetching**: Stale data is automatically refreshed when components mount
25
+
26
+ ### Contract Changes
27
+
28
+ All RPC contracts now require `operationType: "query"` or `operationType: "mutation"` metadata:
29
+
30
+ ```typescript
31
+ const getItems = proc()
32
+ .meta({ operationType: "query", access: [access.read] })
33
+ .output(z.array(itemSchema))
34
+ .query();
35
+
36
+ const createItem = proc()
37
+ .meta({ operationType: "mutation", access: [access.manage] })
38
+ .input(createItemSchema)
39
+ .output(itemSchema)
40
+ .mutation();
41
+ ```
42
+
43
+ ### Migration
44
+
45
+ ```typescript
46
+ // Before (forPlugin pattern)
47
+ const api = useApi(myPluginApiRef);
48
+ const [items, setItems] = useState<Item[]>([]);
49
+ useEffect(() => {
50
+ api.getItems().then(setItems);
51
+ }, [api]);
52
+
53
+ // After (usePluginClient pattern)
54
+ const client = usePluginClient(MyPluginApi);
55
+ const { data: items, isLoading } = client.getItems.useQuery({});
56
+ ```
57
+
58
+ ### Bug Fixes
59
+
60
+ - Fixed `rpc.test.ts` test setup for middleware type inference
61
+ - Fixed `SearchDialog` to use `setQuery` instead of deprecated `search` method
62
+ - Fixed null→undefined warnings in notification and queue frontends
63
+
64
+ ### Patch Changes
65
+
66
+ - Updated dependencies [7a23261]
67
+ - @checkstack/common@0.3.0
68
+
3
69
  ## 0.1.0
4
70
 
5
71
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/command-common",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
package/src/index.ts CHANGED
@@ -1,9 +1,8 @@
1
- import { oc } from "@orpc/contract";
2
1
  import { z } from "zod";
3
2
  import {
4
3
  createClientDefinition,
5
4
  definePluginMetadata,
6
- type ProcedureMetadata,
5
+ proc,
7
6
  } from "@checkstack/common";
8
7
 
9
8
  // =============================================================================
@@ -64,8 +63,6 @@ export type Command = z.infer<typeof CommandSchema>;
64
63
  // RPC CONTRACT
65
64
  // =============================================================================
66
65
 
67
- const _base = oc.$meta<ProcedureMetadata>({});
68
-
69
66
  /**
70
67
  * Command palette RPC contract.
71
68
  * Provides search functionality across all registered providers.
@@ -75,8 +72,11 @@ export const commandContract = {
75
72
  * Search across all registered search providers.
76
73
  * Returns results filtered by user access rules.
77
74
  */
78
- search: _base
79
- .meta({ userType: "public" })
75
+ search: proc({
76
+ operationType: "query",
77
+ userType: "public",
78
+ access: [],
79
+ })
80
80
  .input(z.object({ query: z.string() }))
81
81
  .output(z.array(SearchResultSchema)),
82
82
 
@@ -84,9 +84,11 @@ export const commandContract = {
84
84
  * Get all registered commands (for browsing without a query).
85
85
  * Returns commands filtered by user access rules.
86
86
  */
87
- getCommands: _base
88
- .meta({ userType: "public" })
89
- .output(z.array(SearchResultSchema)),
87
+ getCommands: proc({
88
+ operationType: "query",
89
+ userType: "public",
90
+ access: [],
91
+ }).output(z.array(SearchResultSchema)),
90
92
  };
91
93
 
92
94
  export type CommandContract = typeof commandContract;