@spoosh/plugin-transform 0.1.1 → 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.
package/README.md CHANGED
@@ -15,11 +15,11 @@ npm install @spoosh/plugin-transform
15
15
  ### Request Transforms
16
16
 
17
17
  ```typescript
18
+ import { Spoosh } from "@spoosh/core";
18
19
  import { transformPlugin } from "@spoosh/plugin-transform";
19
20
 
20
- const plugins = [transformPlugin()] as const;
21
+ const client = new Spoosh<ApiSchema, Error>("/api").use([transformPlugin()]);
21
22
 
22
- // Transform query parameters
23
23
  const { data } = useRead((api) => api.posts.$get({ query: { page: 1 } }), {
24
24
  transform: {
25
25
  query: (q) => ({ ...q, limit: 10 }),
package/dist/index.d.mts CHANGED
@@ -96,6 +96,14 @@ declare module "@spoosh/core" {
96
96
  *
97
97
  * @example
98
98
  * ```ts
99
+ * import { Spoosh } from "@spoosh/core";
100
+ *
101
+ * const client = new Spoosh<ApiSchema, Error>("/api")
102
+ * .use([
103
+ * // ... other plugins
104
+ * transformPlugin(),
105
+ * ]);
106
+ *
99
107
  * // Per-request transforms with full type inference
100
108
  * const { data, transformedData } = useRead(
101
109
  * (api) => api.posts.$get(),
@@ -109,8 +117,6 @@ declare module "@spoosh/core" {
109
117
  * },
110
118
  * }
111
119
  * );
112
- * // data = original posts array (preserved)
113
- * // transformedData = { count: number, hasMore: boolean }
114
120
  *
115
121
  * // useWrite with body transform
116
122
  * trigger({
package/dist/index.d.ts CHANGED
@@ -96,6 +96,14 @@ declare module "@spoosh/core" {
96
96
  *
97
97
  * @example
98
98
  * ```ts
99
+ * import { Spoosh } from "@spoosh/core";
100
+ *
101
+ * const client = new Spoosh<ApiSchema, Error>("/api")
102
+ * .use([
103
+ * // ... other plugins
104
+ * transformPlugin(),
105
+ * ]);
106
+ *
99
107
  * // Per-request transforms with full type inference
100
108
  * const { data, transformedData } = useRead(
101
109
  * (api) => api.posts.$get(),
@@ -109,8 +117,6 @@ declare module "@spoosh/core" {
109
117
  * },
110
118
  * }
111
119
  * );
112
- * // data = original posts array (preserved)
113
- * // transformedData = { count: number, hasMore: boolean }
114
120
  *
115
121
  * // useWrite with body transform
116
122
  * trigger({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spoosh/plugin-transform",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Data transformation plugin for Spoosh with sync/async support",
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.4.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@spoosh/core": "0.2.0",
40
- "@spoosh/test-utils": "0.1.1"
39
+ "@spoosh/core": "0.4.0",
40
+ "@spoosh/test-utils": "0.1.4"
41
41
  },
42
42
  "scripts": {
43
43
  "dev": "tsup --watch",