@ps-aux/api-client-gen 0.7.0-rc.2 → 0.7.0-rc.3

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/index.mjs CHANGED
@@ -2,9 +2,9 @@ export { 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.2",
3
+ "version": "0.7.0-rc.3",
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
- "pub": "npm test && npm run build && npm publish",
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/gen-open-api/swagger-ts-api/generateApiModel.spec.ts test/gen-open-api/v-next/generateApiModel.spec.ts test/gen-open-api/v-next/generateFromIr.spec.ts test/gen-open-api/v-next/integration.spec.ts",
17
+ "test:generation": "vitest run test/generateApiClient.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",
@@ -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>(req: Request, params?: RequestParams) => Promise<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<HttpResponse<${type}, ${errorType}>>`
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 ? ',' : '' %>