@kubb/plugin-client 3.0.0-alpha.9 → 3.0.0-beta.10

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.
Files changed (72) hide show
  1. package/README.md +14 -5
  2. package/client.ts +29 -8
  3. package/dist/chunk-ILOAIN3U.cjs +231 -0
  4. package/dist/chunk-ILOAIN3U.cjs.map +1 -0
  5. package/dist/chunk-PHUXTZZT.js +159 -0
  6. package/dist/chunk-PHUXTZZT.js.map +1 -0
  7. package/dist/chunk-UBMTYBLG.cjs +162 -0
  8. package/dist/chunk-UBMTYBLG.cjs.map +1 -0
  9. package/dist/chunk-UOML26IJ.js +221 -0
  10. package/dist/chunk-UOML26IJ.js.map +1 -0
  11. package/dist/client.cjs +36 -10
  12. package/dist/client.cjs.map +1 -1
  13. package/dist/client.d.cts +10 -4
  14. package/dist/client.d.ts +10 -4
  15. package/dist/client.js +24 -10
  16. package/dist/client.js.map +1 -1
  17. package/dist/components.cjs +11 -5
  18. package/dist/components.cjs.map +1 -1
  19. package/dist/components.d.cts +39 -5
  20. package/dist/components.d.ts +39 -5
  21. package/dist/components.js +2 -9
  22. package/dist/components.js.map +1 -1
  23. package/dist/generators.cjs +17 -4
  24. package/dist/generators.cjs.map +1 -1
  25. package/dist/generators.d.cts +7 -6
  26. package/dist/generators.d.ts +7 -6
  27. package/dist/generators.js +3 -7
  28. package/dist/generators.js.map +1 -1
  29. package/dist/index.cjs +11 -109
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +1 -4
  32. package/dist/index.d.ts +1 -4
  33. package/dist/index.js +3 -114
  34. package/dist/index.js.map +1 -1
  35. package/dist/types-DMMK2qi5.d.cts +88 -0
  36. package/dist/types-DMMK2qi5.d.ts +88 -0
  37. package/package.json +14 -17
  38. package/src/components/Client.tsx +120 -60
  39. package/src/generators/__snapshots__/deletePet.ts +13 -0
  40. package/src/generators/__snapshots__/deletePetObject.ts +13 -0
  41. package/src/generators/__snapshots__/findByTags.ts +13 -0
  42. package/src/generators/__snapshots__/findByTagsFull.ts +13 -0
  43. package/src/generators/__snapshots__/findByTagsObject.ts +15 -0
  44. package/src/generators/__snapshots__/findByTagsWithZod.ts +13 -0
  45. package/src/generators/__snapshots__/findByTagsWithZodFull.ts +13 -0
  46. package/src/generators/__snapshots__/importPath.ts +13 -0
  47. package/src/generators/__snapshots__/operations.ts +82 -0
  48. package/src/generators/__snapshots__/updatePetById.ts +12 -0
  49. package/src/generators/clientGenerator.tsx +67 -0
  50. package/src/generators/groupedClientGenerator.tsx +70 -0
  51. package/src/generators/index.ts +3 -1
  52. package/src/generators/operationsGenerator.tsx +26 -0
  53. package/src/plugin.ts +37 -46
  54. package/src/types.ts +47 -87
  55. package/dist/chunk-AZDWYBLW.cjs +0 -1
  56. package/dist/chunk-AZDWYBLW.cjs.map +0 -1
  57. package/dist/chunk-GHHJWXKQ.cjs +0 -61
  58. package/dist/chunk-GHHJWXKQ.cjs.map +0 -1
  59. package/dist/chunk-OODSLPAP.js +0 -61
  60. package/dist/chunk-OODSLPAP.js.map +0 -1
  61. package/dist/chunk-W256NILH.js +0 -128
  62. package/dist/chunk-W256NILH.js.map +0 -1
  63. package/dist/chunk-YGRM4AA5.cjs +0 -128
  64. package/dist/chunk-YGRM4AA5.cjs.map +0 -1
  65. package/dist/chunk-YJOVLRSC.js +0 -1
  66. package/dist/chunk-YJOVLRSC.js.map +0 -1
  67. package/dist/types-DETYKDFZ.d.cts +0 -139
  68. package/dist/types-DETYKDFZ.d.ts +0 -139
  69. package/src/components/__snapshots__/Client/showPetById.ts +0 -8
  70. package/src/components/__snapshots__/Operations/showPetById.ts +0 -6
  71. package/src/components/__snapshots__/Query/showPetById.ts +0 -15
  72. package/src/generators/axiosGenerator.tsx +0 -63
@@ -1,63 +0,0 @@
1
- import { createReactGenerator } from '@kubb/plugin-oas'
2
- import { useOperationManager } from '@kubb/plugin-oas/hooks'
3
- import { pluginTsName } from '@kubb/plugin-ts'
4
- import { File, useApp } from '@kubb/react'
5
- import { Client } from '../components/Client'
6
- import { Operations } from '../components/Operations'
7
- import type { PluginClient } from '../types'
8
-
9
- export const axiosGenerator = createReactGenerator<PluginClient>({
10
- name: 'plugin-client',
11
- Operations({ options, operations }) {
12
- const { pluginManager } = useApp<PluginClient>()
13
-
14
- if (!options.templates.operations) {
15
- return null
16
- }
17
-
18
- const Template = options.templates.operations || Operations
19
- const name = 'operations'
20
- const file = pluginManager.getFile({ name, extName: '.ts', pluginKey: ['plugin-client'] })
21
-
22
- return (
23
- <File baseName={file.baseName} path={file.path} meta={file.meta}>
24
- <Template name={name} operations={operations} />
25
- </File>
26
- )
27
- },
28
- Operation({ options, operation }) {
29
- const { getSchemas, getName, getFile } = useOperationManager()
30
-
31
- const name = getName(operation, { type: 'function' })
32
- const typedSchemas = getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' })
33
- const file = getFile(operation)
34
- const fileType = getFile(operation, { pluginKey: [pluginTsName] })
35
-
36
- if (!options.templates.client) {
37
- return null
38
- }
39
-
40
- const Template = options.templates.client || Client
41
-
42
- return (
43
- <File baseName={file.baseName} path={file.path} meta={file.meta}>
44
- <File.Import name={'client'} path={options.client.importPath} />
45
- <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />
46
- <File.Import
47
- extName={options.extName}
48
- name={[
49
- typedSchemas.request?.name,
50
- typedSchemas.response.name,
51
- typedSchemas.pathParams?.name,
52
- typedSchemas.queryParams?.name,
53
- typedSchemas.headerParams?.name,
54
- ].filter(Boolean)}
55
- root={file.path}
56
- path={fileType.path}
57
- isTypeOnly
58
- />
59
- <Template name={name} options={options} typedSchemas={typedSchemas} operation={operation} />
60
- </File>
61
- )
62
- },
63
- })