@ps-aux/api-client-gen 0.7.0-rc.2 → 0.7.0-rc.4
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 +14 -6
- package/dist/bin.cjs +78 -10
- package/dist/bin.mjs +60 -11
- package/dist/generateApiClient.cjs +2023 -1372
- package/dist/generateApiClient.mjs +2024 -1376
- package/dist/index.cjs +4 -3
- package/dist/index.d.cts +2177 -19
- package/dist/index.d.mts +2177 -19
- package/dist/index.d.ts +2177 -19
- package/dist/index.mjs +4 -4
- package/package.json +8 -5
- package/templates/http-client.eta +10 -1
- package/templates/procedure-call.ejs +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { g as generateApiClient } from './generateApiClient.mjs';
|
|
1
|
+
export { d as defineConfig, g as generateApiClient } from './generateApiClient.mjs';
|
|
2
2
|
import 'path';
|
|
3
3
|
import 'fs';
|
|
4
4
|
import 'fs/promises';
|
|
5
|
-
import 'node:path';
|
|
6
|
-
import 'node:fs/promises';
|
|
7
|
-
import 'node:fs';
|
|
8
5
|
import 'swagger-typescript-api';
|
|
9
6
|
import 'node:url';
|
|
7
|
+
import 'node:fs/promises';
|
|
8
|
+
import 'node:path';
|
|
9
|
+
import 'node:fs';
|
|
10
10
|
import 'ts-to-zod';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ps-aux/api-client-gen",
|
|
3
|
-
"version": "0.7.0-rc.
|
|
3
|
+
"version": "0.7.0-rc.4",
|
|
4
4
|
"main": "dist/index.cjs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -11,9 +11,10 @@
|
|
|
11
11
|
"clean": "rm -rf dist",
|
|
12
12
|
"dev": "rollup -c --watch",
|
|
13
13
|
"lint": "eslint",
|
|
14
|
-
"
|
|
14
|
+
"pack:tarball": "npm run build && npm pack",
|
|
15
|
+
"prepublishOnly": "echo \"Publishing disabled for this repo. Use CI workflow.\" && exit 1",
|
|
15
16
|
"test": "npm run test:generation && npm run test:generated-code && npm run tc:after-gen",
|
|
16
|
-
"test:generation": "vitest run test/
|
|
17
|
+
"test:generation": "vitest run test/generateApiClient.spec.ts test/e2e/e2e.spec.ts test/gen-open-api/*/generate*.spec.ts test/gen-open-api/*/integration.spec.ts",
|
|
17
18
|
"test:generated-code": "vitest run test/gen-open-api/swagger-ts-api/contract.spec.ts test/gen-open-api/v-next/contract.spec.ts",
|
|
18
19
|
"tc": "echo 'No typecheck'",
|
|
19
20
|
"tc:after-gen": "tsc",
|
|
@@ -22,15 +23,17 @@
|
|
|
22
23
|
"author": "psaux",
|
|
23
24
|
"license": "MIT",
|
|
24
25
|
"dependencies": {
|
|
25
|
-
"
|
|
26
|
+
"c12": "4.0.0-beta.4",
|
|
26
27
|
"eta": "^2.2.0",
|
|
28
|
+
"jiti": "^2.6.1",
|
|
27
29
|
"prettier": "^3.8.1",
|
|
28
30
|
"swagger-typescript-api": "13.0.23",
|
|
29
31
|
"ts-to-zod": "5.1.0",
|
|
30
32
|
"zod": "^4.3.6"
|
|
31
33
|
},
|
|
32
34
|
"devDependencies": {
|
|
33
|
-
"@local/open-api": "file:../../shared/open-api"
|
|
35
|
+
"@local/open-api": "file:../../shared/open-api",
|
|
36
|
+
"ts-dedent": "^2.2.0"
|
|
34
37
|
},
|
|
35
38
|
"description": "CLI and programmatic generator for OpenAPI clients with optional Zod schemas.",
|
|
36
39
|
"keywords": [
|
|
@@ -28,8 +28,17 @@ export type Request = {
|
|
|
28
28
|
requestContentType?: RequestContentType
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
export type HttpResponse<Data> = {
|
|
32
|
+
body: Data
|
|
33
|
+
headers: Record<string, string | string[]>
|
|
34
|
+
status: number
|
|
35
|
+
}
|
|
36
|
+
|
|
31
37
|
export type QuerySerializer = (params: QueryParams) => string
|
|
32
38
|
|
|
33
39
|
export type HttpClient<RequestParams = never> = {
|
|
34
|
-
request: <Data>(
|
|
40
|
+
request: <Data>(
|
|
41
|
+
req: Request,
|
|
42
|
+
params?: RequestParams
|
|
43
|
+
) => Promise<HttpResponse<Data>>
|
|
35
44
|
}
|
|
@@ -85,7 +85,7 @@ const routeDocLines = routeDocs.lines ? `${routeDocs.lines}\n` : '';
|
|
|
85
85
|
|
|
86
86
|
const describeReturnType = () => {
|
|
87
87
|
if (!config.toJS) return "";
|
|
88
|
-
return `Promise
|
|
88
|
+
return `Promise<${type}>`
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
%>
|
|
@@ -103,4 +103,4 @@ const describeReturnType = () => {
|
|
|
103
103
|
<%~ bodyTmpl ? `body: ${bodyTmpl},` : '' %>
|
|
104
104
|
<%~ bodyContentKindTmpl ? `requestContentType: ${bodyContentKindTmpl},` : '' %>
|
|
105
105
|
<%~ responseFormatTmpl ? `format: ${responseFormatTmpl},` : '' %>
|
|
106
|
-
}, params)<%~ route.namespace ? ',' : '' %>
|
|
106
|
+
}, params).then(res => res.body)<%~ route.namespace ? ',' : '' %>
|