@kubb/plugin-client 5.0.0-alpha.34 → 5.0.0-alpha.35

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-client",
3
- "version": "5.0.0-alpha.34",
3
+ "version": "5.0.0-alpha.35",
4
4
  "description": "API client generator plugin for Kubb, creating type-safe HTTP clients (Axios, Fetch) from OpenAPI specifications for making API requests.",
5
5
  "keywords": [
6
6
  "api-client",
@@ -94,19 +94,18 @@
94
94
  }
95
95
  ],
96
96
  "dependencies": {
97
- "@kubb/ast": "5.0.0-alpha.34",
98
- "@kubb/core": "5.0.0-alpha.34",
99
- "@kubb/plugin-ts": "5.0.0-alpha.34",
100
- "@kubb/plugin-zod": "5.0.0-alpha.34",
101
- "@kubb/renderer-jsx": "5.0.0-alpha.34"
97
+ "@kubb/core": "5.0.0-alpha.35",
98
+ "@kubb/plugin-ts": "5.0.0-alpha.35",
99
+ "@kubb/plugin-zod": "5.0.0-alpha.35",
100
+ "@kubb/renderer-jsx": "5.0.0-alpha.35"
102
101
  },
103
102
  "devDependencies": {
104
- "axios": "^1.14.0",
103
+ "axios": "^1.15.0",
105
104
  "@internals/utils": "0.0.0"
106
105
  },
107
106
  "peerDependencies": {
108
107
  "axios": "^1.7.2",
109
- "@kubb/renderer-jsx": "5.0.0-alpha.34"
108
+ "@kubb/renderer-jsx": "5.0.0-alpha.35"
110
109
  },
