@ps-aux/api-client-gen 0.7.0-rc.5 → 0.7.0-rc.6

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.cjs CHANGED
@@ -3,12 +3,10 @@
3
3
  var generateApiClient = require('./generateApiClient.cjs');
4
4
  require('path');
5
5
  require('fs');
6
- require('fs/promises');
7
6
  require('node:path');
8
7
  require('swagger-typescript-api');
9
8
  require('node:url');
10
9
  require('node:fs/promises');
11
- require('node:fs');
12
10
  require('ts-to-zod');
13
11
 
14
12
 
package/dist/index.d.cts CHANGED
@@ -2068,16 +2068,26 @@ interface ZodReadonly<T extends SomeType = $ZodType> extends _ZodType<$ZodReadon
2068
2068
  unwrap(): T;
2069
2069
  }
2070
2070
  declare const ZodReadonly: $constructor<ZodReadonly>;
2071
+ interface ZodCustom<O = unknown, I = unknown> extends _ZodType<$ZodCustomInternals<O, I>>, $ZodCustom<O, I> {
2072
+ "~standard": ZodStandardSchemaWithJSON<this>;
2073
+ }
2074
+ declare const ZodCustom: $constructor<ZodCustom>;
2071
2075
 
2072
2076
  declare const profileConfigSchema: ZodObject<{
2073
2077
  srcSpec: ZodString;
2074
- dstDir: ZodString;
2078
+ outputDir: ZodString;
2075
2079
  apiName: ZodString;
2076
- openApiGenerator: ZodUnion<readonly [ZodObject<{
2080
+ openApiGenerator: ZodPrefault<ZodUnion<readonly [ZodObject<{
2077
2081
  selection: ZodOptional<ZodObject<{
2078
2082
  ignoreOperationsWithTags: ZodDefault<ZodArray<ZodString>>;
2079
2083
  allSchemas: ZodDefault<ZodBoolean>;
2080
2084
  }, $strict>>;
2085
+ httpClient: ZodPrefault<ZodObject<{
2086
+ type: ZodDefault<ZodEnum<{
2087
+ promise: "promise";
2088
+ rxjs: "rxjs";
2089
+ }>>;
2090
+ }, $strict>>;
2081
2091
  codegen: ZodPrefault<ZodObject<{
2082
2092
  unwrap: ZodDefault<ZodBoolean>;
2083
2093
  withRequestParams: ZodDefault<ZodBoolean>;
@@ -2108,27 +2118,43 @@ declare const profileConfigSchema: ZodObject<{
2108
2118
  }, $strict>, ZodObject<{
2109
2119
  legacy: ZodObject<{
2110
2120
  ignoreOperationsWithTags: ZodOptional<ZodArray<ZodString>>;
2121
+ responseWrapper: ZodOptional<ZodObject<{
2122
+ symbol: ZodString;
2123
+ import: ZodOptional<ZodString>;
2124
+ unwrapExpr: ZodOptional<ZodString>;
2125
+ }, $strict>>;
2111
2126
  }, $strict>;
2112
- }, $strict>]>;
2113
- responseWrapper: ZodOptional<ZodObject<{
2114
- symbol: ZodString;
2115
- import: ZodOptional<ZodString>;
2116
- unwrapExpr: ZodOptional<ZodString>;
2117
- }, $strict>>;
2127
+ }, $strict>]>>;
2118
2128
  zodSchemas: ZodOptional<ZodObject<{
2119
2129
  enabled: ZodOptional<ZodBoolean>;
2120
2130
  localDateTimes: ZodOptional<ZodBoolean>;
2121
2131
  }, $strict>>;
2132
+ files: ZodOptional<ZodObject<{
2133
+ transformFileName: ZodOptional<ZodCustom<(req: {
2134
+ name: string;
2135
+ ext: string;
2136
+ }) => string, (req: {
2137
+ name: string;
2138
+ ext: string;
2139
+ }) => string>>;
2140
+ generatedFileSuffix: ZodOptional<ZodNullable<ZodString>>;
2141
+ }, $strict>>;
2122
2142
  }, $strict>;
2123
2143
  declare const configSchema: ZodRecord<ZodString, ZodObject<{
2124
2144
  srcSpec: ZodString;
2125
- dstDir: ZodString;
2145
+ outputDir: ZodString;
2126
2146
  apiName: ZodString;
2127
- openApiGenerator: ZodUnion<readonly [ZodObject<{
2147
+ openApiGenerator: ZodPrefault<ZodUnion<readonly [ZodObject<{
2128
2148
  selection: ZodOptional<ZodObject<{
2129
2149
  ignoreOperationsWithTags: ZodDefault<ZodArray<ZodString>>;
2130
2150
  allSchemas: ZodDefault<ZodBoolean>;
2131
2151
  }, $strict>>;
2152
+ httpClient: ZodPrefault<ZodObject<{
2153
+ type: ZodDefault<ZodEnum<{
2154
+ promise: "promise";
2155
+ rxjs: "rxjs";
2156
+ }>>;
2157
+ }, $strict>>;
2132
2158
  codegen: ZodPrefault<ZodObject<{
2133
2159
  unwrap: ZodDefault<ZodBoolean>;
2134
2160
  withRequestParams: ZodDefault<ZodBoolean>;
@@ -2159,17 +2185,27 @@ declare const configSchema: ZodRecord<ZodString, ZodObject<{
2159
2185
  }, $strict>, ZodObject<{
2160
2186
  legacy: ZodObject<{
2161
2187
  ignoreOperationsWithTags: ZodOptional<ZodArray<ZodString>>;
2188
+ responseWrapper: ZodOptional<ZodObject<{
2189
+ symbol: ZodString;
2190
+ import: ZodOptional<ZodString>;
2191
+ unwrapExpr: ZodOptional<ZodString>;
2192
+ }, $strict>>;
2162
2193
  }, $strict>;
2163
- }, $strict>]>;
2164
- responseWrapper: ZodOptional<ZodObject<{
2165
- symbol: ZodString;
2166
- import: ZodOptional<ZodString>;
2167
- unwrapExpr: ZodOptional<ZodString>;
2168
- }, $strict>>;
2194
+ }, $strict>]>>;
2169
2195
  zodSchemas: ZodOptional<ZodObject<{
2170
2196
  enabled: ZodOptional<ZodBoolean>;
2171
2197
  localDateTimes: ZodOptional<ZodBoolean>;
2172
2198
  }, $strict>>;
2199
+ files: ZodOptional<ZodObject<{
2200
+ transformFileName: ZodOptional<ZodCustom<(req: {
2201
+ name: string;
2202
+ ext: string;
2203
+ }) => string, (req: {
2204
+ name: string;
2205
+ ext: string;
2206
+ }) => string>>;
2207
+ generatedFileSuffix: ZodOptional<ZodNullable<ZodString>>;
2208
+ }, $strict>>;
2173
2209
  }, $strict>>;
2174
2210
  type ProfileConfigInput = input<typeof profileConfigSchema>;
2175
2211
  type ProfileConfig = output<typeof profileConfigSchema>;
package/dist/index.d.mts CHANGED
@@ -2068,16 +2068,26 @@ interface ZodReadonly<T extends SomeType = $ZodType> extends _ZodType<$ZodReadon
2068
2068
  unwrap(): T;
2069
2069
  }
2070
2070
  declare const ZodReadonly: $constructor<ZodReadonly>;
2071
+ interface ZodCustom<O = unknown, I = unknown> extends _ZodType<$ZodCustomInternals<O, I>>, $ZodCustom<O, I> {
2072
+ "~standard": ZodStandardSchemaWithJSON<this>;
2073
+ }
2074
+ declare const ZodCustom: $constructor<ZodCustom>;
2071
2075
 
2072
2076
  declare const profileConfigSchema: ZodObject<{
2073
2077
  srcSpec: ZodString;
2074
- dstDir: ZodString;
2078
+ outputDir: ZodString;
2075
2079
  apiName: ZodString;
2076
- openApiGenerator: ZodUnion<readonly [ZodObject<{
2080
+ openApiGenerator: ZodPrefault<ZodUnion<readonly [ZodObject<{
2077
2081
  selection: ZodOptional<ZodObject<{
2078
2082
  ignoreOperationsWithTags: ZodDefault<ZodArray<ZodString>>;
2079
2083
  allSchemas: ZodDefault<ZodBoolean>;
2080
2084
  }, $strict>>;
2085
+ httpClient: ZodPrefault<ZodObject<{
2086
+ type: ZodDefault<ZodEnum<{
2087
+ promise: "promise";
2088
+ rxjs: "rxjs";
2089
+ }>>;
2090
+ }, $strict>>;
2081
2091
  codegen: ZodPrefault<ZodObject<{
2082
2092
  unwrap: ZodDefault<ZodBoolean>;
2083
2093
  withRequestParams: ZodDefault<ZodBoolean>;
@@ -2108,27 +2118,43 @@ declare const profileConfigSchema: ZodObject<{
2108
2118
  }, $strict>, ZodObject<{
2109
2119
  legacy: ZodObject<{
2110
2120
  ignoreOperationsWithTags: ZodOptional<ZodArray<ZodString>>;
2121
+ responseWrapper: ZodOptional<ZodObject<{
2122
+ symbol: ZodString;
2123
+ import: ZodOptional<ZodString>;
2124
+ unwrapExpr: ZodOptional<ZodString>;
2125
+ }, $strict>>;
2111
2126
  }, $strict>;
2112
- }, $strict>]>;
2113
- responseWrapper: ZodOptional<ZodObject<{
2114
- symbol: ZodString;
2115
- import: ZodOptional<ZodString>;
2116
- unwrapExpr: ZodOptional<ZodString>;
2117
- }, $strict>>;
2127
+ }, $strict>]>>;
2118
2128
  zodSchemas: ZodOptional<ZodObject<{
2119
2129
  enabled: ZodOptional<ZodBoolean>;
2120
2130
  localDateTimes: ZodOptional<ZodBoolean>;
2121
2131
  }, $strict>>;
2132
+ files: ZodOptional<ZodObject<{
2133
+ transformFileName: ZodOptional<ZodCustom<(req: {
2134
+ name: string;
2135
+ ext: string;
2136
+ }) => string, (req: {
2137
+ name: string;
2138
+ ext: string;
2139
+ }) => string>>;
2140
+ generatedFileSuffix: ZodOptional<ZodNullable<ZodString>>;
2141
+ }, $strict>>;
2122
2142
  }, $strict>;
2123
2143
  declare const configSchema: ZodRecord<ZodString, ZodObject<{
2124
2144
  srcSpec: ZodString;
2125
- dstDir: ZodString;
2145
+ outputDir: ZodString;
2126
2146
  apiName: ZodString;
2127
- openApiGenerator: ZodUnion<readonly [ZodObject<{
2147
+ openApiGenerator: ZodPrefault<ZodUnion<readonly [ZodObject<{
2128
2148
  selection: ZodOptional<ZodObject<{
2129
2149
  ignoreOperationsWithTags: ZodDefault<ZodArray<ZodString>>;
2130
2150
  allSchemas: ZodDefault<ZodBoolean>;
2131
2151
  }, $strict>>;
2152
+ httpClient: ZodPrefault<ZodObject<{
2153
+ type: ZodDefault<ZodEnum<{
2154
+ promise: "promise";
2155
+ rxjs: "rxjs";
2156
+ }>>;
2157
+ }, $strict>>;
2132
2158
  codegen: ZodPrefault<ZodObject<{
2133
2159
  unwrap: ZodDefault<ZodBoolean>;
2134
2160
  withRequestParams: ZodDefault<ZodBoolean>;
@@ -2159,17 +2185,27 @@ declare const configSchema: ZodRecord<ZodString, ZodObject<{
2159
2185
  }, $strict>, ZodObject<{
2160
2186
  legacy: ZodObject<{
2161
2187
  ignoreOperationsWithTags: ZodOptional<ZodArray<ZodString>>;
2188
+ responseWrapper: ZodOptional<ZodObject<{
2189
+ symbol: ZodString;
2190
+ import: ZodOptional<ZodString>;
2191
+ unwrapExpr: ZodOptional<ZodString>;
2192
+ }, $strict>>;
2162
2193
  }, $strict>;
2163
- }, $strict>]>;
2164
- responseWrapper: ZodOptional<ZodObject<{
2165
- symbol: ZodString;
2166
- import: ZodOptional<ZodString>;
2167
- unwrapExpr: ZodOptional<ZodString>;
2168
- }, $strict>>;
2194
+ }, $strict>]>>;
2169
2195
  zodSchemas: ZodOptional<ZodObject<{
2170
2196
  enabled: ZodOptional<ZodBoolean>;
2171
2197
  localDateTimes: ZodOptional<ZodBoolean>;
2172
2198
  }, $strict>>;
2199
+ files: ZodOptional<ZodObject<{
2200
+ transformFileName: ZodOptional<ZodCustom<(req: {
2201
+ name: string;
2202
+ ext: string;
2203
+ }) => string, (req: {
2204
+ name: string;
2205
+ ext: string;
2206
+ }) => string>>;
2207
+ generatedFileSuffix: ZodOptional<ZodNullable<ZodString>>;
2208
+ }, $strict>>;
2173
2209
  }, $strict>>;
2174
2210
  type ProfileConfigInput = input<typeof profileConfigSchema>;
2175
2211
  type ProfileConfig = output<typeof profileConfigSchema>;
package/dist/index.d.ts CHANGED
@@ -2068,16 +2068,26 @@ interface ZodReadonly<T extends SomeType = $ZodType> extends _ZodType<$ZodReadon
2068
2068
  unwrap(): T;
2069
2069
  }
2070
2070
  declare const ZodReadonly: $constructor<ZodReadonly>;
2071
+ interface ZodCustom<O = unknown, I = unknown> extends _ZodType<$ZodCustomInternals<O, I>>, $ZodCustom<O, I> {
2072
+ "~standard": ZodStandardSchemaWithJSON<this>;
2073
+ }
2074
+ declare const ZodCustom: $constructor<ZodCustom>;
2071
2075
 
2072
2076
  declare const profileConfigSchema: ZodObject<{
2073
2077
  srcSpec: ZodString;
2074
- dstDir: ZodString;
2078
+ outputDir: ZodString;
2075
2079
  apiName: ZodString;
2076
- openApiGenerator: ZodUnion<readonly [ZodObject<{
2080
+ openApiGenerator: ZodPrefault<ZodUnion<readonly [ZodObject<{
2077
2081
  selection: ZodOptional<ZodObject<{
2078
2082
  ignoreOperationsWithTags: ZodDefault<ZodArray<ZodString>>;
2079
2083
  allSchemas: ZodDefault<ZodBoolean>;
2080
2084
  }, $strict>>;
2085
+ httpClient: ZodPrefault<ZodObject<{
2086
+ type: ZodDefault<ZodEnum<{
2087
+ promise: "promise";
2088
+ rxjs: "rxjs";
2089
+ }>>;
2090
+ }, $strict>>;
2081
2091
  codegen: ZodPrefault<ZodObject<{
2082
2092
  unwrap: ZodDefault<ZodBoolean>;
2083
2093
  withRequestParams: ZodDefault<ZodBoolean>;
@@ -2108,27 +2118,43 @@ declare const profileConfigSchema: ZodObject<{
2108
2118
  }, $strict>, ZodObject<{
2109
2119
  legacy: ZodObject<{
2110
2120
  ignoreOperationsWithTags: ZodOptional<ZodArray<ZodString>>;
2121
+ responseWrapper: ZodOptional<ZodObject<{
2122
+ symbol: ZodString;
2123
+ import: ZodOptional<ZodString>;
2124
+ unwrapExpr: ZodOptional<ZodString>;
2125
+ }, $strict>>;
2111
2126
  }, $strict>;
2112
- }, $strict>]>;
2113
- responseWrapper: ZodOptional<ZodObject<{
2114
- symbol: ZodString;
2115
- import: ZodOptional<ZodString>;
2116
- unwrapExpr: ZodOptional<ZodString>;
2117
- }, $strict>>;
2127
+ }, $strict>]>>;
2118
2128
  zodSchemas: ZodOptional<ZodObject<{
2119
2129
  enabled: ZodOptional<ZodBoolean>;
2120
2130
  localDateTimes: ZodOptional<ZodBoolean>;
2121
2131
  }, $strict>>;
2132
+ files: ZodOptional<ZodObject<{
2133
+ transformFileName: ZodOptional<ZodCustom<(req: {
2134
+ name: string;
2135
+ ext: string;
2136
+ }) => string, (req: {
2137
+ name: string;
2138
+ ext: string;
2139
+ }) => string>>;
2140
+ generatedFileSuffix: ZodOptional<ZodNullable<ZodString>>;
2141
+ }, $strict>>;
2122
2142
  }, $strict>;
2123
2143
  declare const configSchema: ZodRecord<ZodString, ZodObject<{
2124
2144
  srcSpec: ZodString;
2125
- dstDir: ZodString;
2145
+ outputDir: ZodString;
2126
2146
  apiName: ZodString;
2127
- openApiGenerator: ZodUnion<readonly [ZodObject<{
2147
+ openApiGenerator: ZodPrefault<ZodUnion<readonly [ZodObject<{
2128
2148
  selection: ZodOptional<ZodObject<{
2129
2149
  ignoreOperationsWithTags: ZodDefault<ZodArray<ZodString>>;
2130
2150
  allSchemas: ZodDefault<ZodBoolean>;
2131
2151
  }, $strict>>;
2152
+ httpClient: ZodPrefault<ZodObject<{
2153
+ type: ZodDefault<ZodEnum<{
2154
+ promise: "promise";
2155
+ rxjs: "rxjs";
2156
+ }>>;
2157
+ }, $strict>>;
2132
2158
  codegen: ZodPrefault<ZodObject<{
2133
2159
  unwrap: ZodDefault<ZodBoolean>;
2134
2160
  withRequestParams: ZodDefault<ZodBoolean>;
@@ -2159,17 +2185,27 @@ declare const configSchema: ZodRecord<ZodString, ZodObject<{
2159
2185
  }, $strict>, ZodObject<{
2160
2186
  legacy: ZodObject<{
2161
2187
  ignoreOperationsWithTags: ZodOptional<ZodArray<ZodString>>;
2188
+ responseWrapper: ZodOptional<ZodObject<{
2189
+ symbol: ZodString;
2190
+ import: ZodOptional<ZodString>;
2191
+ unwrapExpr: ZodOptional<ZodString>;
2192
+ }, $strict>>;
2162
2193
  }, $strict>;
2163
- }, $strict>]>;
2164
- responseWrapper: ZodOptional<ZodObject<{
2165
- symbol: ZodString;
2166
- import: ZodOptional<ZodString>;
2167
- unwrapExpr: ZodOptional<ZodString>;
2168
- }, $strict>>;
2194
+ }, $strict>]>>;
2169
2195
  zodSchemas: ZodOptional<ZodObject<{
2170
2196
  enabled: ZodOptional<ZodBoolean>;
2171
2197
  localDateTimes: ZodOptional<ZodBoolean>;
2172
2198
  }, $strict>>;
2199
+ files: ZodOptional<ZodObject<{
2200
+ transformFileName: ZodOptional<ZodCustom<(req: {
2201
+ name: string;
2202
+ ext: string;
2203
+ }) => string, (req: {
2204
+ name: string;
2205
+ ext: string;
2206
+ }) => string>>;
2207
+ generatedFileSuffix: ZodOptional<ZodNullable<ZodString>>;
2208
+ }, $strict>>;
2173
2209
  }, $strict>>;
2174
2210
  type ProfileConfigInput = input<typeof profileConfigSchema>;
2175
2211
  type ProfileConfig = output<typeof profileConfigSchema>;
package/dist/index.mjs CHANGED
@@ -1,10 +1,8 @@
1
1
  export { d as defineConfig, g as generateApiClient } from './generateApiClient.mjs';
2
2
  import 'path';
3
3
  import 'fs';
4
- import 'fs/promises';
5
4
  import 'node:path';
6
5
  import 'swagger-typescript-api';
7
6
  import 'node:url';
8
7
  import 'node:fs/promises';
9
- import 'node:fs';
10
8
  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.5",
3
+ "version": "0.7.0-rc.6",
4
4
  "main": "dist/index.cjs",
5
5
  "type": "module",
6
6
  "bin": {
@@ -13,8 +13,8 @@
13
13
  "lint": "eslint",
14
14
  "pack:tarball": "npm run build && npm pack",
15
15
  "prepublishOnly": "echo \"Publishing disabled for this repo. Use CI workflow.\" && exit 1",
16
- "test": "npm run test:generation && npm run test:generated-code && npm run tc:after-gen",
17
- "test:generation": "vitest run --project generation",
16
+ "test": "npm run test:main && npm run test:generated-code && npm run tc:after-gen",
17
+ "test:main": "vitest run --project main",
18
18
  "test:generated-code": "vitest run --project generated-code",
19
19
  "tc": "echo 'No typecheck'",
20
20
  "tc:after-gen": "tsc",
@@ -29,6 +29,7 @@
29
29
  "prettier": "^3.8.1",
30
30
  "swagger-typescript-api": "13.0.23",
31
31
  "ts-to-zod": "5.1.0",
32
+ "yaml": "^2.8.4",
32
33
  "zod": "^4.3.6"
33
34
  },
34
35
  "devDependencies": {
@@ -21,11 +21,11 @@ export type QueryParams = Record<string, QueryValue>
21
21
  export type Request = {
22
22
  path: string
23
23
  method: 'GET' | 'POST' | 'PUT' | 'DELETE'
24
- format?: 'json' | 'document'
24
+ responseFormat?: 'json' | 'document'
25
25
  headers?: Record<string, string>
26
26
  query?: QueryParams
27
27
  body?: any
28
- requestContentType?: RequestContentType
28
+ contentType?: RequestContentType
29
29
  }
30
30
 
31
31
  export type HttpResponse<Data> = {
@@ -42,14 +42,14 @@ const wrapperArgs = _
42
42
  .map(argToTmpl)
43
43
  .join(', ')
44
44
 
45
- // Request["requestContentType"]
45
+ // Request["contentType"]
46
46
  const requestContentKind = {
47
47
  "JSON": '"application/json"',
48
48
  "URL_ENCODED": '"application/x-www-form-urlencoded"',
49
49
  "FORM_DATA": '"multipart/form-data"',
50
50
  "TEXT": '"text/plain"',
51
51
  }
52
- // RequestParams["format"]
52
+ // Request["responseFormat"]
53
53
  const responseContentKind = {
54
54
  "JSON": '"json"',
55
55
  "IMAGE": '"blob"',
@@ -101,6 +101,6 @@ const describeReturnType = () => {
101
101
  method: '<%~ _.upperCase(method) %>',
102
102
  <%~ queryTmpl ? `query: ${queryTmpl},` : '' %>
103
103
  <%~ bodyTmpl ? `body: ${bodyTmpl},` : '' %>
104
- <%~ bodyContentKindTmpl ? `requestContentType: ${bodyContentKindTmpl},` : '' %>
105
- <%~ responseFormatTmpl ? `format: ${responseFormatTmpl},` : '' %>
104
+ <%~ bodyContentKindTmpl ? `contentType: ${bodyContentKindTmpl},` : '' %>
105
+ <%~ responseFormatTmpl ? `responseFormat: ${responseFormatTmpl},` : '' %>
106
106
  }, params).then(res => res.body)<%~ route.namespace ? ',' : '' %>