@kubb/plugin-client 5.0.0-alpha.30 → 5.0.0-alpha.31
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 +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/generators/classClientGenerator.tsx +7 -7
- package/src/generators/groupedClientGenerator.tsx +2 -2
- package/src/generators/staticClassClientGenerator.tsx +7 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-client",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.31",
|
|
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",
|
|
@@ -96,10 +96,10 @@
|
|
|
96
96
|
"dependencies": {
|
|
97
97
|
"@kubb/fabric-core": "0.15.1",
|
|
98
98
|
"@kubb/react-fabric": "0.15.1",
|
|
99
|
-
"@kubb/ast": "5.0.0-alpha.
|
|
100
|
-
"@kubb/core": "5.0.0-alpha.
|
|
101
|
-
"@kubb/plugin-ts": "5.0.0-alpha.
|
|
102
|
-
"@kubb/plugin-zod": "5.0.0-alpha.
|
|
99
|
+
"@kubb/ast": "5.0.0-alpha.31",
|
|
100
|
+
"@kubb/core": "5.0.0-alpha.31",
|
|
101
|
+
"@kubb/plugin-ts": "5.0.0-alpha.31",
|
|
102
|
+
"@kubb/plugin-zod": "5.0.0-alpha.31"
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
105
|
"axios": "^1.14.0",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from 'node:path'
|
|
2
2
|
import { camelCase, pascalCase } from '@internals/utils'
|
|
3
3
|
import type { OperationNode } from '@kubb/ast/types'
|
|
4
|
+
import type { KubbFile } from '@kubb/core'
|
|
4
5
|
import { defineGenerator } from '@kubb/core'
|
|
5
|
-
import type { FabricFile } from '@kubb/fabric-core/types'
|
|
6
6
|
import type { PluginTs } from '@kubb/plugin-ts'
|
|
7
7
|
import { pluginTsName } from '@kubb/plugin-ts'
|
|
8
8
|
import type { PluginZod } from '@kubb/plugin-zod'
|
|
@@ -17,13 +17,13 @@ type OperationData = {
|
|
|
17
17
|
name: string
|
|
18
18
|
tsResolver: PluginTs['resolver']
|
|
19
19
|
zodResolver: PluginZod['resolver'] | undefined
|
|
20
|
-
typeFile:
|
|
21
|
-
zodFile:
|
|
20
|
+
typeFile: KubbFile.File
|
|
21
|
+
zodFile: KubbFile.File | undefined
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
type Controller = {
|
|
25
25
|
name: string
|
|
26
|
-
file:
|
|
26
|
+
file: KubbFile.File
|
|
27
27
|
operations: Array<OperationData>
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -118,7 +118,7 @@ export const classClientGenerator = defineGenerator<PluginClient>({
|
|
|
118
118
|
|
|
119
119
|
function collectTypeImports(ops: Array<OperationData>) {
|
|
120
120
|
const typeImportsByFile = new Map<string, Set<string>>()
|
|
121
|
-
const typeFilesByPath = new Map<string,
|
|
121
|
+
const typeFilesByPath = new Map<string, KubbFile.File>()
|
|
122
122
|
|
|
123
123
|
ops.forEach((op) => {
|
|
124
124
|
const names = resolveTypeImportNames(op.node, tsResolver)
|
|
@@ -137,7 +137,7 @@ export const classClientGenerator = defineGenerator<PluginClient>({
|
|
|
137
137
|
|
|
138
138
|
function collectZodImports(ops: Array<OperationData>) {
|
|
139
139
|
const zodImportsByFile = new Map<string, Set<string>>()
|
|
140
|
-
const zodFilesByPath = new Map<string,
|
|
140
|
+
const zodFilesByPath = new Map<string, KubbFile.File>()
|
|
141
141
|
|
|
142
142
|
ops.forEach((op) => {
|
|
143
143
|
if (!op.zodFile || !zodResolver) return
|
|
@@ -158,7 +158,7 @@ export const classClientGenerator = defineGenerator<PluginClient>({
|
|
|
158
158
|
const files = controllers.map(({ name, file, operations: ops }) => {
|
|
159
159
|
const { typeImportsByFile, typeFilesByPath } = collectTypeImports(ops)
|
|
160
160
|
const { zodImportsByFile, zodFilesByPath } =
|
|
161
|
-
parser === 'zod' ? collectZodImports(ops) : { zodImportsByFile: new Map<string, Set<string>>(), zodFilesByPath: new Map<string,
|
|
161
|
+
parser === 'zod' ? collectZodImports(ops) : { zodImportsByFile: new Map<string, Set<string>>(), zodFilesByPath: new Map<string, KubbFile.File>() }
|
|
162
162
|
const hasFormData = ops.some((op) => op.node.requestBody?.contentType === 'multipart/form-data')
|
|
163
163
|
|
|
164
164
|
return (
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { camelCase } from '@internals/utils'
|
|
2
|
+
import type { KubbFile } from '@kubb/core'
|
|
2
3
|
import { defineGenerator } from '@kubb/core'
|
|
3
|
-
import type { FabricFile } from '@kubb/fabric-core/types'
|
|
4
4
|
import { File, Function } from '@kubb/react-fabric'
|
|
5
5
|
import type { PluginClient } from '../types'
|
|
6
6
|
|
|
@@ -42,7 +42,7 @@ export const groupedClientGenerator = defineGenerator<PluginClient>({
|
|
|
42
42
|
|
|
43
43
|
return acc
|
|
44
44
|
},
|
|
45
|
-
[] as Array<{ name: string; file:
|
|
45
|
+
[] as Array<{ name: string; file: KubbFile.File; clients: Array<{ name: string; file: KubbFile.File }> }>,
|
|
46
46
|
)
|
|
47
47
|
|
|
48
48
|
return (
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from 'node:path'
|
|
2
2
|
import { camelCase, pascalCase } from '@internals/utils'
|
|
3
3
|
import type { OperationNode } from '@kubb/ast/types'
|
|
4
|
+
import type { KubbFile } from '@kubb/core'
|
|
4
5
|
import { defineGenerator } from '@kubb/core'
|
|
5
|
-
import type { FabricFile } from '@kubb/fabric-core/types'
|
|
6
6
|
import type { PluginTs } from '@kubb/plugin-ts'
|
|
7
7
|
import { pluginTsName } from '@kubb/plugin-ts'
|
|
8
8
|
import type { PluginZod } from '@kubb/plugin-zod'
|
|
@@ -16,13 +16,13 @@ type OperationData = {
|
|
|
16
16
|
name: string
|
|
17
17
|
tsResolver: PluginTs['resolver']
|
|
18
18
|
zodResolver: PluginZod['resolver'] | undefined
|
|
19
|
-
typeFile:
|
|
20
|
-
zodFile:
|
|
19
|
+
typeFile: KubbFile.File
|
|
20
|
+
zodFile: KubbFile.File | undefined
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
type Controller = {
|
|
24
24
|
name: string
|
|
25
|
-
file:
|
|
25
|
+
file: KubbFile.File
|
|
26
26
|
operations: Array<OperationData>
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -117,7 +117,7 @@ export const staticClassClientGenerator = defineGenerator<PluginClient>({
|
|
|
117
117
|
|
|
118
118
|
function collectTypeImports(ops: Array<OperationData>) {
|
|
119
119
|
const typeImportsByFile = new Map<string, Set<string>>()
|
|
120
|
-
const typeFilesByPath = new Map<string,
|
|
120
|
+
const typeFilesByPath = new Map<string, KubbFile.File>()
|
|
121
121
|
|
|
122
122
|
ops.forEach((op) => {
|
|
123
123
|
const names = resolveTypeImportNames(op.node, tsResolver)
|
|
@@ -136,7 +136,7 @@ export const staticClassClientGenerator = defineGenerator<PluginClient>({
|
|
|
136
136
|
|
|
137
137
|
function collectZodImports(ops: Array<OperationData>) {
|
|
138
138
|
const zodImportsByFile = new Map<string, Set<string>>()
|
|
139
|
-
const zodFilesByPath = new Map<string,
|
|
139
|
+
const zodFilesByPath = new Map<string, KubbFile.File>()
|
|
140
140
|
|
|
141
141
|
ops.forEach((op) => {
|
|
142
142
|
if (!op.zodFile || !zodResolver) return
|
|
@@ -159,7 +159,7 @@ export const staticClassClientGenerator = defineGenerator<PluginClient>({
|
|
|
159
159
|
{controllers.map(({ name, file, operations: ops }) => {
|
|
160
160
|
const { typeImportsByFile, typeFilesByPath } = collectTypeImports(ops)
|
|
161
161
|
const { zodImportsByFile, zodFilesByPath } =
|
|
162
|
-
parser === 'zod' ? collectZodImports(ops) : { zodImportsByFile: new Map<string, Set<string>>(), zodFilesByPath: new Map<string,
|
|
162
|
+
parser === 'zod' ? collectZodImports(ops) : { zodImportsByFile: new Map<string, Set<string>>(), zodFilesByPath: new Map<string, KubbFile.File>() }
|
|
163
163
|
const hasFormData = ops.some((op) => op.node.requestBody?.contentType === 'multipart/form-data')
|
|
164
164
|
|
|
165
165
|
return (
|