@shipworthy/openapi-react-query 0.0.2 → 1.0.1

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 +8 -7
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -44,11 +44,11 @@ React Native environment, or server runtime. The Node.js requirement above appli
44
44
  ### 1. Generate the `paths` type
45
45
 
46
46
  ```sh
47
- bunx --bun @shipworthy/openapi-cli generate typescript ./openapi.yaml -o ./src/generated/api.ts
47
+ bunx --bun @shipworthy/openapi-cli generate typescript -i ./openapi.yaml -o ./src/generated
48
48
  ```
49
49
 
50
- The input can be a local JSON or YAML file or a URL. If you omit the input, the CLI reads the
51
- schema from stdin. If you omit `-o`, it writes to stdout. The output exports `interface paths`,
50
+ This writes `src/generated/types.ts`. The input can be a local JSON or YAML file or a URL. If
51
+ you omit `-i`, the CLI reads the schema from stdin. If you omit `-o`, it writes to stdout. The output exports `interface paths`,
52
52
  along with `components`, `operations`, and related types.
53
53
 
54
54
  ### 2. Wrap your app in `ApiClientProvider`
@@ -72,7 +72,7 @@ provider.
72
72
 
73
73
  ```tsx
74
74
  import { useApiClientQuery } from "@shipworthy/openapi-react-query";
75
- import type { paths } from "./generated/api";
75
+ import type { paths } from "./generated/types";
76
76
 
77
77
  function PetList() {
78
78
  const useQuery = useApiClientQuery<paths>(); // bind the schema once
@@ -377,7 +377,7 @@ This client is separate from the one `ApiClientProvider` creates, and the hooks
377
377
 
378
378
  ```ts
379
379
  import { createApiClient } from "@shipworthy/openapi-react-query";
380
- import type { paths } from "./generated/api";
380
+ import type { paths } from "./generated/types";
381
381
 
382
382
  const api = createApiClient<paths>("https://api.example.com", process.env.API_TOKEN);
383
383
  const { data, error, response } = await api.GET("/pets", { params: { query: { limit: 10 } } });
@@ -438,8 +438,9 @@ query, whatever its `init`.
438
438
  - Import everything from `@shipworthy/openapi-react-query`. There are no subpath exports and
439
439
  no CLI in this package.
440
440
  - Generate the `paths` type with
441
- `openapi generate typescript <schema> -o <file>.ts` (`@shipworthy/openapi-cli` +
442
- `@shipworthy/openapi-typescript`). Import it as `import type { paths } from "<file>"`.
441
+ `openapi generate typescript -i <schema> -o <dir>` (`@shipworthy/openapi-cli` +
442
+ `@shipworthy/openapi-typescript`), which writes `<dir>/types.ts`. Import it as
443
+ `import type { paths } from "<dir>/types"`.
443
444
  - Mount `<ApiClientProvider baseUrl="…">` once. It already includes `QueryClientProvider`.
444
445
  - The hook factories are curried. Call `useApiClientQuery<paths>()` first, and then call the
445
446
  returned hook as `hook(path, method?, init, options?, queryClient?)`. Never call
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@shipworthy/openapi-react-query",
3
- "version": "0.0.2",
3
+ "version": "1.0.1",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
7
7
  "dependencies": {
8
- "@shipworthy/openapi-fetch": "0.0.2"
8
+ "@shipworthy/openapi-fetch": "1.0.1"
9
9
  },
10
10
  "peerDependencies": {
11
11
  "@tanstack/react-query": "^5.104.1",
@@ -32,7 +32,7 @@
32
32
  "devDependencies": {
33
33
  "@shipworthy/typescript-config": "0.0.1",
34
34
  "@tanstack/react-query": "^5.104.1",
35
- "@types/node": "^24.10.3",
35
+ "@types/node": "^26.6.6",
36
36
  "@types/react": "^19.0.0",
37
37
  "react": "^19.0.0",
38
38
  "typescript": "^7.0.2"