@sudobility/svgr_client 1.0.16 → 1.0.18
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 +58 -0
- package/package.json +5 -5
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# @sudobility/svgr_client
|
|
2
|
+
|
|
3
|
+
API client SDK for SVGR with TanStack React Query hooks.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun add @sudobility/svgr_client
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { SvgrClient, useConvert } from "@sudobility/svgr_client";
|
|
15
|
+
|
|
16
|
+
// Direct client usage
|
|
17
|
+
const client = new SvgrClient({ baseUrl: "https://api.svgr.app", networkClient });
|
|
18
|
+
const result = await client.convert(base64Image, "photo.png", 5, true);
|
|
19
|
+
|
|
20
|
+
// React hook usage
|
|
21
|
+
const { mutateAsync } = useConvert(client);
|
|
22
|
+
await mutateAsync({ original: base64Image, filename: "photo.png", quality: 5 });
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## API
|
|
26
|
+
|
|
27
|
+
### SvgrClient
|
|
28
|
+
|
|
29
|
+
Constructed with `{ baseUrl, networkClient, retry? }`. Single endpoint: `POST /api/v1/convert`.
|
|
30
|
+
|
|
31
|
+
### Hooks
|
|
32
|
+
|
|
33
|
+
- `useConvert(client)` -- TanStack Query mutation for image-to-SVG conversion
|
|
34
|
+
- `svgrKeys` -- Query key factory for cache management
|
|
35
|
+
|
|
36
|
+
### Types
|
|
37
|
+
|
|
38
|
+
- `SvgrClientConfig`, `RetryConfig`, `ConvertMutationParams`, `SvgrApiError`
|
|
39
|
+
|
|
40
|
+
## Development
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
bun run build # Build ESM
|
|
44
|
+
bun test # Run tests
|
|
45
|
+
bun run verify # All checks + build
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Related Packages
|
|
49
|
+
|
|
50
|
+
- `svgr_types` -- Shared type definitions
|
|
51
|
+
- `svgr_lib` -- Shared business logic
|
|
52
|
+
- `svgr_api` -- Backend API server
|
|
53
|
+
- `svgr_app` -- Web app
|
|
54
|
+
- `svgr_app_rn` -- React Native app
|
|
55
|
+
|
|
56
|
+
## License
|
|
57
|
+
|
|
58
|
+
BUSL-1.1
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sudobility/svgr_client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -29,16 +29,16 @@
|
|
|
29
29
|
"verify": "bun run typecheck && bun run lint && bun run test && bun run build"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@sudobility/svgr_types": "^1.0.
|
|
32
|
+
"@sudobility/svgr_types": "^1.0.10"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@sudobility/types": "^1.9.
|
|
35
|
+
"@sudobility/types": "^1.9.58",
|
|
36
36
|
"react": "^18.0.0 || ^19.0.0",
|
|
37
37
|
"@tanstack/react-query": "^5.0.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@sudobility/di": "^1.5.
|
|
41
|
-
"@sudobility/types": "^1.9.
|
|
40
|
+
"@sudobility/di": "^1.5.46",
|
|
41
|
+
"@sudobility/types": "^1.9.58",
|
|
42
42
|
"@eslint/js": "^9.38.0",
|
|
43
43
|
"@tanstack/react-query": "^5.0.0",
|
|
44
44
|
"@types/react": "^19.0.0",
|