apigen-ts 1.3.0 → 1.3.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.
- package/dist/cli.js +1 -1
- package/dist/{main-B8jUVaQq.js → main-BiX2OIVV.js} +1 -1
- package/dist/main.d.cts +1 -2
- package/dist/main.d.mts +1 -2
- package/dist/main.js +1 -1
- package/package.json +19 -19
- package/readme.md +6 -3
package/dist/cli.js
CHANGED
package/dist/main.d.cts
CHANGED
package/dist/main.d.mts
CHANGED
package/dist/main.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "apigen-ts",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "vladkens <v.pronsky@gmail.com>",
|
|
7
7
|
"repository": "vladkens/apigen-ts",
|
|
@@ -14,34 +14,28 @@
|
|
|
14
14
|
"generator",
|
|
15
15
|
"codegen"
|
|
16
16
|
],
|
|
17
|
-
"scripts": {
|
|
18
|
-
"build": "rm -rf dist && pkgroll && cp ./src/_template.ts ./dist && ls -lah dist",
|
|
19
|
-
"test": "tsx --test --test-reporter=dot test/*.test.ts",
|
|
20
|
-
"test-cov": "tsx --experimental-test-coverage --test test/*.test.ts",
|
|
21
|
-
"format": "prettier --write --log-level warn .",
|
|
22
|
-
"ci": "tsc --noEmit && npm run test-cov && npm run build"
|
|
23
|
-
},
|
|
24
17
|
"dependencies": {
|
|
25
|
-
"@redocly/openapi-core": "2.
|
|
18
|
+
"@redocly/openapi-core": "2.31.5",
|
|
26
19
|
"@types/lodash-es": "4.17.12",
|
|
27
20
|
"@types/swagger2openapi": "7.0.4",
|
|
28
21
|
"array-utils-ts": "1.1.0",
|
|
29
|
-
"cleye": "2.
|
|
30
|
-
"lodash-es": "4.
|
|
22
|
+
"cleye": "2.6.0",
|
|
23
|
+
"lodash-es": "4.18.1",
|
|
31
24
|
"swagger2openapi": "7.0.8"
|
|
32
25
|
},
|
|
33
26
|
"devDependencies": {
|
|
34
|
-
"@types/node": "25.
|
|
27
|
+
"@types/node": "25.9.1",
|
|
35
28
|
"fetch-mock": "12.6.0",
|
|
36
|
-
"
|
|
37
|
-
"pkgroll": "2.27.
|
|
38
|
-
"prettier": "3.8.
|
|
29
|
+
"npm-check-updates": "22.2.1",
|
|
30
|
+
"pkgroll": "2.27.1",
|
|
31
|
+
"prettier": "3.8.3",
|
|
39
32
|
"prettier-plugin-organize-imports": "4.3.0",
|
|
40
|
-
"
|
|
33
|
+
"tsx": "4.22.4",
|
|
34
|
+
"typescript": "6.0.3"
|
|
41
35
|
},
|
|
42
36
|
"peerDependencies": {
|
|
43
|
-
"prettier": "
|
|
44
|
-
"typescript": "
|
|
37
|
+
"prettier": ">=3.0.0",
|
|
38
|
+
"typescript": ">=5.0.0"
|
|
45
39
|
},
|
|
46
40
|
"files": [
|
|
47
41
|
"dist"
|
|
@@ -60,5 +54,11 @@
|
|
|
60
54
|
},
|
|
61
55
|
"bin": {
|
|
62
56
|
"apigen-ts": "./dist/cli.js"
|
|
57
|
+
},
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "rm -rf dist && pkgroll && cp ./src/_template.ts ./dist && ls -lah dist",
|
|
60
|
+
"test": "tsx --test --test-reporter=dot test/*.test.ts",
|
|
61
|
+
"test-cov": "tsx --experimental-test-coverage --test test/*.test.ts",
|
|
62
|
+
"format": "prettier --write --log-level warn ."
|
|
63
63
|
}
|
|
64
|
-
}
|
|
64
|
+
}
|
package/readme.md
CHANGED
|
@@ -29,7 +29,7 @@ Unlike `openapi-typescript`, it generates a ready-to-call client — not just ty
|
|
|
29
29
|
## Install
|
|
30
30
|
|
|
31
31
|
```sh
|
|
32
|
-
npm i apigen-ts
|
|
32
|
+
npm i -D apigen-ts
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
## Usage
|
|
@@ -134,9 +134,9 @@ npx apigen-ts ./openapi.json ./api-client.ts --exclude-tags internal
|
|
|
134
134
|
|
|
135
135
|
When both flags are set, `--exclude-tags` wins.
|
|
136
136
|
|
|
137
|
-
###
|
|
137
|
+
### Fetch options
|
|
138
138
|
|
|
139
|
-
Pass `--fetch-options` to add an optional last argument to every generated method, accepting any [`RequestInit`](https://developer.mozilla.org/en-US/docs/Web/API/RequestInit) field
|
|
139
|
+
Pass `--fetch-options` to add an optional last argument to every generated method, accepting any [`RequestInit`](https://developer.mozilla.org/en-US/docs/Web/API/RequestInit) field:
|
|
140
140
|
|
|
141
141
|
```sh
|
|
142
142
|
npx apigen-ts ./openapi.json ./api-client.ts --fetch-options
|
|
@@ -148,6 +148,9 @@ await api.pet.getPetById(1, { signal: controller.signal })
|
|
|
148
148
|
|
|
149
149
|
// cancel the request
|
|
150
150
|
controller.abort()
|
|
151
|
+
|
|
152
|
+
// or disable automatic redirects for a single request
|
|
153
|
+
await api.pet.getPetById(1, { redirect: "manual" })
|
|
151
154
|
```
|
|
152
155
|
|
|
153
156
|
### Error handling
|