@sudobility/superguide_client 0.0.11 → 0.0.13

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 +65 -0
  2. package/package.json +4 -4
package/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # @sudobility/superguide_client
2
+
3
+ API client SDK for Superguide with TanStack Query hooks.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ bun add @sudobility/superguide_client
9
+ ```
10
+
11
+ Peer dependencies: `react` (>=18), `@tanstack/react-query` (>=5), `@sudobility/types`.
12
+
13
+ ## Usage
14
+
15
+ ```ts
16
+ import { SuperguideClient } from "@sudobility/superguide_client";
17
+ import { useHistories, useHistoriesTotal } from "@sudobility/superguide_client/hooks";
18
+
19
+ // HTTP client (dependency-injected NetworkClient)
20
+ const client = new SuperguideClient({ baseUrl, networkClient });
21
+
22
+ // React hooks
23
+ const { data, createHistory, updateHistory, deleteHistory } = useHistories(config);
24
+ const { data: total } = useHistoriesTotal(config);
25
+ ```
26
+
27
+ ## API
28
+
29
+ ### SuperguideClient
30
+
31
+ HTTP client class constructed with `{ baseUrl, networkClient }`. Uses dependency injection via the `NetworkClient` interface -- no direct fetch calls.
32
+
33
+ ### Hooks
34
+
35
+ - `useHistories(config)` -- query + mutations for user histories with automatic cache invalidation
36
+ - `useHistoriesTotal(config)` -- query for global total (public endpoint)
37
+
38
+ ### Utilities
39
+
40
+ - `createAuthHeaders(token)` -- build Authorization header
41
+ - `buildUrl(base, path)` -- construct API URLs
42
+ - `handleApiError(error)` -- standardized error handling
43
+ - `QUERY_KEYS` -- type-safe cache key factory for TanStack Query
44
+
45
+ ## Development
46
+
47
+ ```bash
48
+ bun run build # Build ESM
49
+ bun test # Run Vitest tests
50
+ bun run typecheck # TypeScript check
51
+ bun run lint # ESLint
52
+ bun run verify # All checks + build (use before commit)
53
+ ```
54
+
55
+ ## Related Packages
56
+
57
+ - **superguide_types** -- Shared type definitions
58
+ - **superguide_api** -- Backend server this client communicates with
59
+ - **superguide_lib** -- Business logic layer that wraps this client
60
+ - **superguide_app** -- Web frontend
61
+ - **superguide_app_rn** -- React Native mobile app
62
+
63
+ ## License
64
+
65
+ BUSL-1.1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sudobility/superguide_client",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "description": "Client library for Starter API with TanStack Query hooks",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -35,13 +35,13 @@
35
35
  "author": "Sudobility",
36
36
  "license": "BUSL-1.1",
37
37
  "peerDependencies": {
38
- "@sudobility/types": "^1.9.54",
38
+ "@sudobility/types": "^1.9.57",
39
39
  "@tanstack/react-query": ">=5.0.0",
40
40
  "react": ">=18.0.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@sudobility/superguide_types": "^0.0.7",
44
- "@sudobility/types": "^1.9.54",
43
+ "@sudobility/superguide_types": "^0.0.9",
44
+ "@sudobility/types": "^1.9.57",
45
45
  "@tanstack/react-query": "^5.90.5",
46
46
  "@types/react": "^19.2.2",
47
47
  "react": "^19.2.1",