@spoosh/plugin-deduplication 0.1.1 → 0.1.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/README.md CHANGED
@@ -13,17 +13,19 @@ npm install @spoosh/plugin-deduplication
13
13
  ## Usage
14
14
 
15
15
  ```typescript
16
+ import { Spoosh } from "@spoosh/core";
16
17
  import { deduplicationPlugin } from "@spoosh/plugin-deduplication";
17
18
 
18
- // Default: dedupe reads, not writes
19
- const plugins = [deduplicationPlugin()] as const;
19
+ const client = new Spoosh<ApiSchema, Error>("/api")
20
+ .use([
21
+ deduplicationPlugin(),
22
+ ]);
20
23
 
21
- // Enable deduplication for writes too
22
- // Extreme caution: may cause unintended side effects
23
- // **Avoid using it unless you fully understand the implications**
24
- const plugins = [deduplicationPlugin({ write: "in-flight" })] as const;
24
+ const client = new Spoosh<ApiSchema, Error>("/api")
25
+ .use([
26
+ deduplicationPlugin({ write: "in-flight" }),
27
+ ]);
25
28
 
26
- // Per-request override
27
29
  useRead((api) => api.posts.$get(), { dedupe: false });
28
30
  ```
29
31
 
package/dist/index.d.mts CHANGED
@@ -44,11 +44,17 @@ declare module "@spoosh/core" {
44
44
  *
45
45
  * @example
46
46
  * ```ts
47
- * const plugins = [deduplicationPlugin({ read: "in-flight" })];
47
+ * import { Spoosh } from "@spoosh/core";
48
+ *
49
+ * const client = new Spoosh<ApiSchema, Error>("/api")
50
+ * .use([
51
+ * // ... other plugins
52
+ * deduplicationPlugin({ read: "in-flight" }),
53
+ * ]);
48
54
  *
49
55
  * // Per-query override
50
56
  * useRead((api) => api.posts.$get(), {
51
- * dedupe: false, // Disable deduplication for this query
57
+ * dedupe: false,
52
58
  * });
53
59
  * ```
54
60
  */
package/dist/index.d.ts CHANGED
@@ -44,11 +44,17 @@ declare module "@spoosh/core" {
44
44
  *
45
45
  * @example
46
46
  * ```ts
47
- * const plugins = [deduplicationPlugin({ read: "in-flight" })];
47
+ * import { Spoosh } from "@spoosh/core";
48
+ *
49
+ * const client = new Spoosh<ApiSchema, Error>("/api")
50
+ * .use([
51
+ * // ... other plugins
52
+ * deduplicationPlugin({ read: "in-flight" }),
53
+ * ]);
48
54
  *
49
55
  * // Per-query override
50
56
  * useRead((api) => api.posts.$get(), {
51
- * dedupe: false, // Disable deduplication for this query
57
+ * dedupe: false,
52
58
  * });
53
59
  * ```
54
60
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spoosh/plugin-deduplication",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Request deduplication plugin for Spoosh - prevents duplicate in-flight requests",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -33,11 +33,11 @@
33
33
  }
34
34
  },
35
35
  "peerDependencies": {
36
- "@spoosh/core": ">=0.2.0"
36
+ "@spoosh/core": ">=0.3.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@spoosh/core": "0.2.0",
40
- "@spoosh/test-utils": "0.1.1"
39
+ "@spoosh/core": "0.3.0",
40
+ "@spoosh/test-utils": "0.1.3"
41
41
  },
42
42
  "scripts": {
43
43
  "dev": "tsup --watch",