@spoosh/plugin-invalidation 0.1.2 → 0.1.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.
Files changed (2) hide show
  1. package/README.md +4 -7
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -19,10 +19,10 @@ Tags are automatically generated from the API path hierarchy:
19
19
  useRead((api) => api.users.$get());
20
20
  // → tags: ["users"]
21
21
 
22
- useRead((api) => api.users[123].$get());
22
+ useRead((api) => api.users(123).$get());
23
23
  // → tags: ["users", "users/123"]
24
24
 
25
- useRead((api) => api.users[123].posts.$get());
25
+ useRead((api) => api.users(123).posts.$get());
26
26
  // → tags: ["users", "users/123", "users/123/posts"]
27
27
  ```
28
28
 
@@ -30,7 +30,7 @@ When a mutation succeeds, related queries are automatically invalidated:
30
30
 
31
31
  ```typescript
32
32
  // Creating a post at users/123/posts invalidates:
33
- const { trigger } = useWrite((api) => api.users[123].posts.$post);
33
+ const { trigger } = useWrite((api) => api.users(123).posts.$post);
34
34
  await trigger({ body: { title: "New Post" } });
35
35
 
36
36
  // ✓ Invalidates: "users", "users/123", "users/123/posts"
@@ -43,10 +43,7 @@ await trigger({ body: { title: "New Post" } });
43
43
  import { Spoosh } from "@spoosh/core";
44
44
  import { invalidationPlugin } from "@spoosh/plugin-invalidation";
45
45
 
46
- const client = new Spoosh<ApiSchema, Error>("/api")
47
- .use([
48
- invalidationPlugin(),
49
- ]);
46
+ const client = new Spoosh<ApiSchema, Error>("/api").use([invalidationPlugin()]);
50
47
 
51
48
  const { trigger } = useWrite((api) => api.posts.$post);
52
49
  await trigger({ body: { title: "New Post" } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spoosh/plugin-invalidation",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Cache invalidation plugin for Spoosh - auto-invalidates after mutations",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -33,11 +33,11 @@
33
33
  }
34
34
  },
35
35
  "peerDependencies": {
36
- "@spoosh/core": ">=0.3.0"
36
+ "@spoosh/core": ">=0.4.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@spoosh/core": "0.3.0",
40
- "@spoosh/test-utils": "0.1.3"
39
+ "@spoosh/test-utils": "0.1.4",
40
+ "@spoosh/core": "0.4.0"
41
41
  },
42
42
  "scripts": {
43
43
  "dev": "tsup --watch",