111
110
  "peerDependenciesMeta": {
112
111
  "axios": {
@@ -1,5 +1,5 @@
1
1
  import { buildJSDoc, URLPath } from '@internals/utils'
2
- import type { OperationNode } from '@kubb/ast/types'
2
+ import type { ast } from '@kubb/core'
3
3
  import type { PluginTs } from '@kubb/plugin-ts'
4
4
  import { functionPrinter } from '@kubb/plugin-ts'
5
5
  import type { PluginZod } from '@kubb/plugin-zod'
@@ -7,11 +7,10 @@ import { File } from '@kubb/renderer-jsx'
7
7
  import type { KubbReactNode } from '@kubb/renderer-jsx/types'
8
8
  import type { PluginClient } from '../types.ts'
9
9
  import { buildClassClientParams, buildFormDataLine, buildGenerics, buildHeaders, buildRequestDataLine, buildReturnStatement, getComments } from '../utils.ts'
10
-
11
10
  import { Client } from './Client.tsx'
12
11
 
13
12
  type OperationData = {
14
- node: OperationNode
13
+ node: ast.OperationNode
15
14
  name: string
16
15
  tsResolver: PluginTs['resolver']
17
16
  zodResolver?: PluginZod['resolver']
@@ -32,7 +31,7 @@ type Props = {
32
31
  }
33
32
 
34
33
  type GenerateMethodProps = {
35
- node: OperationNode
34
+ node: ast.OperationNode
36
35
  name: string
37
36
  tsResolver: PluginTs['resolver']
38
37
  zodResolver?: PluginZod['resolver']
@@ -1,7 +1,5 @@
1
1
  import { isValidVarName, URLPath } from '@internals/utils'
2
- import { caseParams, createFunctionParameter, createOperationParams, createParamsType } from '@kubb/ast'
3
- import type { FunctionParametersNode, OperationNode } from '@kubb/ast/types'
4
- import { FunctionParams } from '@kubb/core'
2
+ import { ast, FunctionParams } from '@kubb/core'
5
3
  import type { PluginTs } from '@kubb/plugin-ts'
6
4
  import { functionPrinter } from '@kubb/plugin-ts'
7
5
  import type { PluginZod } from '@kubb/plugin-zod'
@@ -25,7 +23,7 @@ type Props = {
25
23
  paramsType: PluginClient['resolvedOptions']['pathParamsType']
26
24
  pathParamsType: PluginClient['resolvedOptions']['pathParamsType']
27
25
  parser: PluginClient['resolvedOptions']['parser'] | undefined
28
- node: OperationNode
26
+ node: ast.OperationNode
29
27
  tsResolver: PluginTs['resolver']
30
28
  zodResolver?: PluginZod['resolver']
31
29
  children?: KubbReactNode
@@ -35,26 +33,26 @@ type GetParamsProps = {
35
33
  paramsCasing: PluginClient['resolvedOptions']['paramsCasing']
36
34
  paramsType: PluginClient['resolvedOptions']['paramsType']
37
35
  pathParamsType: PluginClient['resolvedOptions']['pathParamsType']
38
- node: OperationNode
36
+ node: ast.OperationNode
39
37
  tsResolver: PluginTs['resolver']
40
38
  isConfigurable: boolean
41
39
  }
42
40
 
43
41
  const declarationPrinter = functionPrinter({ mode: 'declaration' })
44
42
 
45
- function getParams({ paramsType, paramsCasing, pathParamsType, node, tsResolver, isConfigurable }: GetParamsProps): FunctionParametersNode {
43
+ function getParams({ paramsType, paramsCasing, pathParamsType, node, tsResolver, isConfigurable }: GetParamsProps): ast.FunctionParametersNode {
46
44
  const requestName = node.requestBody?.schema ? tsResolver.resolveDataName(node) : undefined
47
45
 
48
- return createOperationParams(node, {
46
+ return ast.createOperationParams(node, {
49
47
  paramsType,
50
48
  pathParamsType: paramsType === 'object' ? 'object' : pathParamsType === 'object' ? 'object' : 'inline',
51
49
  paramsCasing,
52
50
  resolver: tsResolver,
53
51
  extraParams: isConfigurable
54
52
  ? [
55
- createFunctionParameter({
53
+ ast.createFunctionParameter({
56
54
  name: 'config',
57
- type: createParamsType({
55
+ type: ast.createParamsType({
58
56
  variant: 'reference',
59
57
  name: requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : 'Partial<RequestConfig> & { client?: Client }',
60
58
  }),
@@ -88,11 +86,11 @@ export function Client({
88
86
  const isFormData = contentType === 'multipart/form-data'
89
87
 
90
88
  const originalPathParams = node.parameters.filter((p) => p.in === 'path')
91
- const casedPathParams = caseParams(originalPathParams, paramsCasing)
89
+ const casedPathParams = ast.caseParams(originalPathParams, paramsCasing)
92
90
  const originalQueryParams = node.parameters.filter((p) => p.in === 'query')
93
- const casedQueryParams = caseParams(originalQueryParams, paramsCasing)
91
+ const casedQueryParams = ast.caseParams(originalQueryParams, paramsCasing)
94
92
  const originalHeaderParams = node.parameters.filter((p) => p.in === 'header')
95
- const casedHeaderParams = caseParams(originalHeaderParams, paramsCasing)
93
+ const casedHeaderParams = ast.caseParams(originalHeaderParams, paramsCasing)
96
94
 
97
95
  const pathParamsMapping = paramsCasing && !urlName ? buildParamsMapping(originalPathParams, casedPathParams) : undefined
98
96
  const queryParamsMapping = paramsCasing ? buildParamsMapping(originalQueryParams, casedQueryParams) : undefined
@@ -1,11 +1,11 @@
1
1
  import { URLPath } from '@internals/utils'
2
- import type { OperationNode } from '@kubb/ast/types'
2
+ import type { ast } from '@kubb/core'
3
3
  import { Const, File } from '@kubb/renderer-jsx'
4
4
  import type { KubbReactNode } from '@kubb/renderer-jsx/types'
5
5
 
6
6
  type OperationsProps = {
7
7
  name: string
8
- nodes: Array<OperationNode>
8
+ nodes: Array<ast.OperationNode>
9
9
  }
10
10
 
11
11
  export function Operations({ name, nodes }: OperationsProps): KubbReactNode {
@@ -1,5 +1,5 @@
1
1
  import { buildJSDoc, URLPath } from '@internals/utils'
2
- import type { OperationNode } from '@kubb/ast/types'
2
+ import type { ast } from '@kubb/core'
3
3
  import type { PluginTs } from '@kubb/plugin-ts'
4
4
  import { functionPrinter } from '@kubb/plugin-ts'
5
5
  import type { PluginZod } from '@kubb/plugin-zod'
@@ -10,7 +10,7 @@ import { buildClassClientParams, buildFormDataLine, buildGenerics, buildHeaders,
10
10
  import { Client } from './Client.tsx'
11
11
 
12
12
  type OperationData = {
13
- node: OperationNode
13
+ node: ast.OperationNode
14
14
  name: string
15
15
  tsResolver: PluginTs['resolver']
16
16
  zodResolver?: PluginZod['resolver']
@@ -31,7 +31,7 @@ type Props = {
31
31
  }
32
32
 
33
33
  type GenerateMethodProps = {
34
- node: OperationNode
34
+ node: ast.OperationNode
35
35
  name: string
36
36
  tsResolver: PluginTs['resolver']
37
37
  zodResolver?: PluginZod['resolver']
@@ -1,6 +1,5 @@
1
1
  import { isValidVarName, URLPath } from '@internals/utils'
2
- import { caseParams, createOperationParams } from '@kubb/ast'
3
- import type { FunctionParametersNode, OperationNode } from '@kubb/ast/types'
2
+ import { ast } from '@kubb/core'
4
3
  import type { PluginTs } from '@kubb/plugin-ts'
5
4
  import { functionPrinter } from '@kubb/plugin-ts'
6
5
  import { Const, File, Function } from '@kubb/renderer-jsx'
@@ -17,7 +16,7 @@ type Props = {
17
16
  paramsCasing: PluginClient['resolvedOptions']['paramsCasing']
18
17
  paramsType: PluginClient['resolvedOptions']['pathParamsType']
19
18
  pathParamsType: PluginClient['resolvedOptions']['pathParamsType']
20
- node: OperationNode
19
+ node: ast.OperationNode
21
20
  tsResolver: PluginTs['resolver']
22
21
  }
23
22
 
@@ -25,21 +24,21 @@ type GetParamsProps = {
25
24
  paramsCasing: PluginClient['resolvedOptions']['paramsCasing']
26
25
  paramsType: PluginClient['resolvedOptions']['paramsType']
27
26
  pathParamsType: PluginClient['resolvedOptions']['pathParamsType']
28
- node: OperationNode
27
+ node: ast.OperationNode
29
28
  tsResolver: PluginTs['resolver']
30
29
  }
31
30
 
32
31
  const declarationPrinter = functionPrinter({ mode: 'declaration' })
33
32
 
34
- function getParams({ paramsType, paramsCasing, pathParamsType, node, tsResolver }: GetParamsProps): FunctionParametersNode {
33
+ function getParams({ paramsType, paramsCasing, pathParamsType, node, tsResolver }: GetParamsProps): ast.FunctionParametersNode {
35
34
  // Build a URL-only node with only path params (no body, query, header)
36
- const urlNode: OperationNode = {
35
+ const urlNode: ast.OperationNode = {
37
36
  ...node,
38
37
  parameters: node.parameters.filter((p) => p.in === 'path'),
39
38
  requestBody: undefined,
40
39
  }
41
40
 
42
- return createOperationParams(urlNode, {
41
+ return ast.createOperationParams(urlNode, {
43
42
  paramsType: paramsType === 'object' ? 'object' : 'inline',
44
43
  pathParamsType: paramsType === 'object' ? 'object' : pathParamsType === 'object' ? 'object' : 'inline',
45
44
  paramsCasing,
@@ -70,7 +69,7 @@ export function Url({
70
69
  const paramsSignature = declarationPrinter.print(paramsNode) ?? ''
71
70
 
72
71
  const originalPathParams = node.parameters.filter((p) => p.in === 'path')
73
- const casedPathParams = caseParams(originalPathParams, paramsCasing)
72
+ const casedPathParams = ast.caseParams(originalPathParams, paramsCasing)
74
73
  const pathParamsMapping = paramsCasing ? buildParamsMapping(originalPathParams, casedPathParams) : undefined
75
74
 
76
75
  return (
@@ -1,32 +1,32 @@
1
1
  import path from 'node:path'
2
2
  import { camelCase, pascalCase } from '@internals/utils'
3
- import type { FileNode, OperationNode } from '@kubb/ast/types'
3
+ import type { ast } from '@kubb/core'
4
4
  import { defineGenerator } from '@kubb/core'
5
5
  import type { PluginTs } from '@kubb/plugin-ts'
6
6
  import { pluginTsName } from '@kubb/plugin-ts'
7
7
  import type { PluginZod } from '@kubb/plugin-zod'
8
8
  import { pluginZodName } from '@kubb/plugin-zod'
9
- import { File } from '@kubb/renderer-jsx'
9
+ import { File, jsxRenderer } from '@kubb/renderer-jsx'
10
10
  import { ClassClient } from '../components/ClassClient'
11
11
  import { WrapperClient } from '../components/WrapperClient'
12
12
  import type { PluginClient } from '../types'
13
13
 
14
14
  type OperationData = {
15
- node: OperationNode
15
+ node: ast.OperationNode
16
16
  name: string
17
17
  tsResolver: PluginTs['resolver']
18
18
  zodResolver: PluginZod['resolver'] | undefined
19
- typeFile: FileNode
20
- zodFile: FileNode | undefined
19
+ typeFile: ast.FileNode
20
+ zodFile: ast.FileNode | undefined
21
21
  }
22
22
 
23
23
  type Controller = {
24
24
  name: string
25
- file: FileNode
25
+ file: ast.FileNode
26
26
  operations: Array<OperationData>
27
27
  }
28
28
 
29
- function resolveTypeImportNames(node: OperationNode, tsResolver: PluginTs['resolver']): Array<string> {
29
+ function resolveTypeImportNames(node: ast.OperationNode, tsResolver: PluginTs['resolver']): Array<string> {
30
30
  const names: Array<string | undefined> = [
31
31
  node.requestBody?.schema ? tsResolver.resolveDataName(node) : undefined,
32
32
  tsResolver.resolveResponseName(node),
@@ -38,17 +38,18 @@ function resolveTypeImportNames(node: OperationNode, tsResolver: PluginTs['resol
38
38
  return names.filter((n): n is string => Boolean(n))
39
39
  }
40
40
 
41
- function resolveZodImportNames(node: OperationNode, zodResolver: PluginZod['resolver']): Array<string> {
41
+ function resolveZodImportNames(node: ast.OperationNode, zodResolver: PluginZod['resolver']): Array<string> {
42
42
  const names: Array<string | undefined> = [zodResolver.resolveResponseName?.(node), node.requestBody?.schema ? zodResolver.resolveDataName?.(node) : undefined]
43
43
  return names.filter((n): n is string => Boolean(n))
44
44
  }
45
45
 
46
46
  export const classClientGenerator = defineGenerator<PluginClient>({
47
47
  name: 'classClient',
48
- operations(nodes, options) {
49
- const { adapter, config, driver, resolver, root } = this
50
- const { output, group, dataReturnType, paramsCasing, paramsType, pathParamsType, parser, importPath, wrapper } = options
51
- const baseURL = options.baseURL ?? adapter.inputNode?.meta?.baseURL
48
+ renderer: jsxRenderer,
49
+ operations(nodes, ctx) {
50
+ const { adapter, config, driver, resolver, root } = ctx
51
+ const { output, group, dataReturnType, paramsCasing, paramsType, pathParamsType, parser, importPath, wrapper } = ctx.options
52
+ const baseURL = ctx.options.baseURL ?? adapter.inputNode?.meta?.baseURL
52
53
 
53
54
  const pluginTs = driver.getPlugin(pluginTsName)
54
55
  if (!pluginTs?.resolver) return null
@@ -58,7 +59,7 @@ export const classClientGenerator = defineGenerator<PluginClient>({
58
59
  const pluginZod = parser === 'zod' ? driver.getPlugin(pluginZodName) : undefined
59
60
  const zodResolver = pluginZod?.resolver
60
61
 
61
- function buildOperationData(node: OperationNode): OperationData {
62
+ function buildOperationData(node: ast.OperationNode): OperationData {
62
63
  const typeFile = tsResolver.resolveFile(
63
64
  { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },
64
65
  { root, output: tsPluginOptions?.output ?? output, group: tsPluginOptions?.group },
@@ -117,7 +118,7 @@ export const classClientGenerator = defineGenerator<PluginClient>({
117
118
 
118
119
  function collectTypeImports(ops: Array<OperationData>) {
119
120
  const typeImportsByFile = new Map<string, Set<string>>()
120
- const typeFilesByPath = new Map<string, FileNode>()
121
+ const typeFilesByPath = new Map<string, ast.FileNode>()
121
122
 
122
123
  ops.forEach((op) => {
123
124
  const names = resolveTypeImportNames(op.node, tsResolver)
@@ -136,7 +137,7 @@ export const classClientGenerator = defineGenerator<PluginClient>({
136
137
 
137
138
  function collectZodImports(ops: Array<OperationData>) {
138
139
  const zodImportsByFile = new Map<string, Set<string>>()
139
- const zodFilesByPath = new Map<string, FileNode>()
140
+ const zodFilesByPath = new Map<string, ast.FileNode>()
140
141
 
141
142
  ops.forEach((op) => {
142
143
  if (!op.zodFile || !zodResolver) return
@@ -157,7 +158,7 @@ export const classClientGenerator = defineGenerator<PluginClient>({
157
158
  const files = controllers.map(({ name, file, operations: ops }) => {
158
159
  const { typeImportsByFile, typeFilesByPath } = collectTypeImports(ops)
159
160
  const { zodImportsByFile, zodFilesByPath } =
160
- parser === 'zod' ? collectZodImports(ops) : { zodImportsByFile: new Map<string, Set<string>>(), zodFilesByPath: new Map<string, FileNode>() }
161
+ parser === 'zod' ? collectZodImports(ops) : { zodImportsByFile: new Map<string, Set<string>>(), zodFilesByPath: new Map<string, ast.FileNode>() }
161
162
  const hasFormData = ops.some((op) => op.node.requestBody?.contentType === 'multipart/form-data')
162
163
 
163
164
  return (
@@ -1,19 +1,20 @@
1
1
  import path from 'node:path'
2
- import { caseParams } from '@kubb/ast'
3
- import { defineGenerator } from '@kubb/core'
2
+
3
+ import { ast, defineGenerator } from '@kubb/core'
4
4
  import { pluginTsName } from '@kubb/plugin-ts'
5
5
  import { pluginZodName } from '@kubb/plugin-zod'
6
- import { File } from '@kubb/renderer-jsx'
6
+ import { File, jsxRenderer } from '@kubb/renderer-jsx'
7
7
  import { Client } from '../components/Client'
8
8
  import { Url } from '../components/Url.tsx'
9
9
  import type { PluginClient } from '../types'
10
10
 
11
11
  export const clientGenerator = defineGenerator<PluginClient>({
12
12
  name: 'client',
13
- operation(node, options) {
14
- const { adapter, config, driver, resolver, root } = this
15
- const { output, urlType, dataReturnType, paramsCasing, paramsType, pathParamsType, parser, importPath, group } = options
16
- const baseURL = options.baseURL ?? adapter.inputNode?.meta?.baseURL
13
+ renderer: jsxRenderer,
14
+ operation(node, ctx) {
15
+ const { adapter, config, driver, resolver, root } = ctx
16
+ const { output, urlType, dataReturnType, paramsCasing, paramsType, pathParamsType, parser, importPath, group } = ctx.options
17
+ const baseURL = ctx.options.baseURL ?? adapter.inputNode?.meta?.baseURL
17
18
 
18
19
  const pluginTs = driver.getPlugin(pluginTsName)
19
20
 
@@ -26,7 +27,7 @@ export const clientGenerator = defineGenerator<PluginClient>({
26
27
  const pluginZod = parser === 'zod' ? driver.getPlugin(pluginZodName) : undefined
27
28
  const zodResolver = pluginZod?.resolver
28
29
 
29
- const casedParams = caseParams(node.parameters, paramsCasing)
30
+ const casedParams = ast.caseParams(node.parameters, paramsCasing)
30
31
  const pathParams = casedParams.filter((p) => p.in === 'path')
31
32
  const queryParams = casedParams.filter((p) => p.in === 'query')
32
33
  const headerParams = casedParams.filter((p) => p.in === 'header')
@@ -1,14 +1,15 @@
1
1
  import { camelCase } from '@internals/utils'
2
- import type { FileNode } from '@kubb/ast/types'
2
+ import type { ast } from '@kubb/core'
3
3
  import { defineGenerator } from '@kubb/core'
4
- import { File, Function } from '@kubb/renderer-jsx'
4
+ import { File, Function, jsxRenderer } from '@kubb/renderer-jsx'
5
5
  import type { PluginClient } from '../types'
6
6
 
7
7
  export const groupedClientGenerator = defineGenerator<PluginClient>({
8
8
  name: 'groupedClient',
9
- operations(nodes, options) {
10
- const { config, resolver, adapter, root } = this
11
- const { output, group } = options
9
+ renderer: jsxRenderer,
10
+ operations(nodes, ctx) {
11
+ const { config, resolver, adapter, root } = ctx
12
+ const { output, group } = ctx.options
12
13
 
13
14
  const controllers = nodes.reduce(
14
15
  (acc, operationNode) => {
@@ -42,7 +43,7 @@ export const groupedClientGenerator = defineGenerator<PluginClient>({
42
43
 
43
44
  return acc
44
45
  },
45
- [] as Array<{ name: string; file: FileNode; clients: Array<{ name: string; file: FileNode }> }>,
46
+ [] as Array<{ name: string; file: ast.FileNode; clients: Array<{ name: string; file: ast.FileNode }> }>,
46
47
  )
47
48
 
48
49
  return (
@@ -1,13 +1,14 @@
1
1
  import { defineGenerator } from '@kubb/core'
2
- import { File } from '@kubb/renderer-jsx'
2
+ import { File, jsxRenderer } from '@kubb/renderer-jsx'
3
3
  import { Operations } from '../components/Operations'
4
4
  import type { PluginClient } from '../types'
5
5
 
6
6
  export const operationsGenerator = defineGenerator<PluginClient>({
7
7
  name: 'client',
8
- operations(nodes, options) {
9
- const { config, resolver, adapter, root } = this
10
- const { output, group } = options
8
+ renderer: jsxRenderer,
9
+ operations(nodes, ctx) {
10
+ const { config, resolver, adapter, root } = ctx
11
+ const { output, group } = ctx.options
11
12
 
12
13
  const name = 'operations'
13
14
  const file = resolver.resolveFile({ name, extname: '.ts' }, { root, output, group })
@@ -1,31 +1,31 @@
1
1
  import path from 'node:path'
2
2
  import { camelCase, pascalCase } from '@internals/utils'
3
- import type { FileNode, OperationNode } from '@kubb/ast/types'
3
+ import type { ast } from '@kubb/core'
4
4
  import { defineGenerator } from '@kubb/core'
5
5
  import type { PluginTs } from '@kubb/plugin-ts'
6
6
  import { pluginTsName } from '@kubb/plugin-ts'
7
7
  import type { PluginZod } from '@kubb/plugin-zod'
8
8
  import { pluginZodName } from '@kubb/plugin-zod'
9
- import { File } from '@kubb/renderer-jsx'
9
+ import { File, jsxRenderer } from '@kubb/renderer-jsx'
10
10
  import { StaticClassClient } from '../components/StaticClassClient'
11
11
  import type { PluginClient } from '../types'
12
12
 
13
13
  type OperationData = {
14
- node: OperationNode
14
+ node: ast.OperationNode
15
15
  name: string
16
16
  tsResolver: PluginTs['resolver']
17
17
  zodResolver: PluginZod['resolver'] | undefined
18
- typeFile: FileNode
19
- zodFile: FileNode | undefined
18
+ typeFile: ast.FileNode
19
+ zodFile: ast.FileNode | undefined
20
20
  }
21
21
 
22
22
  type Controller = {
23
23
  name: string
24
- file: FileNode
24
+ file: ast.FileNode
25
25
  operations: Array<OperationData>
26
26
  }
27
27
 
28
- function resolveTypeImportNames(node: OperationNode, tsResolver: PluginTs['resolver']): Array<string> {
28
+ function resolveTypeImportNames(node: ast.OperationNode, tsResolver: PluginTs['resolver']): Array<string> {
29
29
  const names: Array<string | undefined> = [
30
30
  node.requestBody?.schema ? tsResolver.resolveDataName(node) : undefined,
31
31
  tsResolver.resolveResponseName(node),
@@ -37,17 +37,18 @@ function resolveTypeImportNames(node: OperationNode, tsResolver: PluginTs['resol
37
37
  return names.filter((n): n is string => Boolean(n))
38
38
  }
39
39
 
40
- function resolveZodImportNames(node: OperationNode, zodResolver: PluginZod['resolver']): Array<string> {
40
+ function resolveZodImportNames(node: ast.OperationNode, zodResolver: PluginZod['resolver']): Array<string> {
41
41
  const names: Array<string | undefined> = [zodResolver.resolveResponseName?.(node), node.requestBody?.schema ? zodResolver.resolveDataName?.(node) : undefined]
42
42
  return names.filter((n): n is string => Boolean(n))
43
43
  }
44
44
 
45
45
  export const staticClassClientGenerator = defineGenerator<PluginClient>({
46
46
  name: 'staticClassClient',
47
- operations(nodes, options) {
48
- const { adapter, config, driver, resolver, root } = this
49
- const { output, group, dataReturnType, paramsCasing, paramsType, pathParamsType, parser, importPath } = options
50
- const baseURL = options.baseURL ?? adapter.inputNode?.meta?.baseURL
47
+ renderer: jsxRenderer,
48
+ operations(nodes, ctx) {
49
+ const { adapter, config, driver, resolver, root } = ctx
50
+ const { output, group, dataReturnType, paramsCasing, paramsType, pathParamsType, parser, importPath } = ctx.options
51
+ const baseURL = ctx.options.baseURL ?? adapter.inputNode?.meta?.baseURL
51
52
 
52
53
  const pluginTs = driver.getPlugin(pluginTsName)
53
54
  if (!pluginTs?.resolver) return null
@@ -57,7 +58,7 @@ export const staticClassClientGenerator = defineGenerator<PluginClient>({
57
58
  const pluginZod = parser === 'zod' ? driver.getPlugin(pluginZodName) : undefined
58
59
  const zodResolver = pluginZod?.resolver
59
60
 
60
- function buildOperationData(node: OperationNode): OperationData {
61
+ function buildOperationData(node: ast.OperationNode): OperationData {
61
62
  const typeFile = tsResolver.resolveFile(
62
63
  { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },
63
64
  { root, output: tsPluginOptions?.output ?? output, group: tsPluginOptions?.group },
@@ -116,7 +117,7 @@ export const staticClassClientGenerator = defineGenerator<PluginClient>({
116
117
 
117
118
  function collectTypeImports(ops: Array<OperationData>) {
118
119
  const typeImportsByFile = new Map<string, Set<string>>()
119
- const typeFilesByPath = new Map<string, FileNode>()
120
+ const typeFilesByPath = new Map<string, ast.FileNode>()
120
121
 
121
122
  ops.forEach((op) => {
122
123
  const names = resolveTypeImportNames(op.node, tsResolver)
@@ -135,7 +136,7 @@ export const staticClassClientGenerator = defineGenerator<PluginClient>({
135
136
 
136
137
  function collectZodImports(ops: Array<OperationData>) {
137
138
  const zodImportsByFile = new Map<string, Set<string>>()
138
- const zodFilesByPath = new Map<string, FileNode>()
139
+ const zodFilesByPath = new Map<string, ast.FileNode>()
139
140
 
140
141
  ops.forEach((op) => {
141
142
  if (!op.zodFile || !zodResolver) return
@@ -158,7 +159,7 @@ export const staticClassClientGenerator = defineGenerator<PluginClient>({
158
159
  {controllers.map(({ name, file, operations: ops }) => {
159
160
  const { typeImportsByFile, typeFilesByPath } = collectTypeImports(ops)
160
161
  const { zodImportsByFile, zodFilesByPath } =
161
- parser === 'zod' ? collectZodImports(ops) : { zodImportsByFile: new Map<string, Set<string>>(), zodFilesByPath: new Map<string, FileNode>() }
162
+ parser === 'zod' ? collectZodImports(ops) : { zodImportsByFile: new Map<string, Set<string>>(), zodFilesByPath: new Map<string, ast.FileNode>() }
162
163
  const hasFormData = ops.some((op) => op.node.requestBody?.contentType === 'multipart/form-data')
163
164
 
164
165
  return (
package/src/index.ts CHANGED
@@ -6,7 +6,6 @@ export { groupedClientGenerator } from './generators/groupedClientGenerator.tsx'
6
6
  export { operationsGenerator } from './generators/operationsGenerator.tsx'
7
7
  export { staticClassClientGenerator } from './generators/staticClassClientGenerator.tsx'
8
8
  export { pluginClient, pluginClientName } from './plugin.ts'
9
- export { presets } from './presets.ts'
10
9
  export { resolverClient } from './resolvers/resolverClient.ts'
11
10
  export { resolverClientLegacy } from './resolvers/resolverClientLegacy.ts'
12
11
  export type { ClientImportPath, PluginClient, ResolverClient } from './types.ts'